summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-05-10 18:12:31 +0000
committerGerrit Code Review <review@openstack.org>2016-05-10 18:12:31 +0000
commitea7350a64955e45d467949ba0c29b771f7d908b6 (patch)
tree41c9ddc95c94ba4232ecd9c305727a5f47e9865e
parentd1d17f253c8c837da10cc50239dca5e2ac9af095 (diff)
parent50bcd8448ecab85194b4559569ebc8568191e481 (diff)
Merge "Do restart mcollective after provisioning"
-rwxr-xr-xagent9
1 files changed, 8 insertions, 1 deletions
diff --git a/agent b/agent
index 38e9902..a227303 100755
--- a/agent
+++ b/agent
@@ -32,6 +32,7 @@ require 'uri'
32# TODO(vsharshov): replace below lines by this string after excluding Ruby 1.8 32# TODO(vsharshov): replace below lines by this string after excluding Ruby 1.8
33require 'pathname' 33require 'pathname'
34require 'rexml/document' 34require 'rexml/document'
35require 'socket'
35include REXML 36include REXML
36 37
37unless Process.euid == 0 38unless Process.euid == 0
@@ -1057,6 +1058,10 @@ def write_data_to_file(logger, filename, data)
1057 end 1058 end
1058end 1059end
1059 1060
1061def provisioned?
1062 Socket.gethostname != 'bootstrap'
1063end
1064
1060logger = Logger.new(STDOUT) 1065logger = Logger.new(STDOUT)
1061 1066
1062if File.exist?('/etc/nailgun_uid') 1067if File.exist?('/etc/nailgun_uid')
@@ -1100,7 +1105,9 @@ begin
1100 end 1105 end
1101 new_id = JSON.parse(resp.body)['id'] 1106 new_id = JSON.parse(resp.body)['id']
1102 mc_config = McollectiveConfig.new(logger) 1107 mc_config = McollectiveConfig.new(logger)
1103 mc_config.replace_identity(new_id) 1108 unless provisioned?
1109 mc_config.replace_identity(new_id)
1110 end
1104 write_data_to_file(logger, '/etc/nailgun_uid', new_id.to_s) 1111 write_data_to_file(logger, '/etc/nailgun_uid', new_id.to_s)
1105rescue => ex 1112rescue => ex
1106 # NOTE(mihgen): There is no need to retry - cron will do it for us 1113 # NOTE(mihgen): There is no need to retry - cron will do it for us