Align the stars to unblock instack-undercloud gate on stable/mitaka

We need to squash to patches if we want to unblock stable/mitaka CI.

First patch:

Fix bashate errors and warnings (lint)

Fix 1 warning and 1 error in bash syntax:

1) E043: Arithmetic compound has inconsistent return semantics.
   Fix the bash syntax to be compliant.

2) ERROR: Split export and assignments in 2 files. Ignore the files.
   Fix the bash syntax to be compliant.
   Note: this test has been introducted by
   https://review.openstack.org/#/c/400542/

(cherry picked from commit 9031dcf620)

Second Patch:

Run `yum update -y` before Puppet run

This patch run `yum update -y` right before running os-refresh-config
(Puppet).

1) Running `yum` from an Exec in Puppet is a bad idea because Puppet has
no idea which packages resources are touched, so we're loosing the
orchestration control.

2) We need to ensure that `yum update -y` runs before any attempt to
deploy OpenStack services, so we have latest packages from RDO and
CentOS.

Closes-Bug: #1650374
(cherry picked from commit 853b4bfbad)

Change-Id: Ifbbbdbf1f0c569791abc712913c7e0f6bbe533d9
(cherry picked from commit aab2dadd19)
This commit is contained in:
Emilien Macchi
2016-12-17 09:15:42 -05:00
committed by Ben Nemec
parent d0b205c489
commit 8ba565cb21
5 changed files with 43 additions and 17 deletions

View File

@@ -7,9 +7,11 @@ OK_FILE=/opt/stack/.undercloud-setup
source /root/tripleo-undercloud-passwords
source /root/stackrc
export INSTACK_ROOT=${INSTACK_ROOT:-""}
INSTACK_ROOT=${INSTACK_ROOT:-""}
export INSTACK_ROOT
if [ -n "$INSTACK_ROOT" ]; then
export PATH=$PATH:$INSTACK_ROOT/instack-undercloud/scripts
PATH=$PATH:$INSTACK_ROOT/instack-undercloud/scripts
export PATH
fi
if [ ! -f /root/.ssh/authorized_keys ]; then
@@ -25,7 +27,8 @@ fi
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys
export UNDERCLOUD_IP=$(os-apply-config --key local-ip --type netaddress)
UNDERCLOUD_IP=$(os-apply-config --key local-ip --type netaddress)
export UNDERCLOUD_IP
DHCP_START=$(os-apply-config --key neutron.dhcp_start --type netaddress)
DHCP_END=$(os-apply-config --key neutron.dhcp_end --type netaddress)

View File

@@ -1,15 +1,26 @@
export NOVA_VERSION=1.1
export OS_PASSWORD=$(sudo hiera admin_password)
NOVA_VERSION=1.1
export NOVA_VERSION
OS_PASSWORD=$(sudo hiera admin_password)
export OS_PASSWORD
{{#service_certificate}}
export OS_AUTH_URL=https://{{public_vip}}:13000/v2.0
export PYTHONWARNINGS="ignore:Certificate has no, ignore:A true SSLContext object is not available"
OS_AUTH_URL=https://{{public_vip}}:13000/v2.0
PYTHONWARNINGS="ignore:Certificate has no, ignore:A true SSLContext object is not available"
export OS_AUTH_URL
export PYTHONWARNINGS
{{/service_certificate}}
{{^service_certificate}}
export OS_AUTH_URL=http://{{local-ip}}:5000/v2.0
OS_AUTH_URL=http://{{local-ip}}:5000/v2.0
export OS_AUTH_URL
{{/service_certificate}}
export OS_USERNAME=admin
export OS_TENANT_NAME=admin
export COMPUTE_API_VERSION=1.1
export OS_NO_CACHE=True
export OS_CLOUDNAME=undercloud
export OS_IMAGE_API_VERSION=1
OS_USERNAME=admin
OS_TENANT_NAME=admin
COMPUTE_API_VERSION=1.1
OS_NO_CACHE=True
OS_CLOUDNAME=undercloud
OS_IMAGE_API_VERSION=1
export OS_USERNAME
export OS_TENANT_NAME
export COMPUTE_API_VERSION
export OS_NO_CACHE
export OS_CLOUDNAME
export OS_IMAGE_API_VERSION

View File

@@ -44,12 +44,14 @@ class TestUndercloud(BaseTestCase):
@mock.patch('instack_undercloud.undercloud._run_command')
@mock.patch('instack_undercloud.undercloud._post_config')
@mock.patch('instack_undercloud.undercloud._run_orc')
@mock.patch('instack_undercloud.undercloud._run_yum_update')
@mock.patch('instack_undercloud.undercloud._run_instack')
@mock.patch('instack_undercloud.undercloud._generate_environment')
@mock.patch('instack_undercloud.undercloud._load_config')
def test_install(self, mock_load_config, mock_generate_environment,
mock_run_instack, mock_run_orc, mock_post_config,
mock_run_command, mock_check_memory, mock_check_hostname,
mock_run_instack, mock_run_yum_update, mock_run_orc,
mock_post_config, mock_run_command,
mock_check_memory, mock_check_hostname,
mock_configure_logging):
fake_env = mock.MagicMock()
mock_generate_environment.return_value = fake_env

View File

@@ -52,6 +52,8 @@ class Paths(object):
@property
def LOG_FILE(self):
return os.path.expanduser('~/.instack/install-undercloud.log')
PATHS = Paths()
DEFAULT_LOG_LEVEL = logging.DEBUG
DEFAULT_LOG_FORMAT = '%(asctime)s %(levelname)s: %(message)s'
@@ -741,6 +743,13 @@ def _run_instack(instack_env):
LOG.info('Instack completed successfully')
def _run_yum_update(instack_env):
args = ['sudo', 'yum', 'update', '-y']
LOG.info('Running yum update')
_run_live_command(args, instack_env, 'yum-update')
LOG.info('yum-update completed successfully')
def _run_orc(instack_env):
args = ['sudo', 'os-refresh-config']
LOG.info('Running os-refresh-config')
@@ -853,6 +862,7 @@ def install(instack_root):
_check_memory()
_clean_os_refresh_config()
instack_env = _generate_environment(instack_root)
_run_yum_update(instack_env)
_run_instack(instack_env)
_run_orc(instack_env)
_post_config()

View File

@@ -182,7 +182,7 @@ while true; do
break
fi
sleep 3
(( elapsed_seconds += 3 ))
elapsed_seconds=$((elapsed_seconds + 3))
if [ $elapsed_seconds -ge $timeout_seconds ]; then
set +x
echo "$UNDERCLOUD_VM_NAME never got an IP address from the libvirt default network."