Skip to content

Commit

Permalink
Merge pull request #485 from s-t-e-v-e-n-k/trove-random-password
Browse files Browse the repository at this point in the history
Set the trove service password to random
  • Loading branch information
vuntz authored Aug 31, 2016
2 parents 7b8bcc5 + cdaa9ec commit 208230b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
16 changes: 16 additions & 0 deletions chef/data_bags/crowbar/migrate/trove/101_add_service_details.rb
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
3 changes: 2 additions & 1 deletion chef/data_bags/crowbar/template-trove.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"cinder_instance": "none",
"rabbitmq_instance": "none",
"volume_support": false,
"service_user": "trove",
"db": {
"password": "",
"user": "trove",
Expand All @@ -27,7 +28,7 @@
"trove": {
"crowbar-revision": 1,
"crowbar-applied": false,
"schema-revision": 100,
"schema-revision": 101,
"element_states": {
"trove-server": [ "readying", "ready", "applying" ]
},
Expand Down
2 changes: 2 additions & 0 deletions chef/data_bags/crowbar/template-trove.schema
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
"swift_instance": { "type": "str", "required": true },
"rabbitmq_instance": { "type": "str", "required": true },
"volume_support": { "type": "bool", "required": true },
"service_user": { "type": "str", "required": true },
"service_password": { "type": "str" },
"db": {
"type": "map",
"required": true,
Expand Down
1 change: 1 addition & 0 deletions crowbar_framework/app/models/trove_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def create_proposal
base["attributes"][@bc_name]["swift_instance"] = find_dep_proposal("swift", true)
base["attributes"][@bc_name]["rabbitmq_instance"] = find_dep_proposal("rabbitmq")
base["attributes"][@bc_name]["db"]["password"] = random_password
base["attributes"][@bc_name]["service_password"] = random_password

# assign a default node to the trove-server role
nodes = NodeObject.all
Expand Down

0 comments on commit 208230b

Please sign in to comment.