From dcbf7e6bf5990c4f65870a09d72e790161d81ca5 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Thu, 17 Mar 2016 13:08:33 +0000 Subject: [PATCH] Tests: Make containers use the host's apt/pip config This patch sets the test to check if the test is running in OpenStack-CI, and if it is - then make the containers use the host's pip.conf and some of the apt configuration. All containers should make use of the hosts's apt sources configuration. The tasks detect and implement this. The intent is to make use of OpenStack-CI resources better and consequently reduce the test run time. Change-Id: I56012c4dd79477180f87cc25c5175ac08baf470e --- tests/test-prep.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/test-prep.yml b/tests/test-prep.yml index 71490dc6..9fcb7a4a 100644 --- a/tests/test-prep.yml +++ b/tests/test-prep.yml @@ -44,6 +44,24 @@ manage_dir: no - set_fact: lxc_container_ssh_key: "{{ hostvars['127.0.0.1']['lxc_container_ssh_key'] }}" + - name: Check if this is an OpenStack-CI nodepool instance + stat: + path: /etc/nodepool/provider + register: nodepool + - name: Set the files to copy into the container cache for OpenStack-CI instances + set_fact: + lxc_container_cache_files: + - { src: '/etc/pip.conf', dest: '/etc/pip.conf' } + - { src: '/etc/apt/apt.conf.d/99unauthenticated', dest: '/etc/apt/apt.conf.d/99unauthenticated' } + when: nodepool.stat.exists | bool + - 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 + changed_when: false + - name: Set apt repo facts based on discovered information + set_fact: + lxc_container_template_main_apt_repo: "{{ ubuntu_repo.stdout }}" + lxc_container_template_security_apt_rep: "{{ ubuntu_repo.stdout }}" roles: - role: "lxc_hosts" lxc_net_address: 10.100.100.1