From c85a3cd89ce44bf1d1c63d24074d24540a752509 Mon Sep 17 00:00:00 2001 From: Vincent Untz Date: Thu, 5 Jan 2017 12:09:02 +0100 Subject: [PATCH 1/2] Call "rake crowbar:update_config_db" when updating barclamps The configuration DB may need to be updated as the code to generate it may have changed to add new items in the structure. (cherry picked from commit bdce855f0f6c4ce42cdf527521aceb89f792caf1) --- scripts/barclamp_install.rb | 1 + scripts/barclamp_mgmt_lib.rb | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/scripts/barclamp_install.rb b/scripts/barclamp_install.rb index d28bdf80e8a..08d50ecc21b 100755 --- a/scripts/barclamp_install.rb +++ b/scripts/barclamp_install.rb @@ -144,6 +144,7 @@ def usage() exit_code = -3 end end + bc_install_update_config_db barclamps, log end generate_navigation diff --git a/scripts/barclamp_mgmt_lib.rb b/scripts/barclamp_mgmt_lib.rb index 2213fd70b7a..026ef6f2021 100755 --- a/scripts/barclamp_mgmt_lib.rb +++ b/scripts/barclamp_mgmt_lib.rb @@ -505,6 +505,18 @@ def check_schema_migration(bc) return old_schema_revision != new_schema_revision end +def bc_install_update_config_db(barclamps, log) + File.open(log, "a") do |f| + f.puts( + "======== Updating configuration DB for #{barclamps.join(", ")} -- " \ + "#{Time.now.strftime("%c")} ========" + ) + end + unless run_rake_task("crowbar:update_config_db[#{barclamps.join(" ")}]", log) + fatal "Failed to update configuration DB for #{barclamps.join(", ")}.", log + end +end + def get_rpm_file_list(rpm) cmd = "rpm -ql #{rpm}" file_list = `#{cmd}`.lines.map { |line| line.rstrip } From 1d4965278bff27bb2959e31063b9a26fef6f462a Mon Sep 17 00:00:00 2001 From: Vincent Untz Date: Fri, 6 Jan 2017 17:46:54 +0100 Subject: [PATCH 2/2] install: Call "rake crowbar:update_config_db" on hardware-installing When admin server reaches hardware-installing, it gets allocated its admin IP address and this may trigger change in the configuration that therefore needs to be regenerated. (cherry picked from commit fcec0608f94c57434a48d92eb76f233f5270a0b7) --- scripts/install-chef-suse.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install-chef-suse.sh b/scripts/install-chef-suse.sh index 117336a9d5d..ec91eb7890b 100755 --- a/scripts/install-chef-suse.sh +++ b/scripts/install-chef-suse.sh @@ -1071,6 +1071,8 @@ do # already installed echo '{ "crowbar_wall": { "registering": true } }' | \ $chef_client --json-attributes /dev/stdin + # admin server got allocated an IP address, regenerate the config db + su -s /bin/sh - crowbar sh -c "cd /opt/dell/crowbar_framework && RAILS_ENV=production bin/rake crowbar:update_config_db" else $chef_client fi