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
merged 1 commit into from
Mar 23, 2017

Conversation

jodh-intel
Copy link
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 [email protected]


id := context.String("id")
if id != "" {
return nil
Copy link
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
Copy link
Collaborator

sboeuf commented Mar 22, 2017

@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
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

Coverage Status

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

@sboeuf
Copy link
Collaborator

sboeuf commented Mar 23, 2017

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 <[email protected]>
@jodh-intel jodh-intel force-pushed the check-cli-arguments branch from 1924e60 to bce9c9d Compare March 23, 2017 14:44
@coveralls
Copy link

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