If a global pip.conf file exists, let the AIO use it for containers

OpenStack-CI implements a global pip configuration which configures
the use of the OpenStack pypi and wheel mirrors.

This patch implements a check for a global pip configuration file,
then adds this file to the list of files to be copied into the
container cache so that all containers have the configuration.

While most containers end up with a localised pip configuration
which locks them down to the repo server (which will ignore the
glocal config), this is very useful for the repo server which
does not get locked down.

Change-Id: I1058b68f2281c5152fcd4b880fa21121716bc05c
This commit is contained in:
Jesse Pretorius 2016-03-30 17:05:02 +01:00 committed by Jesse Pretorius (odyssey4me)
parent 318109d0ed
commit 8d18b13fbf

View File

@ -139,34 +139,46 @@
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
- name: Determine if the host has a global pip config file
stat:
path: /etc/pip.conf
register: pip_conf_file
- name: Add user_conf_files to contain the list of files to copy into containers
file:
path: /etc/openstack_deploy/user_apt_conf_files.yml
path: /etc/openstack_deploy/user_conf_files.yml
state: touch
when:
- apt_conf_files is defined
- apt_conf_files.stdout_lines | length > 0
- apt_conf_files is defined or pip_conf_file.stat.exists
tags:
- apt-conf-files
- container-conf-files
- name: Ensure that the first two lines in user_apt_conf_files are correct
- name: Ensure that the first two lines in user_conf_files are correct
lineinfile:
dest: /etc/openstack_deploy/user_apt_conf_files.yml
dest: /etc/openstack_deploy/user_conf_files.yml
line: "---\nlxc_container_cache_files:"
insertbefore: BOF
when:
- apt_conf_files is defined
- apt_conf_files.stdout_lines | length > 0
- apt_conf_files is defined or pip_conf_file.stat.exists
tags:
- apt-conf-files
- container-conf-files
- name: Add the list of dicts into user_apt_conf_files
- name: Add the dict to copy the global pip config file into user_conf_files
lineinfile:
dest: /etc/openstack_deploy/user_apt_conf_files.yml
dest: /etc/openstack_deploy/user_conf_files.yml
line: " - { src: '/etc/pip.conf', dest: '/etc/pip.conf' }"
when:
- pip_conf_file.stat.exists
tags:
- container-conf-files
- name: Add the list of dicts for the apt config files into user_conf_files
lineinfile:
dest: /etc/openstack_deploy/user_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
- container-conf-files