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
This commit is contained in:
parent
4b83a7943e
commit
50bcd8448e
7
agent
7
agent
@ -32,6 +32,7 @@ require 'uri'
|
|||||||
# TODO(vsharshov): replace below lines by this string after excluding Ruby 1.8
|
# TODO(vsharshov): replace below lines by this string after excluding Ruby 1.8
|
||||||
require 'pathname'
|
require 'pathname'
|
||||||
require 'rexml/document'
|
require 'rexml/document'
|
||||||
|
require 'socket'
|
||||||
include REXML
|
include REXML
|
||||||
|
|
||||||
unless Process.euid == 0
|
unless Process.euid == 0
|
||||||
@ -1036,6 +1037,10 @@ def write_data_to_file(logger, filename, data)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def provisioned?
|
||||||
|
Socket.gethostname != 'bootstrap'
|
||||||
|
end
|
||||||
|
|
||||||
logger = Logger.new(STDOUT)
|
logger = Logger.new(STDOUT)
|
||||||
|
|
||||||
if File.exist?('/etc/nailgun_uid')
|
if File.exist?('/etc/nailgun_uid')
|
||||||
@ -1079,7 +1084,9 @@ begin
|
|||||||
end
|
end
|
||||||
new_id = JSON.parse(resp.body)['id']
|
new_id = JSON.parse(resp.body)['id']
|
||||||
mc_config = McollectiveConfig.new(logger)
|
mc_config = McollectiveConfig.new(logger)
|
||||||
|
unless provisioned?
|
||||||
mc_config.replace_identity(new_id)
|
mc_config.replace_identity(new_id)
|
||||||
|
end
|
||||||
write_data_to_file(logger, '/etc/nailgun_uid', new_id.to_s)
|
write_data_to_file(logger, '/etc/nailgun_uid', new_id.to_s)
|
||||||
rescue => ex
|
rescue => ex
|
||||||
# NOTE(mihgen): There is no need to retry - cron will do it for us
|
# NOTE(mihgen): There is no need to retry - cron will do it for us
|
||||||
|
Loading…
Reference in New Issue
Block a user