aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>2017-01-23 23:39:34 +0100
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>2017-01-23 23:46:33 +0100
commit759e7ec5f81cd312078f10c1d8a76ffcc9cef57b (patch)
treecb1bcff1501cc7f2f6aa13ebadb50a89c5469369
parent39019e8a11b727c9ffcc4d7eaeedf6318e8542f8 (diff)
deploy-cache: refresh authorized_keys from id_rsa
When bootstrap cache is present, the cached id_rsa keypair is copied to Fuel Master node after the initial packages are installed (cobbler pp copies id_rsa.pub as /etc/cobbler/authorized_keys). This leaves behind out-of-sync cobbler configuration, generated from the fresh id_rsa.pub instead of the cached one. While at it, also fix Fuel Master authorized_keys from ~/.ssh, which is transferred via /etc/nailgun/settings.yaml to deployed nodes, leading to nodes rejecting subsequent key-based ssh logins. JIRA: ARMBAND-188 JIRA: ARMBAND-190 Change-Id: I58b45c9522b16c7d05dafcd1acaff4b8cc30013e Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
-rw-r--r--patches/opnfv-fuel/upstream-backports/0005-CI-deploy-cache-Store-and-reuse-deploy-artifacts.patch69
1 files changed, 36 insertions, 33 deletions
diff --git a/patches/opnfv-fuel/upstream-backports/0005-CI-deploy-cache-Store-and-reuse-deploy-artifacts.patch b/patches/opnfv-fuel/upstream-backports/0005-CI-deploy-cache-Store-and-reuse-deploy-artifacts.patch
index 48fd31db..5e02ee42 100644
--- a/patches/opnfv-fuel/upstream-backports/0005-CI-deploy-cache-Store-and-reuse-deploy-artifacts.patch
+++ b/patches/opnfv-fuel/upstream-backports/0005-CI-deploy-cache-Store-and-reuse-deploy-artifacts.patch
@@ -22,23 +22,23 @@ JIRA: ARMBAND-172
Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
---
- ...p_admin_node.sh-deploy_cache-install-hook.patch | 69 +++++
+ ...p_admin_node.sh-deploy_cache-install-hook.patch | 71 +++++
ci/deploy.sh | 14 +-
deploy/cloud/deployment.py | 12 +
deploy/deploy.py | 25 +-
deploy/deploy_cache.py | 321 +++++++++++++++++++++
deploy/deploy_env.py | 13 +-
deploy/install_fuel_master.py | 9 +-
- 7 files changed, 454 insertions(+), 9 deletions(-)
+ 7 files changed, 456 insertions(+), 9 deletions(-)
create mode 100644 build/f_repos/patch/fuel-main/0006-bootstrap_admin_node.sh-deploy_cache-install-hook.patch
create mode 100644 deploy/deploy_cache.py
diff --git a/build/f_repos/patch/fuel-main/0006-bootstrap_admin_node.sh-deploy_cache-install-hook.patch b/build/f_repos/patch/fuel-main/0006-bootstrap_admin_node.sh-deploy_cache-install-hook.patch
new file mode 100644
-index 0000000..80cd0f4
+index 0000000..6c1f602
--- /dev/null
+++ b/build/f_repos/patch/fuel-main/0006-bootstrap_admin_node.sh-deploy_cache-install-hook.patch
-@@ -0,0 +1,69 @@
+@@ -0,0 +1,71 @@
+From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
+Date: Mon, 28 Nov 2016 14:27:48 +0100
+Subject: [PATCH] bootstrap_admin_node.sh: deploy_cache install hook
@@ -79,7 +79,7 @@ index 0000000..80cd0f4
+ # Update issues messages
+ update_warn_message="There is an issue connecting to update repository of \
+ your distributions of OpenStack. \
-+@@ -500,12 +503,27 @@ set_ui_bootstrap_error () {
++@@ -500,12 +503,29 @@ set_ui_bootstrap_error () {
+ EOF
+ }
+
@@ -88,10 +88,12 @@ index 0000000..80cd0f4
++ -f "${OPNFV_CACHE_PATH}/id_rsa.pub" -a \
++ -f "${OPNFV_CACHE_PATH}/id_rsa" ]; then
++ if cp "${OPNFV_CACHE_PATH}/id_rsa"* "/root/.ssh/" && \
+++ cp "/root/.ssh/id_rsa.pub" "/root/.ssh/authorized_keys" && \
+++ cp "/root/.ssh/id_rsa.pub" "/etc/cobbler/authorized_keys" && \
++ fuel-bootstrap -v --debug import --activate \
++ "${OPNFV_CACHE_PATH}/${OPNFV_CACHE_TAR}" >>"$bs_build_log" 2>&1; then
-++ fuel notify --topic "done" --send "${bs_cache_message}"
-++ return 0
+++ fuel notify --topic "done" --send "${bs_cache_message}"
+++ return 0
++ fi
++ fi
++ return 1
@@ -176,10 +178,11 @@ index 081806c..4b1ae0e 100755
popd > /dev/null
diff --git a/deploy/cloud/deployment.py b/deploy/cloud/deployment.py
-index 5dd0263..3db4c0d 100644
+index 28bcfdf..b0bfdcc 100644
--- a/deploy/cloud/deployment.py
+++ b/deploy/cloud/deployment.py
-@@ -24,5 +24,7 @@ from common import (
+@@ -19,6 +19,8 @@ from common import (
+ log,
)
+from deploy_cache import DeployCache
@@ -187,7 +190,7 @@ index 5dd0263..3db4c0d 100644
SEARCH_TEXT = '(err)'
LOG_FILE = '/var/log/puppet.log'
GREP_LINES_OF_LEADING_CONTEXT = 100
-@@ -52,6 +54,14 @@ class Deployment(object):
+@@ -47,6 +49,14 @@ class Deployment(object):
self.pattern = re.compile(
'\d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\d')
@@ -202,7 +205,7 @@ index 5dd0263..3db4c0d 100644
def collect_error_logs(self):
for node_id, roles_blade in self.node_id_roles_dict.iteritems():
log_list = []
-@@ -113,6 +123,7 @@ class Deployment(object):
+@@ -108,6 +118,7 @@ class Deployment(object):
start = time.time()
log('Starting deployment of environment %s' % self.env_id)
@@ -210,7 +213,7 @@ index 5dd0263..3db4c0d 100644
deploy_id = None
ready = False
timeout = False
-@@ -145,6 +156,7 @@ class Deployment(object):
+@@ -140,6 +151,7 @@ class Deployment(object):
err('Deployment timed out, environment %s is not operational, '
'snapshot will not be performed'
% self.env_id)
@@ -219,10 +222,10 @@ index 5dd0263..3db4c0d 100644
log('Environment %s successfully deployed'
% self.env_id)
diff --git a/deploy/deploy.py b/deploy/deploy.py
-index 08702d2..1a55361 100755
+index 7648baf..ee3cb7a 100755
--- a/deploy/deploy.py
+++ b/deploy/deploy.py
-@@ -23,6 +23,7 @@ from dea import DeploymentEnvironmentAdapter
+@@ -22,6 +22,7 @@ from dea import DeploymentEnvironmentAdapter
from dha import DeploymentHardwareAdapter
from install_fuel_master import InstallFuelMaster
from deploy_env import CloudDeploy
@@ -230,7 +233,7 @@ index 08702d2..1a55361 100755
from execution_environment import ExecutionEnvironment
from common import (
-@@ -62,7 +63,8 @@ class AutoDeploy(object):
+@@ -61,7 +62,8 @@ class AutoDeploy(object):
def __init__(self, no_fuel, fuel_only, no_health_check, cleanup_only,
cleanup, storage_dir, pxe_bridge, iso_file, dea_file,
dha_file, fuel_plugins_dir, fuel_plugins_conf_dir,
@@ -240,7 +243,7 @@ index 08702d2..1a55361 100755
self.no_fuel = no_fuel
self.fuel_only = fuel_only
self.no_health_check = no_health_check
-@@ -76,6 +78,7 @@ class AutoDeploy(object):
+@@ -75,6 +77,7 @@ class AutoDeploy(object):
self.fuel_plugins_dir = fuel_plugins_dir
self.fuel_plugins_conf_dir = fuel_plugins_conf_dir
self.no_plugins = no_plugins
@@ -248,7 +251,7 @@ index 08702d2..1a55361 100755
self.deploy_timeout = deploy_timeout
self.no_deploy_environment = no_deploy_environment
self.deploy_log = deploy_log
-@@ -117,7 +120,7 @@ class AutoDeploy(object):
+@@ -116,7 +119,7 @@ class AutoDeploy(object):
self.fuel_username, self.fuel_password,
self.dea_file, self.fuel_plugins_conf_dir,
WORK_DIR, self.no_health_check,
@@ -257,7 +260,7 @@ index 08702d2..1a55361 100755
self.no_deploy_environment, self.deploy_log)
with old_dep.ssh:
old_dep.check_previous_installation()
-@@ -129,6 +132,7 @@ class AutoDeploy(object):
+@@ -128,6 +131,7 @@ class AutoDeploy(object):
self.fuel_conf['ip'], self.fuel_username,
self.fuel_password, self.fuel_node_id,
self.iso_file, WORK_DIR,
@@ -265,7 +268,7 @@ index 08702d2..1a55361 100755
self.fuel_plugins_dir, self.no_plugins)
fuel.install()
-@@ -137,6 +141,7 @@ class AutoDeploy(object):
+@@ -136,6 +140,7 @@ class AutoDeploy(object):
tmp_new_dir = '%s/newiso' % self.tmp_dir
try:
self.copy(tmp_orig_dir, tmp_new_dir)
@@ -273,7 +276,7 @@ index 08702d2..1a55361 100755
self.patch(tmp_new_dir, new_iso)
except Exception as e:
exec_cmd('fusermount -u %s' % tmp_orig_dir, False)
-@@ -157,6 +162,12 @@ class AutoDeploy(object):
+@@ -156,6 +161,12 @@ class AutoDeploy(object):
delete(tmp_orig_dir)
exec_cmd('chmod -R 755 %s' % tmp_new_dir)
@@ -286,7 +289,7 @@ index 08702d2..1a55361 100755
def patch(self, tmp_new_dir, new_iso):
log('Patching...')
patch_dir = '%s/%s' % (CWD, PATCH_DIR)
-@@ -219,7 +230,8 @@ class AutoDeploy(object):
+@@ -218,7 +229,8 @@ class AutoDeploy(object):
dep = CloudDeploy(self.dea, self.dha, self.fuel_conf['ip'],
self.fuel_username, self.fuel_password,
self.dea_file, self.fuel_plugins_conf_dir,
@@ -296,7 +299,7 @@ index 08702d2..1a55361 100755
self.no_deploy_environment, self.deploy_log)
return dep.deploy()
-@@ -344,6 +356,8 @@ def parse_arguments():
+@@ -343,6 +355,8 @@ def parse_arguments():
help='Fuel Plugins Configuration directory')
parser.add_argument('-np', dest='no_plugins', action='store_true',
default=False, help='Do not install Fuel Plugins')
@@ -305,7 +308,7 @@ index 08702d2..1a55361 100755
parser.add_argument('-dt', dest='deploy_timeout', action='store',
default=240, help='Deployment timeout (in minutes) '
'[default: 240]')
-@@ -377,6 +391,10 @@ def parse_arguments():
+@@ -376,6 +390,10 @@ def parse_arguments():
for bridge in args.pxe_bridge:
check_bridge(bridge, args.dha_file)
@@ -316,7 +319,7 @@ index 08702d2..1a55361 100755
kwargs = {'no_fuel': args.no_fuel, 'fuel_only': args.fuel_only,
'no_health_check': args.no_health_check,
-@@ -387,6 +405,7 @@ def parse_arguments():
+@@ -386,6 +404,7 @@ def parse_arguments():
'fuel_plugins_dir': args.fuel_plugins_dir,
'fuel_plugins_conf_dir': args.fuel_plugins_conf_dir,
'no_plugins': args.no_plugins,
@@ -652,7 +655,7 @@ index 0000000..76fb1b9
+ log('Failed to install targetimages for env %s: %s' %
+ (str(env_id), str(ex)))
diff --git a/deploy/deploy_env.py b/deploy/deploy_env.py
-index 1d2dfeb..2375f51 100644
+index aa8c4cb..e9c50bb 100644
--- a/deploy/deploy_env.py
+++ b/deploy/deploy_env.py
@@ -15,6 +15,7 @@ import glob
@@ -663,7 +666,7 @@ index 1d2dfeb..2375f51 100644
from ssh_client import SSHClient
from common import (
-@@ -36,7 +37,8 @@ class CloudDeploy(object):
+@@ -35,7 +36,8 @@ class CloudDeploy(object):
def __init__(self, dea, dha, fuel_ip, fuel_username, fuel_password,
dea_file, fuel_plugins_conf_dir, work_dir, no_health_check,
@@ -673,7 +676,7 @@ index 1d2dfeb..2375f51 100644
self.dea = dea
self.dha = dha
self.fuel_ip = fuel_ip
-@@ -50,6 +52,8 @@ class CloudDeploy(object):
+@@ -49,6 +51,8 @@ class CloudDeploy(object):
self.fuel_plugins_conf_dir = fuel_plugins_conf_dir
self.work_dir = work_dir
self.no_health_check = no_health_check
@@ -682,7 +685,7 @@ index 1d2dfeb..2375f51 100644
self.deploy_timeout = deploy_timeout
self.no_deploy_environment = no_deploy_environment
self.deploy_log = deploy_log
-@@ -83,9 +87,14 @@ class CloudDeploy(object):
+@@ -82,9 +86,14 @@ class CloudDeploy(object):
self.work_dir, os.path.basename(self.dea_file)))
s.scp_put('%s/common.py' % self.file_dir, self.work_dir)
s.scp_put('%s/dea.py' % self.file_dir, self.work_dir)
@@ -697,7 +700,7 @@ index 1d2dfeb..2375f51 100644
def power_off_nodes(self):
for node_id in self.node_ids:
self.dha.node_power_off(node_id)
-@@ -284,4 +293,6 @@ class CloudDeploy(object):
+@@ -283,4 +292,6 @@ class CloudDeploy(object):
self.get_put_deploy_log()
@@ -705,7 +708,7 @@ index 1d2dfeb..2375f51 100644
+
return rc
diff --git a/deploy/install_fuel_master.py b/deploy/install_fuel_master.py
-index ccc18d3..2615818 100644
+index b731c6b..83d31fb 100644
--- a/deploy/install_fuel_master.py
+++ b/deploy/install_fuel_master.py
@@ -10,6 +10,7 @@
@@ -716,7 +719,7 @@ index ccc18d3..2615818 100644
from ssh_client import SSHClient
from dha_adapters.libvirt_adapter import LibvirtAdapter
-@@ -33,7 +34,7 @@ class InstallFuelMaster(object):
+@@ -32,7 +33,7 @@ class InstallFuelMaster(object):
def __init__(self, dea_file, dha_file, fuel_ip, fuel_username,
fuel_password, fuel_node_id, iso_file, work_dir,
@@ -725,7 +728,7 @@ index ccc18d3..2615818 100644
self.dea_file = dea_file
self.dha = LibvirtAdapter(dha_file)
self.fuel_ip = fuel_ip
-@@ -43,6 +44,8 @@ class InstallFuelMaster(object):
+@@ -42,6 +43,8 @@ class InstallFuelMaster(object):
self.iso_file = iso_file
self.iso_dir = os.path.dirname(self.iso_file)
self.work_dir = work_dir
@@ -734,7 +737,7 @@ index ccc18d3..2615818 100644
self.fuel_plugins_dir = fuel_plugins_dir
self.no_plugins = no_plugins
self.file_dir = os.path.dirname(os.path.realpath(__file__))
-@@ -84,6 +87,10 @@ class InstallFuelMaster(object):
+@@ -83,6 +86,10 @@ class InstallFuelMaster(object):
log('Wait until Fuel menu is up')
fuel_menu_pid = self.wait_until_fuel_menu_up()