From 45d256899bb7e6a3decb930f1847c64fa6d1828b Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Sat, 23 Mar 2019 16:05:43 -0400 Subject: [PATCH] Create zuul_pip_virtualenv_symlink variable Expose the ability for a user to create a symlink to a zuul virtualenv, this is usually needed when you start trying to version different virtualenv installs. Change-Id: Icef1ac5c412e6c905c6490899dffa47262812466 Signed-off-by: Paul Belanger --- tasks/install/pip.yaml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tasks/install/pip.yaml b/tasks/install/pip.yaml index 07b9e72..fa16bf9 100644 --- a/tasks/install/pip.yaml +++ b/tasks/install/pip.yaml @@ -22,3 +22,30 @@ version: "{{ zuul_pip_version|default(omit) }}" virtualenv_python: "{{ zuul_pip_virtualenv_python|default(omit) }}" virtualenv: "{{ zuul_pip_virtualenv|default(omit) }}" + +- name: Stat zuul_pip_virtualenv_symlink + stat: + path: "{{ zuul_pip_virtualenv_symlink | dirname }}" + register: r + no_log: true + when: zuul_pip_virtualenv_symlink is defined + +- name: Create zuul_pip_virtualenv_symlink directory + become: true + file: + state: directory + path: "{{ zuul_pip_virtualenv_symlink | dirname }}" + when: + - zuul_pip_virtualenv_symlink is defined + - not r.stat.exists + +- name: Symlink zuul virtualenv + become: true + file: + dest: "{{ zuul_pip_virtualenv_symlink }}" + src: "{{ zuul_pip_virtualenv }}" + state: link + when: + - zuul_pip_virtualenv is defined + - zuul_pip_virtualenv_symlink is defined + - zuul_pip_virtualenv != zuul_pip_virtualenv_symlink