Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

fleetctl: Add restart functionality #932

Closed
wants to merge 1 commit into from
Closed

Conversation

ryandub
Copy link
Contributor

@ryandub ryandub commented Sep 30, 2014

Starts and stops a unit in one command.

refs #760

This is a lot of copy+paste from the current start and stop commands. Feedback appreciated. 😄

Starts and stops a unit in one command.

refs coreos#760
stderr("Error waiting for units: %v", err)
exit = 1
}
} else {
Copy link
Contributor

Choose a reason for hiding this comment

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

You actually can't skip the blocking code here, since you must guarantee that the agent stopped the unit. If you don't assert this, the restart operation might not actually cause any work to happen.

@bcwaldon
Copy link
Contributor

bcwaldon commented Oct 2, 2014

@ryandub Rather than changing the desired state, it might work a lot better to implement this as a parallel-ssh operation. You effectively want to call systemctl restart X for each of the units, anyways, so why not just do that?

@ryandub
Copy link
Contributor Author

ryandub commented Oct 2, 2014

@bcwaldon Thanks for the feedback. I actually didn't think about the ssh call, but you are exactly right - that would be a better way to implement this. I assume that this can be achieved just like the status and journal commands by using runCommand from

func runCommand(cmd string, machID string) (retcode int) {
.

I'm new to Go - any tips on parallelization?

Thanks!

@jonboulle
Copy link
Contributor

@ryandub you can follow the same basic idea that fleetctl uses at with waitForUnitStates at the moment except it would probably look like func waitForUnitsToRestart(units []string) chan error

@ryandub
Copy link
Contributor Author

ryandub commented Oct 3, 2014

Thanks @jonboulle - will give that a look.

@bcwaldon
Copy link
Contributor

bcwaldon commented Oct 9, 2014

Please reopen when you've had a chance to get back to this.

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