Merge 'Add back nova-manage vm list for releases prior to 7.0, fix unicode issues'

+ Add back nova-manage vm list for releases prior to 7.0
+ fix unicode issues
This commit is contained in:
Dmitry 2016-05-24 12:29:50 -07:00
commit a5dfa84ca3
5 changed files with 33 additions and 14 deletions

31
rq.yaml
View File

@ -13,25 +13,38 @@ filelists:
ubuntu: [etc-apt]
scripts:
by_release:
'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':
by_roles:
controller: [nova-manage-vm-list]
'5.0.1':
by_roles:
fuel: [fuel-docker-ps, fuel-dockerctl-check, fuel-docker-db-archive]
'6.0':
controller: [nova-manage-vm-list]
'5.1':
by_roles:
compute: [ipset-save, ipset-list]
controller: [ipset-save, ipset-list]
'6.1':
by_roles:
fuel: [fuel-notifications]
'7.0':
by_roles:
fuel: [fuel-notifications]
controller: [nova-manage-vm-list]
'5.1.1':
by_roles:
fuel: [fuel-dockerctl-list, fuel-docker-ps, fuel-dockerctl-check, fuel-docker-db-archive]
controller: [nova-manage-vm-list]
'6.0':
by_roles:
compute: [ipset-save, ipset-list]
controller: [ipset-save, ipset-list, nova-manage-vm-list]
'6.1':
by_roles:
fuel: [fuel-notifications]
controller: [nova-manage-vm-list]
'7.0':
by_roles:
fuel: [fuel-notifications]
'8.0':
by_roles:
fuel: [fuel-notifications]

View File

@ -0,0 +1 @@
nova-manage vm list 2> /dev/null | column -t

View File

@ -9,7 +9,7 @@ rqfiles = [(os.path.join(dtm, root), [os.path.join(root, f) for f in files])
rqfiles.append((os.path.join(dtm, 'configs'), ['config.yaml', 'rq.yaml']))
setup(name='timmy',
version='1.1',
version='1.1.1',
author="Aleksandr Dobdin",
author_email='dobdin@gmail.com',
license='Apache2',

View File

@ -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

View File

@ -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: