Skip to content
This repository was archived by the owner on Sep 18, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,9 +295,9 @@ storage:
- path: /opt/file2
filesystem: filesystem1
contents:
compression: gzip
remote:
url: http://example.com/file2
compression: gzip
verification:
hash:
function: sha512
Expand All @@ -311,9 +311,9 @@ storage:
- path: /opt/file3
filesystem: filesystem2
contents:
compression: gzip
remote:
url: http://example.com/file3
compression: gzip
mode: 0400
user:
id: 1000
Expand Down Expand Up @@ -503,9 +503,9 @@ storage:
User: &types.FileUser{Id: util.IntToPtr(502)},
Group: &types.FileGroup{Id: util.IntToPtr(503)},
Contents: types.FileContents{
Compression: "gzip",
Remote: types.Remote{
Url: "http://example.com/file2",
Compression: "gzip",
Url: "http://example.com/file2",
Verification: types.Verification{
Hash: types.Hash{
Function: "sha512",
Expand All @@ -523,9 +523,9 @@ storage:
User: &types.FileUser{Id: util.IntToPtr(1000)},
Group: &types.FileGroup{Id: util.IntToPtr(1001)},
Contents: types.FileContents{
Compression: "gzip",
Remote: types.Remote{
Url: "http://example.com/file3",
Compression: "gzip",
Url: "http://example.com/file3",
},
},
Mode: util.IntToPtr(0400),
Expand Down Expand Up @@ -1197,9 +1197,9 @@ func TestConvert(t *testing.T) {
User: &types.FileUser{Id: util.IntToPtr(502)},
Group: &types.FileGroup{Id: util.IntToPtr(503)},
Contents: types.FileContents{
Compression: "gzip",
Remote: types.Remote{
Url: "http://example.com/file2",
Compression: "gzip",
Url: "http://example.com/file2",
Verification: types.Verification{
Hash: types.Hash{
Function: "sha512",
Expand All @@ -1217,9 +1217,9 @@ func TestConvert(t *testing.T) {
User: &types.FileUser{Id: util.IntToPtr(1000)},
Group: &types.FileGroup{Id: util.IntToPtr(1001)},
Contents: types.FileContents{
Compression: "gzip",
Remote: types.Remote{
Url: "http://example.com/file3",
Compression: "gzip",
Url: "http://example.com/file3",
},
},
Mode: util.IntToPtr(0400),
Expand Down Expand Up @@ -1424,12 +1424,12 @@ func TestConvert(t *testing.T) {
},
FileEmbedded1: ignTypes.FileEmbedded1{
Contents: ignTypes.FileContents{
Compression: "gzip",
Source: (&url.URL{
Scheme: "http",
Host: "example.com",
Path: "/file2",
}).String(),
Compression: "gzip",
Verification: ignTypes.Verification{
Hash: util.StringToPtr("sha512-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
},
Expand Down Expand Up @@ -1930,9 +1930,9 @@ storage:
- path: /opt/file2
filesystem: root
contents:
compression: gzip
remote:
url: httpz://example.com/file2
compression: gzip
verification:
hash:
function: sha512
Expand All @@ -1955,7 +1955,7 @@ storage:
{
Message: "invalid url scheme",
Kind: report.EntryError,
Line: 17,
Line: 18,
Column: 16,
},
}},
Expand Down Expand Up @@ -2017,9 +2017,9 @@ storage:
- path: /opt/file2
filesystem: root
contents:
compression: gzip
remote:
url: http://example.com/file2
compression: gzip
verification:
hash:
function: sha512
Expand Down Expand Up @@ -2060,12 +2060,12 @@ storage:
},
FileEmbedded1: ignTypes.FileEmbedded1{
Contents: ignTypes.FileContents{
Compression: "gzip",
Source: (&url.URL{
Scheme: "http",
Host: "example.com",
Path: "/file2",
}).String(),
Compression: "gzip",
Verification: ignTypes.Verification{
Hash: util.StringToPtr("sha512-00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"),
},
Expand Down
10 changes: 5 additions & 5 deletions config/types/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,14 @@ type File struct {
}

type FileContents struct {
Remote Remote `yaml:"remote"`
Inline string `yaml:"inline"`
Local string `yaml:"local"`
Compression string `yaml:"compression"`
Remote Remote `yaml:"remote"`
Inline string `yaml:"inline"`
Local string `yaml:"local"`
}

type Remote struct {
Url string `yaml:"url"`
Compression string `yaml:"compression"`
Verification Verification `yaml:"verification"`
}

Expand Down Expand Up @@ -237,7 +237,7 @@ func init() {
}
}

newFile.Contents.Compression = file.Contents.Remote.Compression
newFile.Contents.Compression = file.Contents.Compression
newFile.Contents.Verification = convertVerification(file.Contents.Remote.Verification)

out.Storage.Files = append(out.Storage.Files, newFile)
Expand Down
2 changes: 1 addition & 1 deletion doc/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ _Note: all fields are optional unless otherwise marked_
* **overwrite** (boolean): whether to delete preexisting nodes at the path. Defaults to true.
* **append** (boolean): whether to append to the specified file. Creates a new file if nothing exists at the path. Cannot be set if overwrite is set to true.
* **contents** (object): options related to the contents of the file.
* **compression** (string): the type of compression used on the contents (null or gzip)
* **inline** (string): the contents of the file.
* **local** (string): the path to a local file, relative to the `--files-dir` directory. When using local files, the `--files-dir` flag must be passed to `ct`. The file contents are included in the generated config.
* **remote** (object): options related to the fetching of remote file contents. Remote files are fetched by Ignition when Ignition runs, the contents are not included in the generated config.
* **compression** (string): the type of compression used on the contents (null or gzip)
* **url** (string): the URL of the file contents. Supported schemes are http, https, tftp, s3, and [data][rfc2397]. Note: When using http, it is advisable to use the verification option to ensure the contents haven't been modified.
* **verification** (object): options related to the verification of the file contents.
* **hash** (object): the hash of the config
Expand Down
2 changes: 1 addition & 1 deletion doc/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ storage:
- path: /opt/file2
filesystem: root
contents:
compression: gzip
remote:
url: http://example.com/file2
compression: gzip
verification:
hash:
function: sha512
Expand Down