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