From bccbc1b221d0b428def8a7b971562d051a417040 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Mon, 23 Oct 2017 14:40:16 +1100 Subject: [PATCH] Move to dictionary list of projects zuul._projects (take 2) This re-implements I430277369f9ecb2ecc0a31f795c72bba83bcecff (that had to be reverted with commit c8628dd8f846567a3686e428324f4b29b8aa5ed4). The original change had a small syntax error using "zuul.projects.values()" instead of "zuul._projects.values()". This is corrected here. It also had a problem with_items: zuul._projects.values() -- in python3 this returns a view, which doesn't work with "with_items:" ... so you need to "| list". Integration test results (for use-cached-repos at least) in I7828f78efd1d20031cf1c34629200f265576e7a7. Change-Id: I9d88f405f34d1c5f75ebf4f52cedfaaab20c3bda --- playbooks/release/pre.yaml | 2 +- roles/use-cached-repos/tasks/main.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/playbooks/release/pre.yaml b/playbooks/release/pre.yaml index 63685437c2..27aa016a53 100644 --- a/playbooks/release/pre.yaml +++ b/playbooks/release/pre.yaml @@ -5,7 +5,7 @@ command: "git remote add origin https://{{ item.canonical_name }}" args: chdir: "{{ ansible_user_dir }}/src/{{ item.canonical_name }}" - with_items: "{{ zuul.projects }}" + with_items: "{{ zuul._projects.values() | list }}" roles: - role: configure-git git_config: diff --git a/roles/use-cached-repos/tasks/main.yaml b/roles/use-cached-repos/tasks/main.yaml index b5db378da9..5825d0bdd8 100644 --- a/roles/use-cached-repos/tasks/main.yaml +++ b/roles/use-cached-repos/tasks/main.yaml @@ -1,7 +1,7 @@ - name: Find locally cached git repos stat: path: "/opt/git/{{ item.name }}" - with_items: "{{ zuul.projects }}" + with_items: "{{ zuul._projects.values() | list }}" register: cached_repos - name: Clone cached repo to workspace @@ -10,7 +10,7 @@ creates: "{{ ansible_user_dir }}/{{ item.0.src_dir}}" when: item.1.stat.exists with_together: - - "{{ zuul.projects }}" + - "{{ zuul._projects.values() | list }}" - "{{ cached_repos.results }}" - name: Clone upstream repo to workspace @@ -19,11 +19,11 @@ creates: "{{ ansible_user_dir }}/{{ item.0.src_dir}}" when: not item.1.stat.exists with_together: - - "{{ zuul.projects }}" + - "{{ zuul._projects.values() | list }}" - "{{ cached_repos.results }}" - name: Remove origin from local git repos command: "git remote rm origin" args: chdir: "{{ ansible_user_dir }}/{{ item.src_dir}}" - with_items: "{{ zuul.projects }}" + with_items: "{{ zuul._projects.values() | list }}"