summaryrefslogtreecommitdiffstats
path: root/fuel/deploy/install_fuel_master.py
diff options
context:
space:
mode:
authorSzilard Cserey <szilard.cserey@ericsson.com>2015-10-20 14:18:37 +0200
committerSzilard Cserey <szilard.cserey@ericsson.com>2015-10-27 16:25:32 +0100
commit143022408c26f3c6a5f5c1eaf0dce8061242675a (patch)
tree9eebf1775609553b38b1d2fcbd384bdd5a4309d7 /fuel/deploy/install_fuel_master.py
parentad790a995855219ce876880f00ad59a8ffa2b2d9 (diff)
Plugin config + bugfix + refactoring
ignoring external repo errors during plugin installation refactoring import common Install only those plugins which have a yaml config file located under plugins folder collect puppet errors from all nodes Change-Id: I8d5248cf31c4877a6d59bfcfe62b43daf4ad43ef Signed-off-by: Szilard Cserey <szilard.cserey@ericsson.com>
Diffstat (limited to 'fuel/deploy/install_fuel_master.py')
-rw-r--r--fuel/deploy/install_fuel_master.py48
1 files changed, 27 insertions, 21 deletions
diff --git a/fuel/deploy/install_fuel_master.py b/fuel/deploy/install_fuel_master.py
index 0e3c1c044..1b82483eb 100644
--- a/fuel/deploy/install_fuel_master.py
+++ b/fuel/deploy/install_fuel_master.py
@@ -7,31 +7,33 @@
# http://www.apache.org/licenses/LICENSE-2.0
###############################################################################
-
-import common
import time
import os
import glob
from ssh_client import SSHClient
from dha_adapters.libvirt_adapter import LibvirtAdapter
-log = common.log
-err = common.err
-clean = common.clean
-delete = common.delete
+from common import (
+ log,
+ err,
+ clean,
+ delete,
+)
TRANSPLANT_FUEL_SETTINGS = 'transplant_fuel_settings.py'
BOOTSTRAP_ADMIN = '/usr/local/sbin/bootstrap_admin_node'
FUEL_CLIENT_CONFIG = '/etc/fuel/client/config.yaml'
PLUGINS_DIR = '~/plugins'
LOCAL_PLUGIN_FOLDER = '/opt/opnfv'
+IGNORABLE_FUEL_ERRORS = ['does not update installed package',
+ 'Couldn\'t resolve host']
class InstallFuelMaster(object):
def __init__(self, dea_file, dha_file, fuel_ip, fuel_username,
fuel_password, fuel_node_id, iso_file, work_dir,
- fuel_plugins_dir):
+ fuel_plugins_dir, no_plugins):
self.dea_file = dea_file
self.dha = LibvirtAdapter(dha_file)
self.fuel_ip = fuel_ip
@@ -42,6 +44,7 @@ class InstallFuelMaster(object):
self.iso_dir = os.path.dirname(self.iso_file)
self.work_dir = work_dir
self.fuel_plugins_dir = fuel_plugins_dir
+ self.no_plugins = no_plugins
self.file_dir = os.path.dirname(os.path.realpath(__file__))
self.ssh = SSHClient(self.fuel_ip, self.fuel_username,
self.fuel_password)
@@ -90,11 +93,13 @@ class InstallFuelMaster(object):
log('Waiting for one minute for Fuel to stabilize')
time.sleep(60)
- self.delete_deprecated_fuel_client_config_from_fuel_6_1()
+ self.delete_deprecated_fuel_client_config()
+
+ if not self.no_plugins:
- self.collect_plugin_files()
+ self.collect_plugin_files()
- self.install_plugins()
+ self.install_plugins()
self.post_install_cleanup()
@@ -106,18 +111,21 @@ class InstallFuelMaster(object):
if self.fuel_plugins_dir:
for f in glob.glob('%s/*.rpm' % self.fuel_plugins_dir):
s.scp_put(f, PLUGINS_DIR)
- else:
- s.exec_cmd('cp %s/*.rpm %s' % (LOCAL_PLUGIN_FOLDER,
- PLUGINS_DIR))
def install_plugins(self):
log('Installing Fuel Plugins')
+ plugin_files = []
with self.ssh as s:
- r = s.exec_cmd('find %s -type f -name \'*.rpm\'' % PLUGINS_DIR)
- for f in r.splitlines():
+ for plugin_location in [PLUGINS_DIR, LOCAL_PLUGIN_FOLDER]:
+ r = s.exec_cmd('find %s -type f -name \'*.rpm\''
+ % plugin_location)
+ plugin_files.extend(r.splitlines())
+ for f in plugin_files:
log('Found plugin %s, installing ...' % f)
r, e = s.exec_cmd('fuel plugins --install %s' % f, False)
- if e and 'does not update installed package' not in r:
+ printout = r + e if e else r
+ if e and all([err not in printout
+ for err in IGNORABLE_FUEL_ERRORS]):
raise Exception('Installation of Fuel Plugin %s '
'failed: %s' % (f, e))
@@ -130,7 +138,7 @@ class InstallFuelMaster(object):
self.ssh.open()
success = True
break
- except Exception as e:
+ except Exception:
log('Trying to SSH into Fuel VM %s ... sleeping %s seconds'
% (self.fuel_ip, SLEEP_TIME))
time.sleep(SLEEP_TIME)
@@ -206,13 +214,11 @@ class InstallFuelMaster(object):
log('Remove ISO directory %s' % self.iso_dir)
delete(self.iso_dir)
- def delete_deprecated_fuel_client_config_from_fuel_6_1(self):
+ def delete_deprecated_fuel_client_config(self):
with self.ssh as s:
response, error = s.exec_cmd('fuel -v', False)
if (error and
- 'DEPRECATION WARNING' in error and
- '6.1.0' in error and
- FUEL_CLIENT_CONFIG in error):
+ 'DEPRECATION WARNING' in error and FUEL_CLIENT_CONFIG in error):
log('Delete deprecated fuel client config %s' % FUEL_CLIENT_CONFIG)
with self.ssh as s:
s.exec_cmd('rm %s' % FUEL_CLIENT_CONFIG, False)