From e672a26592bc2c7c6e618b21829b6506852a468e Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Mon, 21 Mar 2016 09:11:25 +0000 Subject: [PATCH] Use upper-constraints file in developer mode This commit adds the following new variables: horizon_requirements_git_repo horizon_requirements_git_install_branch When in developer mode, This repo is then cloned in horizon_install.yml and used as an upper constraint in the functional test to avoid us installing and running into issues resulting from uncapped dependencies being installed. This commit also changes the pip_install_options fact name in horizon_install.yml to pip_install_options_fact. This allows us to maintain the existing pip_install_options variable without overwriting it with options when in developer mode, which ultimately means we can have multiple services running in a container use a combination of *_developer_mode: true and *_developer_mode: false. At the moment, if a service writes pip_install_options fact with the constraints options, those options will persist to other services running in the container even if *_developer_mode: false. Change-Id: If481de123073e46825cd5816062f08332d2d98fb --- defaults/main.yml | 2 ++ tasks/horizon_install.yml | 34 ++++++++++++++++++++++++++++------ tests/test.yml | 3 +++ 3 files changed, 33 insertions(+), 6 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 5fdbd62a..a3fe6168 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -20,6 +20,8 @@ verbose: True horizon_git_repo: https://git.openstack.org/openstack/horizon horizon_git_install_branch: master horizon_developer_mode: false +horizon_requirements_git_repo: https://git.openstack.org/openstack/requirements +horizon_requirements_git_install_branch: master horizon_developer_constraints: - "git+{{ horizon_git_repo }}@{{ horizon_git_install_branch }}#egg=horizon" diff --git a/tasks/horizon_install.yml b/tasks/horizon_install.yml index faf78834..b980883d 100644 --- a/tasks/horizon_install.yml +++ b/tasks/horizon_install.yml @@ -43,15 +43,37 @@ - horizon-install - horizon-pip-packages -- name: Set constraint file fact for developer mode - set_fact: - pip_install_options: "{{ pip_install_options|default('') }} --constraint /opt/developer-pip-constraints.txt" +- name: Clone requirements git repository + git: + repo: "{{ horizon_requirements_git_repo }}" + dest: "/opt/requirements" + clone: yes + update: yes + version: "{{ horizon_requirements_git_install_branch }}" when: - horizon_developer_mode | bool tags: - horizon-install - horizon-pip-packages +- name: Add constraints to pip_install_options fact for developer mode + set_fact: + pip_install_options_fact: "{{ pip_install_options|default('') }} --constraint /opt/developer-pip-constraints.txt --constraint /opt/requirements/upper-constraints.txt" + when: + - horizon_developer_mode | bool + tags: + - horizon-install + - horizon-pip-packages + +- name: Set pip_install_options_fact when not in developer mode + set_fact: + pip_install_options_fact: "{{ pip_install_options|default('') }}" + when: + - not horizon_developer_mode | bool + tags: + - horizon-install + - horizon-pip-packages + - name: Install apt packages apt: pkg: "{{ item }}" @@ -69,7 +91,7 @@ pip: name: "{{ item }}" state: present - extra_args: "{{ pip_install_options|default('') }}" + extra_args: "{{ pip_install_options_fact }}" register: install_packages until: install_packages|success retries: 5 @@ -186,7 +208,7 @@ state: present virtualenv: "{{ horizon_venv_bin | dirname }}" virtualenv_site_packages: "no" - extra_args: "{{ pip_install_options|default('') }}" + extra_args: "{{ pip_install_options_fact }}" register: install_packages until: install_packages|success retries: 5 @@ -203,7 +225,7 @@ pip: name: "{{ item }}" state: present - extra_args: "{{ pip_install_options|default('') }}" + extra_args: "{{ pip_install_options_fact }}" register: install_packages until: install_packages|success retries: 5 diff --git a/tests/test.yml b/tests/test.yml index c38d9121..0a0f9fa8 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -93,6 +93,7 @@ keystone_venv_tag: "testing" keystone_developer_mode: true keystone_git_install_branch: a55128044f763f5cfe2fdc57c738eaca97636448 + keystone_requirements_git_install_branch: 332278d456e06870150835564342570ec9d5f5a0 keystone_auth_admin_token: "SuperSecreteTestToken" keystone_auth_admin_password: "SuperSecretePassword" keystone_service_password: "secrete" @@ -116,6 +117,8 @@ internal_lb_vip_address: 10.100.100.102 horizon_developer_mode: true horizon_venv_tag: "testing" + horizon_git_install_branch: 18f1605bddd428a014d0e43ef52d1af6305e1e03 + horizon_requirements_git_install_branch: 332278d456e06870150835564342570ec9d5f5a0 horizon_galera_address: 10.100.100.101 horizon_rabbitmq_password: "secrete" horizon_rabbitmq_userid: horizon