[gen_confs/generate] possibilité de lancer trigger en arrière plan
This commit is contained in:
parent
f58ef89ffc
commit
7026643353
1 changed files with 9 additions and 6 deletions
|
@ -33,7 +33,7 @@ signal.signal(signal.SIGINT, signal.SIG_IGN) # Pas de Ctrl-C
|
|||
db = crans_ldap()
|
||||
make_lock('auto_generate', 'Big lock', nowait=1)
|
||||
|
||||
def trigger(host):
|
||||
def trigger(host, background=False):
|
||||
if not 'adm.crans.org' in host:
|
||||
host=host + '.adm.crans.org'
|
||||
options = ['PasswordAuthentication=no', 'ConnectTimeout=1', 'VerifyHostKeyDNS=yes',
|
||||
|
@ -43,11 +43,14 @@ def trigger(host):
|
|||
args.append('-o')
|
||||
args.append(opt)
|
||||
args.extend(["rpcssh@%s" % host, "generate"])
|
||||
p=subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
out, err = p.communicate()
|
||||
if err:
|
||||
raise Exception(err)
|
||||
return out
|
||||
if background:
|
||||
subprocess.Popen(args)
|
||||
else:
|
||||
p=subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
out, err = p.communicate()
|
||||
if err:
|
||||
raise Exception(err)
|
||||
return out
|
||||
|
||||
class base_reconfigure:
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue