forked from ungleich-public/cdist
record failing host and continue
Signed-off-by: Nico Schottelius <nico@brief.schottelius.org>
This commit is contained in:
parent
5001e9cbe7
commit
eef408c1b3
1 changed files with 13 additions and 13 deletions
26
bin/cdist
26
bin/cdist
|
@ -129,29 +129,29 @@ def configinstall(args, mode):
|
||||||
process[host] = multiprocessing.Process(target=configinstall_onehost, args=(host, args, mode, True))
|
process[host] = multiprocessing.Process(target=configinstall_onehost, args=(host, args, mode, True))
|
||||||
process[host].start()
|
process[host].start()
|
||||||
else:
|
else:
|
||||||
if not configinstall_onehost(host, args, mode, parallel=False):
|
try:
|
||||||
|
configinstall_onehost(host, args, mode, parallel=False)
|
||||||
|
except cdist.Error as e:
|
||||||
|
# FIXME: save the error and display at the end?
|
||||||
|
# Would be non-consistent to parallel mode
|
||||||
failed_hosts.append(host)
|
failed_hosts.append(host)
|
||||||
|
|
||||||
|
# Catch errors in parallel mode when joining
|
||||||
if args.parallel:
|
if args.parallel:
|
||||||
for p in process.keys():
|
for host in process.keys():
|
||||||
log.debug("Joining process %s", p)
|
log.debug("Joining process %s", host)
|
||||||
process[p].join()
|
process[host].join()
|
||||||
|
|
||||||
if not process[p].exitcode == 0:
|
if not process[host].exitcode == 0:
|
||||||
failed_hosts.append(p)
|
failed_hosts.append(host)
|
||||||
|
|
||||||
if len(failed_hosts) > 0:
|
|
||||||
log.warn("Failed to deploy to the following hosts: " +
|
|
||||||
" ".join(failed_hosts))
|
|
||||||
|
|
||||||
time_end = time.time()
|
time_end = time.time()
|
||||||
log.info("Total processing time for %s host(s): %s", len(args.host),
|
log.info("Total processing time for %s host(s): %s", len(args.host),
|
||||||
(time_end - time_start))
|
(time_end - time_start))
|
||||||
|
|
||||||
if len(failed_hosts) > 0:
|
if len(failed_hosts) > 0:
|
||||||
return False
|
raise cdist.Error("Failed to deploy to the following hosts: " +
|
||||||
else:
|
" ".join(failed_hosts))
|
||||||
return True
|
|
||||||
|
|
||||||
def configinstall_onehost(host, args, mode, parallel):
|
def configinstall_onehost(host, args, mode, parallel):
|
||||||
"""Configure or install ONE remote system"""
|
"""Configure or install ONE remote system"""
|
||||||
|
|
Loading…
Reference in a new issue