Browse Source

Merge "Do restart mcollective after provisioning"

tags/10.0.0b1
Jenkins 3 years ago
parent
commit
ea7350a649
1 changed files with 8 additions and 1 deletions
  1. 8
    1
      agent

+ 8
- 1
agent View File

@@ -32,6 +32,7 @@ require 'uri'
32 32
 # TODO(vsharshov): replace below lines by this string after excluding Ruby 1.8
33 33
 require 'pathname'
34 34
 require 'rexml/document'
35
+require 'socket'
35 36
 include REXML
36 37
 
37 38
 unless Process.euid == 0
@@ -1057,6 +1058,10 @@ def write_data_to_file(logger, filename, data)
1057 1058
   end
1058 1059
 end
1059 1060
 
1061
+def provisioned?
1062
+  Socket.gethostname != 'bootstrap'
1063
+end
1064
+
1060 1065
 logger = Logger.new(STDOUT)
1061 1066
 
1062 1067
 if File.exist?('/etc/nailgun_uid')
@@ -1100,7 +1105,9 @@ begin
1100 1105
   end
1101 1106
   new_id = JSON.parse(resp.body)['id']
1102 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 1111
   write_data_to_file(logger, '/etc/nailgun_uid', new_id.to_s)
1105 1112
 rescue => ex
1106 1113
   # NOTE(mihgen): There is no need to retry - cron will do it for us

Loading…
Cancel
Save