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

cogctl bootstrap should really be idempotent #574

Closed
christophermaier opened this issue Apr 25, 2016 · 4 comments
Closed

cogctl bootstrap should really be idempotent #574

christophermaier opened this issue Apr 25, 2016 · 4 comments
Assignees
Milestone

Comments

@christophermaier
Copy link
Collaborator

christophermaier commented Apr 25, 2016

Currently, running cogctl bootstrap on a previously-bootstrapped system exits with a 1 instead of a 0. This means the command is not actually idempotent, and forces consumers to deal with a "failure" that isn't really a failure, and still yields a system in the same state as if it hadn't been previously bootstrapped.

@christophermaier
Copy link
Collaborator Author

Also, please update the note on http://docs.operable.io/v0.4/docs/bootstrapping-cog when this is fixed. It should reflect the fact that the operation is truly idempotent.

@christophermaier christophermaier added this to the Cog 0.5.0 milestone Apr 25, 2016
@tecnobrat
Copy link
Contributor

One issue I had when bootstrapping with docker is that it does so inside the container. The container doesn't save state, so the .cogctl file is not saved anywhere.

So the next time you run cogctl, you are in a broken state, with no way to get the admin password. Perhaps this is best off by documenting how a user can create a replacement admin user? So that they always know the password (because they set it)?

@christophermaier
Copy link
Collaborator Author

Hmm, yeah, that's a bit inconvenient 😦

It looks like there is internal support for specifying an admin password at bootstrap time, but that didn't get exposed in the cogctl interface. Should be a straightforward fix.

I think we can do a better job documenting things for this usecase as well. I'll write this up as a new and separate issue to track, since it's distinct from the idempotency bit.

It's excellent feedback, so 💯 for pointing it out @tecnobrat !

@mpeck
Copy link
Contributor

mpeck commented Apr 27, 2016

I think this is actually a pretty simple fix. The api returns a 423 and json with an errors key,

{"errors": {"bootstrap": "Already bootstrapped"}}

cogctl matches on "error" and renders "Already bootstrapped" as an error with an exit code of 1. I think if we get a 423 from the api we can just render "Already bootstrapped" and exit with a 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants