[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()
|
db = crans_ldap()
|
||||||
make_lock('auto_generate', 'Big lock', nowait=1)
|
make_lock('auto_generate', 'Big lock', nowait=1)
|
||||||
|
|
||||||
def trigger(host):
|
def trigger(host, background=False):
|
||||||
if not 'adm.crans.org' in host:
|
if not 'adm.crans.org' in host:
|
||||||
host=host + '.adm.crans.org'
|
host=host + '.adm.crans.org'
|
||||||
options = ['PasswordAuthentication=no', 'ConnectTimeout=1', 'VerifyHostKeyDNS=yes',
|
options = ['PasswordAuthentication=no', 'ConnectTimeout=1', 'VerifyHostKeyDNS=yes',
|
||||||
|
@ -43,11 +43,14 @@ def trigger(host):
|
||||||
args.append('-o')
|
args.append('-o')
|
||||||
args.append(opt)
|
args.append(opt)
|
||||||
args.extend(["rpcssh@%s" % host, "generate"])
|
args.extend(["rpcssh@%s" % host, "generate"])
|
||||||
p=subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
if background:
|
||||||
out, err = p.communicate()
|
subprocess.Popen(args)
|
||||||
if err:
|
else:
|
||||||
raise Exception(err)
|
p=subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
return out
|
out, err = p.communicate()
|
||||||
|
if err:
|
||||||
|
raise Exception(err)
|
||||||
|
return out
|
||||||
|
|
||||||
class base_reconfigure:
|
class base_reconfigure:
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue