Skip to content
This repository was archived by the owner on Apr 3, 2018. It is now read-only.

virtc: Check mandatory command-line arguments. - #165

Merged
sboeuf merged 1 commit into
containers:masterfrom
jodh-intel:check-cli-arguments
Mar 23, 2017
Merged

sboeuf merged 1 commit into
containers:masterfrom
jodh-intel:check-cli-arguments

Conversation

@jodh-intel

Copy link
Copy Markdown
Collaborator

Ensure that all mandatory arguments are checked early.

Note that urfave/cli doesn't actually provide such a feature. The
approach taken attempts to avoid duplicated code by checking centrally,
rather than peppering checks on podID and containerID in lots of
functions.

Signed-off-by: James O. D. Hunt james.o.hunt@intel.com

Comment thread hack/virtc/main.go Outdated

id := context.String("id")
if id != "" {
return nil

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should test id == "" and return the error here, rather than return nil from here. It would be more consistent with the way we write functions usually, don't you think ?

@sboeuf

sboeuf commented Mar 22, 2017

Copy link
Copy Markdown
Collaborator

@jodh-intel only one comment, and you also need to fix travis, but other than that, we can merge this.

@jodh-intel
jodh-intel force-pushed the check-cli-arguments branch from f9f1bec to 1924e60 Compare March 23, 2017 09:15
@jodh-intel

Copy link
Copy Markdown
Collaborator Author

Hi @sboeuf - I've fixed the main issue causing the Travis failure. However, I was then seeing test TestRemoveNetworkFailureNetworkDoesNotExist fail. This didn't make much sense, but after debugging I can see the failure on master locally. This is confirmed by re-running the Travis tests on master which are currently failing even though the last build for the same commit passed).

@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.05%) to 66.394% when pulling 1924e60 on jodh-intel:check-cli-arguments into 8362442 on containers:master.

@sboeuf

sboeuf commented Mar 23, 2017 •

Copy link
Copy Markdown
Collaborator

lgtm

Approved with PullApprove

Ensure that all mandatory arguments are checked early.

Note that urfave/cli doesn't actually provide such a feature. The
approach taken attempts to avoid duplicated code by checking centrally,
rather than peppering checks on podID and containerID in lots of
functions.

Signed-off-by: James O. D. Hunt <james.o.hunt@intel.com>
@jodh-intel
jodh-intel force-pushed the check-cli-arguments branch from 1924e60 to bce9c9d Compare March 23, 2017 14:44
@coveralls

Copy link
Copy Markdown

Coverage Status

Coverage remained the same at 66.394% when pulling bce9c9d on jodh-intel:check-cli-arguments into 8c782de on containers:master.

@sboeuf
sboeuf merged commit 49a8e90 into containers:master Mar 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants