diff --git a/defaults/main.yml b/defaults/main.yml index 7b375d6..f5e3ec4 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -27,20 +27,12 @@ sahara_pip_package_state: "latest" sahara_git_repo: https://git.openstack.org/openstack/sahara sahara_git_install_branch: master -sahara_developer_mode: false -sahara_developer_constraints: +sahara_upper_constraints_url: "{{ requirements_git_url | default('https://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=' ~ requirements_git_install_branch | default('master')) }}" +sahara_git_constraints: - "git+{{ sahara_git_repo }}@{{ sahara_git_install_branch }}#egg=sahara" + - "--constraint {{ sahara_upper_constraints_url }}" -# TODO(odyssey4me): -# This can be simplified once all the roles are using -# python_venv_build. We can then switch to using a -# set of constraints in pip.conf inside the venv, -# perhaps prepared by giving a giving a list of -# constraints to the role. -sahara_pip_install_args: >- - {{ sahara_developer_mode | ternary(pip_install_developer_constraints | default('--constraint /opt/developer-pip-constraints.txt'), '') }} - {{ (pip_install_upper_constraints is defined) | ternary('--constraint ' + pip_install_upper_constraints | default(''), '') }} - {{ pip_install_options | default('') }} +sahara_pip_install_args: "{{ pip_install_options | default('') }}" # Name of the virtual env to deploy into sahara_venv_tag: "{{ venv_tag | default('untagged') }}" @@ -48,11 +40,6 @@ sahara_bin: "/openstack/venvs/sahara-{{ sahara_venv_tag }}/bin" sahara_etc_dir: "{{ sahara_bin | dirname }}/etc/sahara" -# venv_download, even when true, will use the fallback method of building the -# venv from scratch if the venv download fails. -sahara_venv_download: "{{ not sahara_developer_mode | bool }}" -sahara_venv_download_url: http://127.0.0.1/venvs/untagged/ubuntu/sahara.tgz - sahara_db_config: /etc/sahara/sahara.conf # Enable/Disable Ceilometer @@ -200,6 +187,9 @@ sahara_pip_packages: sahara_optional_oslomsg_amqp1_pip_packages: - oslo.messaging[amqp1] +# Specific pip packages provided by the user +sahara_user_pip_packages: [] + sahara_engine_init_overrides: {} sahara_api_init_overrides: {} diff --git a/tasks/main.yml b/tasks/main.yml index a92401d..10b2fb5 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -27,7 +27,23 @@ tags: - sahara-install -- include_tasks: sahara_install.yml +- name: Install the python venv + import_role: + name: "python_venv_build" + vars: + venv_build_constraints: "{{ sahara_git_constraints }}" + venv_install_destination_path: "{{ sahara_bin | dirname }}" + venv_install_distro_package_list: "{{ sahara_distro_packages }}" + venv_pip_install_args: "{{ sahara_pip_install_args }}" + venv_pip_packages: >- + {{ sahara_pip_packages | + union(sahara_user_pip_packages) | + union(sahara_plugin_pip_packages) | + union(((sahara_oslomsg_amqp1_enabled | bool) | ternary(sahara_optional_oslomsg_amqp1_pip_packages, [])))}} + venv_facts_when_changed: + - section: "sahara" + option: "venv_tag" + value: "{{ sahara_venv_tag }}" tags: - sahara-install diff --git a/tasks/sahara_install.yml b/tasks/sahara_install.yml deleted file mode 100644 index 2f9e43b..0000000 --- a/tasks/sahara_install.yml +++ /dev/null @@ -1,47 +0,0 @@ ---- -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# TODO(odyssey4me): -# This can be simplified once all the roles are using -# python_venv_build. We can then switch to using a -# set of constraints in pip.conf inside the venv, -# perhaps prepared by giving a giving a list of -# constraints to the role. -- name: Create developer mode constraint file - copy: - dest: "/opt/developer-pip-constraints.txt" - content: | - {% for item in sahara_developer_constraints %} - {{ item }} - {% endfor %} - when: - - sahara_developer_mode | bool - -- name: Ensure remote wheel building is disabled in developer mode - set_fact: - venv_build_host: "{{ ansible_hostname }}" - when: - - sahara_developer_mode | bool - -- name: Install the python venv - include_role: - name: "python_venv_build" - vars: - venv_install_destination_path: "{{ sahara_bin | dirname }}" - venv_install_distro_package_list: "{{ sahara_distro_packages }}" - venv_pip_install_args: "{{ sahara_pip_install_args }}" - venv_pip_packages: "{{ (sahara_oslomsg_amqp1_enabled | bool) | ternary(sahara_pip_packages + sahara_plugin_pip_packages + sahara_optional_oslomsg_amqp1_pip_packages, sahara_pip_packages + sahara_plugin_pip_packages) }}" - venv_facts_when_changed: - - section: "sahara" - option: "venv_tag" - value: "{{ sahara_venv_tag }}" diff --git a/tests/os_sahara-overrides.yml b/tests/os_sahara-overrides.yml index b7ee281..8ce35d2 100644 --- a/tests/os_sahara-overrides.yml +++ b/tests/os_sahara-overrides.yml @@ -23,7 +23,6 @@ tempest_plugins: tempest_test_whitelist: - sahara_tempest_plugin.tests.api -sahara_developer_mode: true sahara_service_password: "secrete" sahara_container_mysql_password: "SuperSecrete" sahara_oslomsg_rpc_password: "{{ oslomsg_rpc_password }}"