Do restart mcollective after provisioning
nailgun agent must not change mcollective config after provisioning
cloudinit is responsible for that.
It may happen that nailgun agent may be started by cron earlier than
it is reconfigured and started by cloudinit. This leads to the
situation when cloudinit reconfigures mcollective and issues start
which doesn't do anything since it is already started by nailgun agent.
Finally, mcollective is left started with incorrect default
configuration.
Change-Id: I0c6f3720943ad21e22899368832e451bc906b098
Closes-Bug: #1455489
(cherry picked from commit 50bcd8448e
)
This commit is contained in:
parent
f20415917c
commit
8b0ef4e707
9
agent
9
agent
|
@ -32,6 +32,7 @@ require 'uri'
|
|||
# TODO(vsharshov): replace below lines by this string after excluding Ruby 1.8
|
||||
require 'pathname'
|
||||
require 'rexml/document'
|
||||
require 'socket'
|
||||
include REXML
|
||||
|
||||
unless Process.euid == 0
|
||||
|
@ -1036,6 +1037,10 @@ def write_data_to_file(logger, filename, data)
|
|||
end
|
||||
end
|
||||
|
||||
def provisioned?
|
||||
Socket.gethostname != 'bootstrap'
|
||||
end
|
||||
|
||||
logger = Logger.new(STDOUT)
|
||||
|
||||
if File.exist?('/etc/nailgun_uid')
|
||||
|
@ -1079,7 +1084,9 @@ begin
|
|||
end
|
||||
new_id = JSON.parse(resp.body)['id']
|
||||
mc_config = McollectiveConfig.new(logger)
|
||||
mc_config.replace_identity(new_id)
|
||||
unless provisioned?
|
||||
mc_config.replace_identity(new_id)
|
||||
end
|
||||
write_data_to_file(logger, '/etc/nailgun_uid', new_id.to_s)
|
||||
rescue => ex
|
||||
# NOTE(mihgen): There is no need to retry - cron will do it for us
|
||||
|
|
Loading…
Reference in New Issue