X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=fuel%2Fdeploy%2Fcommon.py;h=2a8c0d149d0b07c5cec1668e9c394be690e1cbbb;hb=563547b4a9f44090f32c0e17d040114854563760;hp=ab2bf68cc41e31759c505bcba3e0ca09b4a57625;hpb=a9373056094ee6c31e5468daeea2b126aa4e58ea;p=genesis.git diff --git a/fuel/deploy/common.py b/fuel/deploy/common.py index ab2bf68..2a8c0d1 100644 --- a/fuel/deploy/common.py +++ b/fuel/deploy/common.py @@ -22,7 +22,7 @@ E = {'id': 0, 'status': 1, 'name': 2, 'mode': 3, 'release_id': 4, 'changes': 5, 'pending_release_id': 6} R = {'id': 0, 'name': 1, 'state': 2, 'operating_system': 3, 'version': 4} RO = {'name': 0, 'conflicts': 1} - +CWD = os.getcwd() LOG = logging.getLogger(__name__) LOG.setLevel(logging.DEBUG) formatter = logging.Formatter('%(message)s') @@ -89,11 +89,15 @@ def warn(message): def check_file_exists(file_path): + if not os.path.dirname(file_path): + file_path = '%s/%s' % (CWD, file_path) if not os.path.isfile(file_path): err('ERROR: File %s not found\n' % file_path) def check_dir_exists(dir_path): + if not os.path.dirname(dir_path): + dir_path = '%s/%s' % (CWD, dir_path) if not os.path.isdir(dir_path): err('ERROR: Directory %s not found\n' % dir_path) @@ -107,7 +111,7 @@ def create_dir_if_not_exists(dir_path): def delete(f): if os.path.isfile(f): log('Deleting file %s' % f) - os.remove(file) + os.remove(f) elif os.path.isdir(f): log('Deleting directory %s' % f) shutil.rmtree(f) @@ -136,14 +140,6 @@ class ArgParser(argparse.ArgumentParser): sys.exit(2) -class literal_unicode(unicode): - pass - - -def literal_unicode_representer(dumper, data): - return dumper.represent_scalar(u'tag:yaml.org,2002:str', data, style='|') - - def backup(path): src = path dst = path + '_orig'