From c877323de312c54407206cbcfbef2813b13c818c Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Tue, 7 Apr 2020 09:39:38 +1000 Subject: [PATCH] fetch-zuul-cloner: use ensure-pip Firstly, the "destination" variable was replaced with a virtualenv in 6bb1f6046b692ee2038eafd0965bd3095d6fa787; update the documentation and prefix the name as is now standard for variables in this repo. This is not set anywhere so I think the prefixing is OK. Call ensure-pip before installing, and use the virtualenv_command it exports to create the environment for the zuul-cloner binary. Story: #2007386 Task: #39311 Change-Id: I057191bf20ab1650a8926971dd386ce9cb1f03f5 --- roles/fetch-zuul-cloner/README.rst | 9 ++++++--- roles/fetch-zuul-cloner/defaults/main.yaml | 2 +- roles/fetch-zuul-cloner/tasks/main.yaml | 11 ++++++++--- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/roles/fetch-zuul-cloner/README.rst b/roles/fetch-zuul-cloner/README.rst index d4db2e218..a2a2558f7 100644 --- a/roles/fetch-zuul-cloner/README.rst +++ b/roles/fetch-zuul-cloner/README.rst @@ -1,10 +1,13 @@ Fetch the zuul-cloner shim and install to the destination. +**Role Variables** + .. zuul:rolevar:: repo_src_dir Location of the Zuul source repositories. -.. zuul:rolevar:: destination +.. zuul:rolevar:: fetch_zuul_cloner_virtualenv + :default: ``/usr/zuul-env`` - Where to install the zuul-cloner shim. This should be the full path - and filename. + The path to the virtualenv to install the shim. See the ensure-pip + role for details of virtualenv creation. diff --git a/roles/fetch-zuul-cloner/defaults/main.yaml b/roles/fetch-zuul-cloner/defaults/main.yaml index 296ad19f9..87ed76bea 100644 --- a/roles/fetch-zuul-cloner/defaults/main.yaml +++ b/roles/fetch-zuul-cloner/defaults/main.yaml @@ -1 +1 @@ -virtualenv: /usr/zuul-env +fetch_zuul_cloner_virtualenv: /usr/zuul-env diff --git a/roles/fetch-zuul-cloner/tasks/main.yaml b/roles/fetch-zuul-cloner/tasks/main.yaml index 63d301b24..635bd338c 100644 --- a/roles/fetch-zuul-cloner/tasks/main.yaml +++ b/roles/fetch-zuul-cloner/tasks/main.yaml @@ -1,18 +1,23 @@ +- name: Run ensure-pip + include_role: + name: ensure-pip + - name: Install zuul-cloner shim dependencies pip: name: PyYAML - virtualenv: "{{ virtualenv }}" + virtualenv_command: '{{ ensure_pip_virtualenv_command }}' + virtualenv: '{{ fetch_zuul_cloner_virtualenv }}' become: yes - name: Install zuul-cloner shim template: src: templates/zuul-cloner-shim.py.j2 - dest: "{{ virtualenv }}/bin/zuul-cloner" + dest: "{{ fetch_zuul_cloner_virtualenv }}/bin/zuul-cloner" become: yes - name: Change zuul-cloner permissions file: - path: "{{ virtualenv }}/bin/zuul-cloner" + path: "{{ fetch_zuul_cloner_virtualenv }}/bin/zuul-cloner" mode: 0755 become: yes