1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/runconfig/opts
Yong Tang ee4bd806ba API/CLI discrepancy on hostname validation (#21595).
This fix tries to fix the discrepancy between API and CLI on hostname
validation. Previously, the hostname validation was handled at the
CLI interface in runconfig/opts/parse.go and return an error if the
hostname is invalid. However, if an end user use the remote API to
pass the hostname, the error will not be returned immediately.
Instead the error will only be thrown out when the container creation
fails. This creates behavior discrepancy between API and CLI.

In this fix, the hostname validation was moved to
verifyContainerSettings so the behavior will be the same for API and
CLI.

After the change, since CLI does not handle the hostname validation
any more, the previous unit tests about hostname validation on CLI
in runconfig/opts/parse_test.go has to be updated as well because
there is no validation at this stage. All those unit tests are moved
to integration test TestRunTooLongHostname so that the hostname
validation is still properly covered as before.

Note: Since the hostname validation moved to API, the error message
changes from `invalid hostname format for --hostname:` to
`invalid hostname format:` as well because `--hostname` is passed
to CLI only.

This fix fixes #21595.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
2016-04-08 06:13:08 +00:00
..
fixtures Move the runconfig.Parse() function into the runconfig/opts package. 2016-01-04 12:06:29 -05:00
envfile.go Move some validators from opts to runconfig/opts. 2016-01-04 14:35:36 -05:00
envfile_test.go Move some validators from opts to runconfig/opts. 2016-01-04 14:35:36 -05:00
opts.go fix typos 2016-04-06 10:35:01 +08:00
opts_test.go Move some validators from opts to runconfig/opts. 2016-01-04 14:35:36 -05:00
parse.go API/CLI discrepancy on hostname validation (#21595). 2016-04-08 06:13:08 +00:00
parse_test.go API/CLI discrepancy on hostname validation (#21595). 2016-04-08 06:13:08 +00:00
throttledevice.go Modify import paths to point to the new engine-api package. 2016-01-06 19:48:59 -05:00
ulimit.go Move ulimit options to runconfig opts 2015-12-23 13:27:58 -05:00
ulimit_test.go Move ulimit options to runconfig opts 2015-12-23 13:27:58 -05:00
weightdevice.go Modify import paths to point to the new engine-api package. 2016-01-06 19:48:59 -05:00