-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Allow bypass of confirmation when restoring to staging #41
Conversation
@@ -31,6 +37,24 @@ | |||
expect(backup).to have_received(:restore) | |||
end | |||
|
|||
it "passes the confirmation argument if the application's Parity configuration allows it" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [94/80]
68c9cd0
to
b83620a
Compare
@@ -31,6 +37,24 @@ | |||
expect(backup).to have_received(:restore) | |||
end | |||
|
|||
it "passes the confirmation argument if the app's Parity configuration allows it" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [86/80]
7bd4fde
to
4c090bd
Compare
@@ -106,6 +106,8 @@ Override some of the conventions: | |||
|
|||
```ruby | |||
Parity.configure do |config| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While we're touching the README - where would this configuration go? Where does Parity look for configuration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've never actually needed to override these conventions. My understanding was that you added an initializer to your application, but now that I'm looking at the code I'm not sure that's happening (and furthermore wouldn't play nicely with the Travelling Ruby packaging/isolation that was recently introduced). @croaky, where does the configuration get set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this used to work in an initializer if you included parity in your Gemfile and built binstubs or your app, but doesn't apply if you are just using the generic Ruby commands or the Homebrew-installed version...
4c090bd
to
82e2c06
Compare
|
||
expect(Parity::Backup).to have_received(:new). | ||
with( | ||
from: "production", | ||
to: "staging", | ||
additional_args: "--confirm myappname-staging" | ||
additional_args: "--confirm parity-staging" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put a comma after the last parameter of a multiline method call.
e2d60ff
to
d4f94ae
Compare
expect(backup).to have_received(:restore) | ||
end | ||
|
||
it "passes arguments to the restore command when used against staging" do | ||
it "passes the confirm argument when restoring to a non-production environment" do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [85/80]
7288060
to
2ac86a3
Compare
Heroku asks for confirmation with `--confirm appname` when performing potentially destructive CLI operations such as a database restore. If staging data is tracking with production or easily rebuilt using seeds, this confirmation can be annoying, particularly during the common operation of taking a snapshot of production and then immediately copying it to staging to sync staging's DB up with production's. This commit changes the behavior of non-production, non-local development environments to append the confirmation argument on database restores to overwrite the staging or other feature environment database when restored from another environment. Close thoughtbot#38.
2ac86a3
to
d633d0c
Compare
end | ||
|
||
def restore_confirmation_argument | ||
if !["production", "development"].include?(environment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious why you added development to the protected list?
Also, thoughts on extracting this array to a constant? Maybe PROTECTED_ENVIRONMENTS
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Development will never need that argument since it's not a Heroku environment, but in the current organization of this code, #restore_confirmation_argument
would never be called anyway. I'll change that.
@croaky has expressed a strong concern about overwriting production data by accident (hence why you can't restore to production), which I think is a good idea. Over a lot of time using parity I've come to the conclusion that anything outside production should be considered volatile and fair-game. An environment variable would be a great compromise if there's concern about blowing away staging data.
Merged as ad2c21a. #feature #nice #doge |
Heroku asks for confirmation with
--confirm appname
when performingpotentially destructive CLI operations such as a database restore. If
staging data is tracking with production or easily rebuilt using seeds,
this confirmation can be annoying, particularly during the common
operation of taking a snapshot of production and then immediately
copying it to staging to sync staging's DB up with production's.
This change changes the behavior of non-production, non-local
development environments to append the confirmation argument on database
restores to overwrite the staging or other feature environment database
when restored from another environment.
Close #38.