Fix regression in previous commit, fix unicode issues
This commit is contained in:
parent
c12af6f023
commit
60b1c0f809
8
rq.yaml
8
rq.yaml
@ -13,24 +13,24 @@ filelists:
|
||||
ubuntu: [etc-apt]
|
||||
scripts:
|
||||
by_release:
|
||||
'4.1'
|
||||
'4.1':
|
||||
by_roles:
|
||||
controller: [nova-manage-vm-list]
|
||||
'4.1.1':
|
||||
by_roles:
|
||||
fuel: [fuel-postgres-dump]
|
||||
controller: [nova-manage-vm-list]
|
||||
'5.0'
|
||||
'5.0':
|
||||
by_roles:
|
||||
controller: [nova-manage-vm-list]
|
||||
'5.0.1':
|
||||
by_roles:
|
||||
fuel: [fuel-docker-ps, fuel-dockerctl-check, fuel-docker-db-archive]
|
||||
controller: [nova-manage-vm-list]
|
||||
'5.1'
|
||||
'5.1':
|
||||
by_roles:
|
||||
controller: [nova-manage-vm-list]
|
||||
'5.1.1'
|
||||
'5.1.1':
|
||||
by_roles:
|
||||
fuel: [fuel-dockerctl-list, fuel-docker-ps, fuel-dockerctl-check, fuel-docker-db-archive]
|
||||
controller: [nova-manage-vm-list]
|
||||
|
@ -184,7 +184,7 @@ class Node(object):
|
||||
self.check_code(code, 'exec_cmd', c[cmd], ok_codes)
|
||||
try:
|
||||
with open(dfile, 'w') as df:
|
||||
df.write(outs)
|
||||
df.write(outs.encode('utf-8'))
|
||||
except:
|
||||
logging.error("exec_cmd: can't write to file %s" %
|
||||
dfile)
|
||||
@ -209,7 +209,7 @@ class Node(object):
|
||||
self.check_code(code, 'exec_cmd', 'script %s' % f, ok_codes)
|
||||
try:
|
||||
with open(dfile, 'w') as df:
|
||||
df.write(outs)
|
||||
df.write(outs.encode('utf-8'))
|
||||
except:
|
||||
logging.error("exec_cmd: can't write to file %s" % dfile)
|
||||
return self
|
||||
|
@ -192,10 +192,10 @@ def mdir(directory):
|
||||
|
||||
def launch_cmd(cmd, timeout, input=None, ok_codes=None):
|
||||
def _log_msg(cmd, stderr, code, debug=False, stdin=None, stdout=None):
|
||||
message = (u'launch_cmd:\n'
|
||||
message = ('launch_cmd:\n'
|
||||
'___command: %s\n'
|
||||
'______code: %s\n'
|
||||
'____stderr: %s' % (cmd, code, stderr.decode('utf-8')))
|
||||
'____stderr: %s' % (cmd, code, stderr))
|
||||
if debug:
|
||||
message += '\n_____stdin: %s\n' % stdin
|
||||
message += '____stdout: %s' % stdout
|
||||
@ -219,6 +219,8 @@ def launch_cmd(cmd, timeout, input=None, ok_codes=None):
|
||||
timeout_killer = threading.Timer(timeout, _timeout_terminate, [p.pid])
|
||||
timeout_killer.start()
|
||||
outs, errs = p.communicate(input=input)
|
||||
outs = outs.decode('utf-8')
|
||||
errs = errs.decode('utf-8')
|
||||
errs = errs.rstrip('\n')
|
||||
except:
|
||||
try:
|
||||
@ -226,12 +228,15 @@ def launch_cmd(cmd, timeout, input=None, ok_codes=None):
|
||||
except:
|
||||
pass
|
||||
outs, errs = p.communicate()
|
||||
outs = outs.decode('utf-8')
|
||||
errs = errs.decode('utf-8')
|
||||
errs = errs.rstrip('\n')
|
||||
logging.error(_log_msg(cmd, errs, p.returncode))
|
||||
finally:
|
||||
if timeout_killer:
|
||||
timeout_killer.cancel()
|
||||
logging.info(_log_msg(cmd, errs, p.returncode))
|
||||
input = input.decode('utf-8') if input else None
|
||||
logging.debug(_log_msg(cmd, errs, p.returncode, debug=True,
|
||||
stdin=input, stdout=outs))
|
||||
if p.returncode:
|
||||
|
Loading…
Reference in New Issue
Block a user