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

We need to squash to patches if we want to unblock stable/newton 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
This commit is contained in:
Emilien Macchi 2016-12-17 09:15:42 -05:00
parent 43cd7d6dc3
commit aab2dadd19
6 changed files with 43 additions and 40 deletions

View File

@ -19,27 +19,6 @@ class { '::tripleo::network::os_net_config':
stage => 'setup',
}
# Upgrade packaging.
case $::osfamily {
'RedHat': {
$pkg_upgrade_cmd = 'yum -y update'
}
default: {
warning('Please specify a package upgrade command for distribution.')
}
}
exec { 'package-upgrade':
command => $pkg_upgrade_cmd,
path => '/usr/bin',
timeout => 0,
}
# Ensure Puppet will update packages using Package provider
# so Puppet OpenStack modules will notify db_sync commands for each service.
Package<| tag == 'openstack' |> { ensure => latest }
# Ensure we upgrade all packages after managing OpenStack packages, so Puppet
# can notify services and db_sync commands.
Package<| tag == 'openstack' |> -> Exec['package-upgrade']
# Run OpenStack db-sync at every puppet run, in any case.
Exec<| title == 'neutron-db-sync' |> { refreshonly => false }
Exec<| title == 'keystone-manage db_sync' |> { refreshonly => false }

View File

@ -1,16 +1,28 @@
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_BAREMETAL_API_VERSION=1.15
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_BAREMETAL_API_VERSION=1.15
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_BAREMETAL
export OS_NO_CACHE
export OS_CLOUDNAME
export OS_IMAGE_API_VERSION

View File

@ -5,9 +5,11 @@ set -eux
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
@ -23,7 +25,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

@ -45,13 +45,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_validate_configuration,
mock_configure_logging):
mock_run_yum_update, mock_run_instack, mock_run_orc,
mock_post_config, mock_run_command,
mock_validate_configuration, mock_configure_logging):
fake_env = mock.MagicMock()
mock_generate_environment.return_value = fake_env
undercloud.install('.')

View File

@ -990,6 +990,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')
@ -1202,6 +1209,7 @@ def install(instack_root):
_validate_configuration()
instack_env = _generate_environment(instack_root)
_generate_init_data(instack_env)
_run_yum_update(instack_env)
_run_instack(instack_env)
_run_orc(instack_env)
_post_config(instack_env)

View File

@ -183,7 +183,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."