From 543bf41c9bba0e217d0b6c1e94aea67a2528bb5e Mon Sep 17 00:00:00 2001 From: Szilard Cserey Date: Mon, 14 Sep 2015 11:49:04 +0200 Subject: FIX for Autodeployer - Fuel installation - fix for finding fuelmenu - ugo+rwx access rights to autodeploy.log file - backward compatibility for argument parsing of ISO, DEA, DHA Change-Id: Ib4ad5b0868a25b0357cfcd9d8f644bb3a0703b25 Signed-off-by: Szilard Cserey --- fuel/deploy/cloud/configure_nodes.py | 2 +- fuel/deploy/common.py | 3 ++- fuel/deploy/deploy.py | 29 ++++++++++++++++++++--------- fuel/deploy/install_fuel_master.py | 27 ++++++++++++++++++++++----- 4 files changed, 45 insertions(+), 16 deletions(-) diff --git a/fuel/deploy/cloud/configure_nodes.py b/fuel/deploy/cloud/configure_nodes.py index 06199d2..e76d222 100644 --- a/fuel/deploy/cloud/configure_nodes.py +++ b/fuel/deploy/cloud/configure_nodes.py @@ -88,7 +88,7 @@ class ConfigureNodes(object): interface_yaml = ('%s/node_%s/interfaces.yaml' % (self.yaml_config_dir, node_id)) check_file_exists(interface_yaml) - backup(interface_yaml) + backup('%s/node_%s' % (self.yaml_config_dir, node_id)) with io.open(interface_yaml) as stream: interfaces = yaml.load(stream) diff --git a/fuel/deploy/common.py b/fuel/deploy/common.py index 3472e89..ab2bf68 100644 --- a/fuel/deploy/common.py +++ b/fuel/deploy/common.py @@ -13,6 +13,7 @@ import os import logging import argparse import shutil +import stat import errno N = {'id': 0, 'status': 1, 'name': 2, 'cluster': 3, 'ip': 4, 'mac': 5, @@ -31,7 +32,7 @@ LOG.addHandler(out_handler) out_handler = logging.FileHandler('autodeploy.log', mode='w') out_handler.setFormatter(formatter) LOG.addHandler(out_handler) - +os.chmod('autodeploy.log', stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO) def exec_cmd(cmd, check=True): process = subprocess.Popen(cmd, diff --git a/fuel/deploy/deploy.py b/fuel/deploy/deploy.py index 304db66..1acce42 100644 --- a/fuel/deploy/deploy.py +++ b/fuel/deploy/deploy.py @@ -242,15 +242,26 @@ def parse_arguments(): parser.add_argument('-c', dest='cleanup', action='store_true', default=False, help='Cleanup after deploy') - parser.add_argument('-iso', dest='iso_file', action='store', nargs='?', - default='%s/OPNFV.iso' % CWD, - help='ISO File [default: OPNFV.iso]') - parser.add_argument('-dea', dest='dea_file', action='store', nargs='?', - default='%s/dea.yaml' % CWD, - help='Deployment Environment Adapter: dea.yaml') - parser.add_argument('-dha', dest='dha_file', action='store', nargs='?', - default='%s/dha.yaml' % CWD, - help='Deployment Hardware Adapter: dha.yaml') + if {'-iso', '-dea', '-dha', '-h'}.intersection(sys.argv): + parser.add_argument('-iso', dest='iso_file', action='store', nargs='?', + default='%s/OPNFV.iso' % CWD, + help='ISO File [default: OPNFV.iso]') + parser.add_argument('-dea', dest='dea_file', action='store', nargs='?', + default='%s/dea.yaml' % CWD, + help='Deployment Environment Adapter: dea.yaml') + parser.add_argument('-dha', dest='dha_file', action='store', nargs='?', + default='%s/dha.yaml' % CWD, + help='Deployment Hardware Adapter: dha.yaml') + else: + parser.add_argument('iso_file', action='store', nargs='?', + default='%s/OPNFV.iso' % CWD, + help='ISO File [default: OPNFV.iso]') + parser.add_argument('dea_file', action='store', nargs='?', + default='%s/dea.yaml' % CWD, + help='Deployment Environment Adapter: dea.yaml') + parser.add_argument('dha_file', action='store', nargs='?', + default='%s/dha.yaml' % CWD, + help='Deployment Hardware Adapter: dha.yaml') parser.add_argument('-s', dest='storage_dir', action='store', default='%s/images' % CWD, help='Storage Directory [default: images]') diff --git a/fuel/deploy/install_fuel_master.py b/fuel/deploy/install_fuel_master.py index da313b0..9a2599c 100644 --- a/fuel/deploy/install_fuel_master.py +++ b/fuel/deploy/install_fuel_master.py @@ -125,12 +125,9 @@ class InstallFuelMaster(object): return fuel_menu_pid def get_fuel_menu_pid(self, printout, search): - fuel_menu_pid = None for line in printout.splitlines(): - if search in line: - fuel_menu_pid = clean(line)[1] - break - return fuel_menu_pid + if line.endswith(search): + return clean(line)[1] def ssh_exec_cmd(self, cmd, check=True): with self.ssh: @@ -186,3 +183,23 @@ class InstallFuelMaster(object): log('Delete deprecated fuel client config %s' % FUEL_CLIENT_CONFIG) with self.ssh as s: s.exec_cmd('rm %s' % FUEL_CLIENT_CONFIG, False) + + + + + + + + + + + + + + + + + + + + -- cgit 1.2.3-korg