Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config-linux: Make Linux 'devices' explicitly optional #526

Merged
merged 2 commits into from
Aug 7, 2016

Conversation

wking
Copy link
Contributor

@wking wking commented Aug 3, 2016

Both linux.devices and linux.resources.devices. Details in the commit messages.

wking added 2 commits August 3, 2016 09:13
To match the omitempty which the Go property has had since 28cc423
(add omitempty to 'Device' and 'Namespace', 2016-03-10, opencontainers#340).

Signed-off-by: W. Trevor King <wking@tremily.us>
And mark it omitempty to avoid:

  $ ocitools generate --template <(echo '{"linux": {"resources": {}}}') | jq .linux
  {
    "resources": {
      "devices": null
    }
  }

Signed-off-by: W. Trevor King <wking@tremily.us>
@mrunalp
Copy link
Contributor

mrunalp commented Aug 3, 2016

LGTM

Approved with PullApprove

1 similar comment
@hqhq
Copy link
Contributor

hqhq commented Aug 7, 2016

LGTM

Approved with PullApprove

@hqhq hqhq merged commit c9c2574 into opencontainers:master Aug 7, 2016
@wking wking deleted the optional-devices branch August 18, 2016 04:54
wking added a commit to wking/ocitools-v2 that referenced this pull request Nov 8, 2016
This saves a few lines of code and removes a layer of indirection.
It's now obvious to the caller exactly what is changing, although
there is sometimes less per-setting validation.  That's ok though;
folks interested in validating the config can call the validator on it
after they've finished mucking about.

This new approach also initializes any needer pointer fields at the
top.  With the current runtime-spec types, that can lead to some
orphaned pointer fields, e.g.;

  $ ./oci-runtime-tool generate --template <(echo '{}')
  {
          "ociVersion": "1.0.0-rc1-dev",
          "platform": {
                  "os": "linux",
                  "arch": "amd64"
          },
          "process": {
                  "user": {
                          "uid": 0,
                          "gid": 0
                  },
                  "args": null,
                  "cwd": "/"
          },
          "root": {
                  "path": "rootfs"
          },
          "hooks": {},
          "linux": {
                  "resources": {
                          "devices": null
                  }
          }
  }

but the devices issue was fixed in runtime-spec 1.0.0-rc2 [1] and
there are other approaches to collapsing unused pointer properties
[2].

[1]: opencontainers/runtime-spec#526
[2]: opencontainers#112

Signed-off-by: W. Trevor King <wking@tremily.us>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants