Moved sleep in Nailgun agent

Node should not wait after checking '/var/run/nodiscover' file
when reboot is started, it should give Astute time to react
(and to create this file) and only then check it and reboot.

Change-Id: I2c6464262e100244bc525f8e8b456eb26d35e3a1
Related-Bug: #1371225
This commit is contained in:
Nikolay Markov 2015-04-03 17:18:08 +03:00
parent d8d82a1a9a
commit 6e3ca9592f
1 changed files with 5 additions and 4 deletions

View File

@ -541,6 +541,11 @@ else
logger.level = Logger::DEBUG
end
# random sleep is here to prevent target nodes
# from reporting to master node all at once
sleep_time = rand(30)
logger.debug("Sleep for #{sleep_time} seconds before sending request")
sleep(sleep_time)
if File.exist?('/var/run/nodiscover')
logger.info("Discover prevented by /var/run/nodiscover presence.")
@ -555,10 +560,6 @@ rescue Exception => e
logger.info("Could not get url from configuration file: #{e.message}, trying other ways..")
end
sleep_time = rand(30)
logger.debug("Sleep for #{sleep_time} seconds before sending request")
sleep(sleep_time)
agent = NodeAgent.new(logger, url)
agent.update_state