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

specs-go/config: Make Linux and Solaris omitempty #431

Merged
merged 2 commits into from
May 9, 2016

Conversation

wking
Copy link
Contributor

@wking wking commented May 7, 2016

Also document solaris in the platform-specific configuration
section. Details in the commit messages.

wking added 2 commits May 6, 2016 23:57
Fixup for 7c9daeb (Introducing Solaris in OCI, 2016-04-25, opencontainers#411) along
the lines of b373a15 (config: Split platform-specific configuration
into its own section, 2016-05-02, opencontainers#414).

Signed-off-by: W. Trevor King <wking@tremily.us>
Both fields are optional, so you could conceivably have neither.
However, in most cases folks will populate the one corresponding to
their platform.  The one that *doesn't* match their platform must not
show up, in order to avoid violating the:

  This should only be set if **`platform.os`** is ...

phrasing.

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

LGTM

1 similar comment
@mrunalp
Copy link
Contributor

mrunalp commented May 9, 2016

LGTM

@mrunalp mrunalp merged commit adea03f into opencontainers:master May 9, 2016
@wking wking deleted the platform-specific-solaris branch May 13, 2016 17:32
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request May 16, 2016
This should have been part of 759ee79 (config: Add
platform-specific entry for 'solaris', 2016-05-06, opencontainers#431), since
the example has playform.os set to 'linux'.

There was some (brief) discussion of this point before the 'solaris'
section landed [1], but the "should only be set if" wording landed in
parallel via b373a15 (config: Split platform-specific configuration
into its own section, 2016-05-02, opencontainers#414), and I'd forgotten to go back
and apply that logic to opencontainers#411.

Having a full Solaris example would be useful, but I think it should
be a separate, Solaris-only example.

[1]: opencontainers#411 (comment)

Signed-off-by: W. Trevor King <wking@tremily.us>
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request May 16, 2016
This should have been part of 759ee79 (config: Add
platform-specific entry for 'solaris', 2016-05-06, opencontainers#431), since
the example has platform.os set to 'linux'.

There was some (brief) discussion of this point before the 'solaris'
section landed [1], but the "should only be set if" wording landed in
parallel via b373a15 (config: Split platform-specific configuration
into its own section, 2016-05-02, opencontainers#414), and I'd forgotten to go back
and apply that logic to opencontainers#411.

Having a full Solaris example would be useful, but I think it should
be a separate, Solaris-only example.

[1]: opencontainers#411 (comment)

Signed-off-by: W. Trevor King <wking@tremily.us>
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Jun 18, 2016
I'd added some omitempties in 5c2193f (specs-go/config: Make Linux
and Solaris omitempty, 2016-05-06, opencontainers#431), but it turns out to not have
the intended effect unless the field is also a pointer type.  Before
this commit:

  $ ./ocitools generate --template <(echo '{}')
  $ jq . config.json
  {
    "ociVersion": "1.0.0-rc1-dev",
    "platform": {
      "os": "linux",
      "arch": "amd64"
    },
    "process": {
      "user": {
        "uid": 0,
        "gid": 0
      },
      "args": [],
      "cwd": "/"
    },
    "root": {
      "path": "rootfs"
    },
    "hooks": {},
    "linux": {
      "cgroupsPath": ""
    },
    "solaris": {
      "cappedCPU": {},
      "cappedMemory": {}
    }
  }

And after this commit:

  $ ./ocitools generate --template <(echo '{}')
  $ jq . config.json
  {
    "ociVersion": "1.0.0-rc1-dev",
    "platform": {
      "os": "linux",
      "arch": "amd64"
    },
    "process": {
      "user": {
        "uid": 0,
        "gid": 0
      },
      "args": [],
      "cwd": "/"
    },
    "root": {
      "path": "rootfs"
    },
    "hooks": {},
  }

The remaining useless properties are addressed by other in-flight pull
requests:

* 5ca74df (config: Make 'process.args' optional, 2016-06-04, opencontainers#489)
* ad33f9c (config: Explicitly list 'hooks' as optional, 2016-05-06,
  opencontainers#427)

So I've left them alone here.

Signed-off-by: W. Trevor King <wking@tremily.us>
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Jun 18, 2016
I'd added some omitempties in 5c2193f (specs-go/config: Make Linux
and Solaris omitempty, 2016-05-06, opencontainers#431), but it turns out to not have
the intended effect unless the field is also a pointer type (even
after I shifted the 'omitempty' from the platform tag to the json tag

  $ ./ocitools generate --template <(echo '{}')
  $ jq . config.json
  {
    "ociVersion": "1.0.0-rc1-dev",
    "platform": {
      "os": "linux",
      "arch": "amd64"
    },
    "process": {
      "user": {
        "uid": 0,
        "gid": 0
      },
      "args": [],
      "cwd": "/"
    },
    "root": {
      "path": "rootfs"
    },
    "hooks": {},
    "linux": {
      "cgroupsPath": ""
    },
    "solaris": {
      "cappedCPU": {},
      "cappedMemory": {}
    }
  }

And after this commit:

  $ ./ocitools generate --template <(echo '{}')
  $ jq . config.json
  {
    "ociVersion": "1.0.0-rc1-dev",
    "platform": {
      "os": "linux",
      "arch": "amd64"
    },
    "process": {
      "user": {
        "uid": 0,
        "gid": 0
      },
      "args": [],
      "cwd": "/"
    },
    "root": {
      "path": "rootfs"
    },
    "hooks": {},
  }

The remaining useless properties are addressed by other in-flight pull
requests:

* 5ca74df (config: Make 'process.args' optional, 2016-06-04, opencontainers#489)
* ad33f9c (config: Explicitly list 'hooks' as optional, 2016-05-06,
  opencontainers#427)

So I've left them alone here.

Signed-off-by: W. Trevor King <wking@tremily.us>
wking added a commit to wking/opencontainer-runtime-spec that referenced this pull request Jun 18, 2016
I'd added some omitempties in 5c2193f (specs-go/config: Make Linux
and Solaris omitempty, 2016-05-06, opencontainers#431), but it turns out to not have
the intended effect unless the field is also a pointer type (even
after I shifted the 'omitempty' from the platform tag to the json
tag).  Before this commit:

  $ ./ocitools generate --template <(echo '{}')
  $ jq . config.json
  {
    "ociVersion": "1.0.0-rc1-dev",
    "platform": {
      "os": "linux",
      "arch": "amd64"
    },
    "process": {
      "user": {
        "uid": 0,
        "gid": 0
      },
      "args": [],
      "cwd": "/"
    },
    "root": {
      "path": "rootfs"
    },
    "hooks": {},
    "linux": {
      "cgroupsPath": ""
    },
    "solaris": {
      "cappedCPU": {},
      "cappedMemory": {}
    }
  }

And after this commit:

  $ ./ocitools generate --template <(echo '{}')
  $ jq . config.json
  {
    "ociVersion": "1.0.0-rc1-dev",
    "platform": {
      "os": "linux",
      "arch": "amd64"
    },
    "process": {
      "user": {
        "uid": 0,
        "gid": 0
      },
      "args": [],
      "cwd": "/"
    },
    "root": {
      "path": "rootfs"
    },
    "hooks": {},
  }

The remaining useless properties are addressed by other in-flight pull
requests:

* 5ca74df (config: Make 'process.args' optional, 2016-06-04, opencontainers#489)
* ad33f9c (config: Explicitly list 'hooks' as optional, 2016-05-06,
  opencontainers#427)

So I've left them alone here.

Signed-off-by: W. Trevor King <wking@tremily.us>
Mashimiao pushed a commit to Mashimiao/specs that referenced this pull request Aug 19, 2016
This should have been part of 759ee79 (config: Add
platform-specific entry for 'solaris', 2016-05-06, opencontainers#431), since
the example has platform.os set to 'linux'.

There was some (brief) discussion of this point before the 'solaris'
section landed [1], but the "should only be set if" wording landed in
parallel via b373a15 (config: Split platform-specific configuration
into its own section, 2016-05-02, opencontainers#414), and I'd forgotten to go back
and apply that logic to opencontainers#411.

Having a full Solaris example would be useful, but I think it should
be a separate, Solaris-only example.

[1]: opencontainers#411 (comment)

Signed-off-by: W. Trevor King <wking@tremily.us>
Mashimiao pushed a commit to Mashimiao/specs that referenced this pull request Aug 19, 2016
I'd added some omitempties in 5c2193f (specs-go/config: Make Linux
and Solaris omitempty, 2016-05-06, opencontainers#431), but it turns out to not have
the intended effect unless the field is also a pointer type (even
after I shifted the 'omitempty' from the platform tag to the json
tag).  Before this commit:

  $ ./ocitools generate --template <(echo '{}')
  $ jq . config.json
  {
    "ociVersion": "1.0.0-rc1-dev",
    "platform": {
      "os": "linux",
      "arch": "amd64"
    },
    "process": {
      "user": {
        "uid": 0,
        "gid": 0
      },
      "args": [],
      "cwd": "/"
    },
    "root": {
      "path": "rootfs"
    },
    "hooks": {},
    "linux": {
      "cgroupsPath": ""
    },
    "solaris": {
      "cappedCPU": {},
      "cappedMemory": {}
    }
  }

And after this commit:

  $ ./ocitools generate --template <(echo '{}')
  $ jq . config.json
  {
    "ociVersion": "1.0.0-rc1-dev",
    "platform": {
      "os": "linux",
      "arch": "amd64"
    },
    "process": {
      "user": {
        "uid": 0,
        "gid": 0
      },
      "args": [],
      "cwd": "/"
    },
    "root": {
      "path": "rootfs"
    },
    "hooks": {},
  }

The remaining useless properties are addressed by other in-flight pull
requests:

* 5ca74df (config: Make 'process.args' optional, 2016-06-04, opencontainers#489)
* ad33f9c (config: Explicitly list 'hooks' as optional, 2016-05-06,
  opencontainers#427)

So I've left them alone here.

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