Moved nodiscover to /etc/nailgun-agent

We create /etc/nailgun-agent/nodiscover during
provisioning and then this file is assumed to be
removed in /etc/rc.local which guarantees
that nailgun-agent doesn't change mcollective config at the
same time when cloud-init does this. Otherwise, we can
end up with corrupted mcollective config.

Former location of this file /var/run/nodiscover assumes
it is removed at the beginning of the boot process while
we need it to be in place at least until cloud-init
has finished its magic. For details see
http://www.pathname.com/fhs/pub/fhs-2.3.html#VARRUNRUNTIMEVARIABLEDATA

Related-Patch: If8d1252e6d351ad073de26afc13a19de76f531fb
Change-Id: I5fca4ca39abdc273f6958f2643fae6c5c99fba68
Related-Bug: #1449186
This commit is contained in:
Vladimir Kozhukalov 2015-05-19 11:36:43 +03:00
parent 96801c5bcc
commit 961359f387
3 changed files with 5 additions and 2 deletions

View File

@ -93,6 +93,7 @@ module Astute
# 0.1667 / 180 = 30 sec. Delay between reboot command for first
# and last node in group should be 30 sec. Empirical observation.
# Please increase if nodes could not provisioning
conf[:agent_nodiscover_file] = '/etc/nailgun-agent/nodiscover' # if this file in place, nailgun-agent will do nothing
# Server settings
conf[:broker_host] = 'localhost'

View File

@ -388,7 +388,7 @@ module Astute
nodes_uids,
check_result=false,
timeout=2)
mco_result = shell.execute(:cmd => 'rm -f /var/run/nodiscover')
mco_result = shell.execute(:cmd => "rm -f #{Astute.config.agent_nodiscover_file}")
result = mco_result.map do |n|
{
'uid' => n.results[:sender],

View File

@ -26,6 +26,8 @@ module MCollective
# https://github.com/stackforge/fuel-web/blob/master/bin/agent#L43
STORAGE_CODES = [3, 8, 65, 66, 67, 68, 69, 70, 71, 104, 105, 106, 107, 108, 109, 110, 111, 202, 252, 253, 259]
AGENT_NODISCOVER_FILE = '/etc/nailgun-agent/nodiscover'
action "erase_node" do
erase_node
end
@ -164,7 +166,7 @@ module MCollective
# Prevent discover by agent while node rebooting
def prevent_discover
lock_path = '/var/run/nodiscover'
lock_path = AGENT_NODISCOVER_FILE
debug_msg("Create file for discovery preventing #{lock_path}")
FileUtils.touch(lock_path)
end