X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=deploy%2Fcommon.py;h=787a21a1d96f750c40b25716712837147bed2f6f;hb=refs%2Fheads%2Fstable%2Fbrahmaputra;hp=ccd43d79a7dbbae430df6114ed1abd0b5e417dfd;hpb=90722b2a0de85d9b60130883b1b4f7b0e21dcffd;p=fuel.git diff --git a/deploy/common.py b/deploy/common.py index ccd43d79a..787a21a1d 100644 --- a/deploy/common.py +++ b/deploy/common.py @@ -18,9 +18,8 @@ import stat import errno N = {'id': 0, 'status': 1, 'name': 2, 'cluster': 3, 'ip': 4, 'mac': 5, - 'roles': 6, 'pending_roles': 7, 'online': 8} -E = {'id': 0, 'status': 1, 'name': 2, 'mode': 3, 'release_id': 4, - 'changes': 5, 'pending_release_id': 6} + 'roles': 6, 'pending_roles': 7, 'online': 8, 'group_id': 9} +E = {'id': 0, 'status': 1, 'name': 2, 'release_id': 3, 'pending_release_id': 4} R = {'id': 0, 'name': 1, 'state': 2, 'operating_system': 3, 'version': 4} RO = {'name': 0, 'conflicts': 1} CWD = os.getcwd() @@ -49,8 +48,13 @@ def exec_cmd(cmd, check=True): return_code = process.returncode if check: if return_code > 0: + print "Failed command: " + str(cmd) + print "Command returned response: " + str(response) + print "Command return code: " + str(return_code) raise Exception(response) else: + print "Command: " + str(cmd) + print str(response) return response return response, return_code @@ -129,8 +133,8 @@ def commafy(comma_separated_list): def check_if_root(): - r = exec_cmd('whoami') - if r != 'root': + uid = os.getuid() + if uid != 0: err('You need be root to run this application')