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

Data loss should be opt-in #22

Open
zyegfryed opened this issue Dec 13, 2013 · 0 comments
Open

Data loss should be opt-in #22

zyegfryed opened this issue Dec 13, 2013 · 0 comments

Comments

@zyegfryed
Copy link

As this time of writing, running librarian-chef with an existing cookbooks directory will wipe out all the data before installing the dependencies. Without letting the user know what's going behind the scene. This is an issue when you're beginner and you start writing recipes and then want to manage dependencies to test them, and everything is in the same cookbooks directory. Like detailed in First steps with Chef tutorial for example.

We should never destroy any data without informing the user before.

A proposed solution would be to explain to the user what's going and prompting him/her for it's agreement, like the following:

A 'cookbook' directory already exists. Proceeding will remove the current
directory and might lead to data loss. Are you sure to continue? (y/N)

When the answer is negative (no/n), the program exits without any further ado.
When the answer is positive (yes/y), the program behaves the same as currently.

We should be protective regarding the user data, hence the capital letter N as default choice. So, even when a user hit [ENTER] without reading the warning message his/her recipes are safe.

For advanced usage, we can also provide a flag to prevent the prompt, like -y/--assumeyes (apt/yum style) or -f/--force (rm style) which will enforce the destructive behavior.

PS: I learned that lesson the hard way and want to prevent anyone to experience this "WTF?!" moment when your data is vacuumed in space.
PPS: I'm not a Rubyist but might be able to land a patch with some help and good pointers.

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

1 participant