also report failed hosts in sequential mode, terminate processes on interrupt, continue deploy even if one or more hosts failed
Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
parent
e8a81551f8
commit
84e102eb29
1 changed files with 9 additions and 10 deletions
19
bin/cdist
19
bin/cdist
|
@ -128,7 +128,8 @@ def configinstall(args, mode):
|
||||||
process[host] = multiprocessing.Process(target=configinstall_onehost, args=(host, args, mode))
|
process[host] = multiprocessing.Process(target=configinstall_onehost, args=(host, args, mode))
|
||||||
process[host].start()
|
process[host].start()
|
||||||
else:
|
else:
|
||||||
configinstall_onehost(host, args, mode)
|
if not configinstall_onehost(host, args, mode):
|
||||||
|
failed_hosts.append(host)
|
||||||
|
|
||||||
if args.parallel:
|
if args.parallel:
|
||||||
for p in process.keys():
|
for p in process.keys():
|
||||||
|
@ -147,20 +148,16 @@ def configinstall(args, mode):
|
||||||
(time_end - time_start))
|
(time_end - time_start))
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("handling in config")
|
|
||||||
if args.parallel:
|
if args.parallel:
|
||||||
for p in process.keys():
|
for p in process.keys():
|
||||||
log.debug("Terminating process %s", p)
|
log.warn("Terminating deploy " + p + "(" + p.pid + ")")
|
||||||
# FIXME: check whether alive or just terminate?
|
|
||||||
process[p].terminate()
|
process[p].terminate()
|
||||||
|
|
||||||
# FIXME: catch children if in parallel mode
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
def configinstall_onehost(host, args, mode):
|
def configinstall_onehost(host, args, mode):
|
||||||
"""Configure or install remote system"""
|
"""Configure or install ONE remote system"""
|
||||||
process = {}
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import cdist.context
|
import cdist.context
|
||||||
|
@ -178,7 +175,9 @@ def configinstall_onehost(host, args, mode):
|
||||||
|
|
||||||
except cdist.Error as e:
|
except cdist.Error as e:
|
||||||
log.error(e)
|
log.error(e)
|
||||||
sys.exit(1)
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def emulator():
|
def emulator():
|
||||||
"""Prepare and run emulator"""
|
"""Prepare and run emulator"""
|
||||||
|
@ -201,6 +200,6 @@ if __name__ == "__main__":
|
||||||
commandline()
|
commandline()
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
# FIXME: catch children if in parallel mode
|
sys.exit(0)
|
||||||
print("handling in main")
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
Loading…
Reference in a new issue