1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-25 02:50:08 +03:00

F #2645: Fix some errors in ansible parse output (#2935)

This commit is contained in:
Alejandro Huertas Herrero 2019-02-13 18:35:47 +01:00 committed by Tino Vázquez
parent e04ec57f9d
commit 5d701a92fd

View File

@ -97,7 +97,9 @@ module OneProvision
Utils.fail('Hosts are already configured')
end
configure_all(hosts)
Driver.retry_loop 'Failed to configure hosts' do
configure_all(hosts)
end
end
# TODO: expect multiple hosts
@ -206,9 +208,13 @@ module OneProvision
host = Regexp.last_match(1)
begin
text = JSON.parse(Regexp.last_match(2))['msg']
.strip.tr("\n", ' ')
text = "- #{text}"
match = JSON.parse(Regexp.last_match(2))
msg = match['msg']
msg = match['reason'] if msg.nil?
text = msg.strip.tr("\n", ' ')
text = "- #{text}"
rescue StandardError => e
raise e
end
@ -216,8 +222,9 @@ module OneProvision
host = Regexp.last_match(1)
end
rtn << format('- 15%<h>s : TASK[%<t>s] %<tx>s',
:h => host, :t => task, :tx => text)
content = { :h => host, :t => task, :tx => text }
rtn << format('- %<h>s : TASK[%<t>s] %<tx>s', content)
end
rtn.join("\n")