Skip to content

Commit

Permalink
Use role recipe for magnum-server & little cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
mmnelemane committed Jun 20, 2016
1 parent 20d4e25 commit 7b02976
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 11 deletions.
21 changes: 21 additions & 0 deletions chef/cookbooks/magnum/recipes/role_magnum_server.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# Copyright 2016, SUSE LINUX GmbH
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

include_recipe "magnum::setup"
include_recipe "magnum::common"
include_recipe "magnum::sql"
include_recipe "magnum::api"
include_recipe "magnum::conductor"
7 changes: 4 additions & 3 deletions chef/cookbooks/magnum/recipes/sql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@

crowbar_pacemaker_sync_mark "wait-magnum_database"

is_cluster_founder = CrowbarPacemakerHelper.is_cluster_founder?(node)
# Create the Magnum Database
database "create #{node[:magnum][:db][:database]} database" do
connection db_settings[:connection]
database_name node[:magnum][:db][:database]
provider db_settings[:provider]
action :create
only_if { !ha_enabled || CrowbarPacemakerHelper.is_cluster_founder?(node) }
only_if { !ha_enabled || is_cluster_founder }
end

database_user "create magnum database user" do
Expand All @@ -42,7 +43,7 @@
password node[:magnum][:db][:password]
provider db_settings[:user_provider]
action :create
only_if { !ha_enabled || CrowbarPacemakerHelper.is_cluster_founder?(node) }
only_if { !ha_enabled || is_cluster_founder }
end

database_user "grant database access for magnum database user" do
Expand All @@ -54,7 +55,7 @@
privileges db_settings[:privs]
provider db_settings[:user_provider]
action :grant
only_if { !ha_enabled || CrowbarPacemakerHelper.is_cluster_founder?(node) }
only_if { !ha_enabled || is_cluster_founder }
end

is_cluster_founder = CrowbarPacemakerHelper.is_cluster_founder?(node)
Expand Down
8 changes: 1 addition & 7 deletions chef/roles/magnum-server.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
name "magnum-server"
description "Magnum Role - Node registered as a Magnum server"
run_list(
"recipe[magnum::setup]",
"recipe[magnum::common]",
"recipe[magnum::sql]",
"recipe[magnum::api]",
"recipe[magnum::conductor]"
)
run_list("recipe[magnum::role_magnum_server]")
default_attributes
override_attributes
2 changes: 1 addition & 1 deletion magnum.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
barclamp:
name: 'magnum'
display: 'Magnum'
description: 'OpenStack Containers as a Service provisioning'
description: 'OpenStack Containers: Container Infrastructure Management Service'
version: 0
user_managed: true
requires:
Expand Down

0 comments on commit 7b02976

Please sign in to comment.