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

Add --all and --latest to checkpoint/restore #1662

Merged
merged 5 commits into from
Oct 23, 2018

Conversation

adrianreber
Copy link
Collaborator

This started as a simple change to add --all and --latest to the checkpoint and restore commands.

While adding these features I saw that the same code to handle --all and --latest can be found in multiple places. So I extended this PR to include common code for --all and --latest handling and replaced the code with the newly added common code at a few places. Overall this PR removes more lines of code than it adds.

I have run the test suite after each commit locally and the results looked good.

I initially included the changes also in port.go but as the port command allows a port to be listed after -l the newly added common logic cannot be used in port.go.

@openshift-ci-robot openshift-ci-robot added size/L needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 17, 2018
Name: "all, a",
Usage: "checkpoint all running containers",
},
LatestFlag,
Copy link
Member

Choose a reason for hiding this comment

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

Not for this PR, but if we're going to define LatestFlag in common.go, should we do the same for the All flag?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I actually thought about it, but the verb ('running' in this case), would be different, so it has to be a function. As the definition of the flags happens outside of a function, it would also need to be moved inside the function, I think, and it sounded overly complicated in this case.

Copy link
Member

Choose a reason for hiding this comment

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

Oh good point on the running bit, that verbiage is probably different amongst the different podman commands.

Copy link
Member

@TomSweeneyRedHat TomSweeneyRedHat left a comment

Choose a reason for hiding this comment

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

LGTM, love code condensation changes like this. 🥇

@mheon
Copy link
Member

mheon commented Oct 17, 2018

/approve

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 17, 2018
@mheon
Copy link
Member

mheon commented Oct 17, 2018

/ok-to-test

@openshift-ci-robot openshift-ci-robot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Oct 17, 2018
@mheon
Copy link
Member

mheon commented Oct 17, 2018

Code LGTM

@umohnani8
Copy link
Member

LGTM

@mheon
Copy link
Member

mheon commented Oct 18, 2018

@adrianreber Mind rebasing to pick up CI fixes?

@adrianreber
Copy link
Collaborator Author

/retest

@adrianreber adrianreber force-pushed the all-and-latest branch 2 times, most recently from 2eae3fb to d6eacd4 Compare October 23, 2018 11:04
@rhatdan
Copy link
Member

rhatdan commented Oct 23, 2018

/approve
/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 23, 2018
@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mheon, rhatdan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@rh-atomic-bot
Copy link
Collaborator

☔ The latest upstream changes (presumably #1639) made this pull request unmergeable. Please resolve the merge conflicts.

@rhatdan
Copy link
Member

rhatdan commented Oct 23, 2018

@adrianreber Needs a rebase.

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Oct 23, 2018
@mheon
Copy link
Member

mheon commented Oct 23, 2018

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 23, 2018
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Oct 23, 2018
@adrianreber
Copy link
Collaborator Author

Sorry, rebasing broke the import statements. Fixed and force pushed.

@mheon
Copy link
Member

mheon commented Oct 23, 2018

bot, retest this please

@mheon
Copy link
Member

mheon commented Oct 23, 2018

/retest images

The check about the --all and --latest option is used and repeated and
some commands. Factor it out and put it into common.

Signed-off-by: Adrian Reber <[email protected]>
Just as the checkAllAndLatest() function the new code in
getAllOrLatestContainers() is used in some commands and duplicated. This
factors out this code to be used in other places without duplicating it.

Signed-off-by: Adrian Reber <[email protected]>
Instead of duplicating the same code in multiple commands this uses the
newly added function checkAllAndLatest() instead.

Signed-off-by: Adrian Reber <[email protected]>
This removes duplicate code paths which has been previously factored out
as getAllOrLatestContainers().

Signed-off-by: Adrian Reber <[email protected]>
This add the convenience options --all and --latest to the subcommands
checkpoint and restore.

Signed-off-by: Adrian Reber <[email protected]>
@adrianreber
Copy link
Collaborator Author

I was testing in the wrong directory and was pushing broken code. Not good. This time I verified that I actually tested it correctly. Sorry for all the noise here.

@mheon
Copy link
Member

mheon commented Oct 23, 2018

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 23, 2018
@openshift-merge-robot openshift-merge-robot merged commit c019830 into containers:master Oct 23, 2018
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 27, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants