This repository has been archived by the owner on Dec 4, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from s-t-e-v-e-n-k/backport-trove-random-password
Backport trove random password
- Loading branch information
Showing
5 changed files
with
29 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 7 additions & 5 deletions
12
chef/data_bags/crowbar/migrate/trove/001_add_configurable_db_attrs.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
def upgrade ta, td, a, d | ||
a['trove']['db'] = {} | ||
a['trove']['db']['password'] = nil | ||
a['trove']['db']['user'] = 'trove' | ||
a['trove']['db']['database'] = 'trove' | ||
unless a.key? "db" | ||
a["db"] = {} | ||
a["db"]["password"] = nil | ||
a["db"]["user"] = "trove" | ||
a["db"]["database"] = "trove" | ||
end | ||
return a, d | ||
end | ||
|
||
def downgrade ta, td, a, d | ||
a['trove'].delete 'db' | ||
a.delete 'db' | ||
return a, d | ||
end |
16 changes: 16 additions & 0 deletions
16
chef/data_bags/crowbar/migrate/trove/002_add_service_details.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
def upgrade(ta, td, a, d) | ||
# Use a class variable, since migrations are run twice. | ||
unless defined?(@@trove_service_password) | ||
service = ServiceObject.new "fake-logger" | ||
@@trove_service_password = service.random_password | ||
end | ||
a["service_user"] = ta["service_user"] | ||
a["service_password"] = @@trove_service_password | ||
return a, d | ||
end | ||
|
||
def downgrade(ta, td, a, d) | ||
a.delete("service_user") | ||
a.delete("service_password") | ||
return a, d | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters