Move to dictionary list of projects zuul._projects (take 2)

This re-implements I430277369f9ecb2ecc0a31f795c72bba83bcecff (that had
to be reverted with commit c8628dd8f8).

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
This commit is contained in:
Ian Wienand 2017-10-23 14:40:16 +11:00
parent 0d4e6fb52b
commit bccbc1b221
2 changed files with 5 additions and 5 deletions

View File

@ -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:

View File

@ -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 }}"