From 567b483efde9436f8488e3a3ae571bcb240db300 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Wed, 9 Mar 2016 13:29:05 +0000 Subject: [PATCH] Gate: Use OpenStack-CI apt mirrors re: http://lists.openstack.org/pipermail/openstack-dev/2016-February/086295.html OpenStack-CI has now implemented their own APT mirrors which are updated and synchronised properly to prevent issues when the update takes place between the time an instance does an 'apt-get update' and an 'apt-get install'. Now that this infrastructure is in place, we can remove our logic to determine the optimal apt source for gating and simply fall back to the default AIO behaviour which is to use whatever is configured on the host. In order to do this successfully the AIO needs to ensure that it has the appropriate configurations in place to ignore unauthenticated packages. This patch implements a full propogation of all files in /etc/apt/apt.conf.d/ from the host to all containers in order to ensure that any configurations implemented by OpenStack-Infra are used from now on in our Gate jobs. Change-Id: Id6c2be3cf57b7c49744156a943f9653c1575e3dd --- scripts/gate-check-commit.sh | 42 ------------------- .../bootstrap-host/tasks/install-apt.yml | 6 +++ .../tasks/prepare_aio_config.yml | 32 ++++++++++++++ 3 files changed, 38 insertions(+), 42 deletions(-) diff --git a/scripts/gate-check-commit.sh b/scripts/gate-check-commit.sh index 977b39044a..e812a30329 100755 --- a/scripts/gate-check-commit.sh +++ b/scripts/gate-check-commit.sh @@ -65,48 +65,6 @@ iptables -P OUTPUT ACCEPT if [ -f /etc/nodepool/provider -a -s /etc/nodepool/provider ]; then source /etc/nodepool/provider - # Get the fastest possible Linux mirror depending on the datacenter where the - # tests are running. - # The nodepool provider list can be found in: - # https://github.com/openstack-infra/project-config/blob/master/nodepool/nodepool.yaml - case ${NODEPOOL_PROVIDER} in - "rax-dfw"*) - export UBUNTU_REPO="http://dfw.mirror.rackspace.com/ubuntu" - ;; - "rax-ord"*) - export UBUNTU_REPO="http://ord.mirror.rackspace.com/ubuntu" - ;; - "rax-iad"*) - export UBUNTU_REPO="http://iad.mirror.rackspace.com/ubuntu" - ;; - "hpcloud"*) - export UBUNTU_REPO="http://${NODEPOOL_AZ}.clouds.archive.ubuntu.com/ubuntu" - ;; - "ovh-gra1"*) - export UBUNTU_REPO="http://ubuntu.mirrors.ovh.net/ubuntu" - ;; - "ovh-bhs1"*) - export UBUNTU_REPO="http://ubuntu.bhs.mirrors.ovh.net/ubuntu" - ;; - "bluebox-sjc1"*) - export UBUNTU_REPO="http://ord.mirror.rackspace.com/ubuntu" - ;; - "internap-nyj01"*) - export UBUNTU_REPO="http://iad.mirror.rackspace.com/ubuntu" - ;; - "vexxhost-ca-ymq-1"*) - export UBUNTU_REPO="http://ubuntu.mirror.vexxhost.com/ubuntu" - ;; - "osic-cloud1"*) - export UBUNTU_REPO="http://iad.mirror.rackspace.com/ubuntu" - ;; - esac - - if [ -n "${UBUNTU_REPO:-}" ]; then - export BOOTSTRAP_OPTS="${BOOTSTRAP_OPTS} bootstrap_host_ubuntu_repo=${UBUNTU_REPO}" - export BOOTSTRAP_OPTS="${BOOTSTRAP_OPTS} bootstrap_host_ubuntu_security_repo=${UBUNTU_REPO}" - fi - # Update the libvirt cpu map with a gate64 cpu model. This enables nova # live migration for 64bit guest OSes on heterogenous cloud "hardware". export BOOTSTRAP_OPTS="${BOOTSTRAP_OPTS} bootstrap_host_libvirt_config=yes" diff --git a/tests/roles/bootstrap-host/tasks/install-apt.yml b/tests/roles/bootstrap-host/tasks/install-apt.yml index cc6535651f..ff644c67f3 100644 --- a/tests/roles/bootstrap-host/tasks/install-apt.yml +++ b/tests/roles/bootstrap-host/tasks/install-apt.yml @@ -20,6 +20,12 @@ tags: - apt-install-prerequisites +- name: Determine the list of apt configuration files on the host + command: "ls -1 /etc/apt/apt.conf.d" + register: apt_conf_files + tags: + - apt-conf-files + - name: Determine the existing Ubuntu repo configuration shell: 'awk "/^deb .*ubuntu\/? {{ ansible_distribution_release }} main/ {print \$2; exit}" /etc/apt/sources.list' register: ubuntu_repo diff --git a/tests/roles/bootstrap-host/tasks/prepare_aio_config.yml b/tests/roles/bootstrap-host/tasks/prepare_aio_config.yml index 02157c90dc..28a631091a 100644 --- a/tests/roles/bootstrap-host/tasks/prepare_aio_config.yml +++ b/tests/roles/bootstrap-host/tasks/prepare_aio_config.yml @@ -147,3 +147,35 @@ dest: /etc/openstack_deploy/user_variables.yml config_overrides: "{{ user_variables_overrides | default({}) }}" config_type: yaml + +- name: Add user_apt_conf_files to contain the list of files to copy into containers + file: + path: /etc/openstack_deploy/user_apt_conf_files.yml + state: touch + when: + - apt_conf_files is defined + - apt_conf_files.stdout_lines | length > 0 + tags: + - apt-conf-files + +- name: Ensure that the first two lines in user_apt_conf_files are correct + lineinfile: + dest: /etc/openstack_deploy/user_apt_conf_files.yml + line: "---\nlxc_container_cache_files:" + insertbefore: BOF + when: + - apt_conf_files is defined + - apt_conf_files.stdout_lines | length > 0 + tags: + - apt-conf-files + +- name: Add the list of dicts into user_apt_conf_files + lineinfile: + dest: /etc/openstack_deploy/user_apt_conf_files.yml + line: " - { src: '/etc/apt/apt.conf.d/{{ item }}', dest: '/etc/apt/apt.conf.d/{{ item }}' }" + with_items: apt_conf_files.stdout_lines + when: + - apt_conf_files is defined + - apt_conf_files.stdout_lines | length > 0 + tags: + - apt-conf-files