From 270df9c11b45ec63e2fa3eed6905859734cc6677 Mon Sep 17 00:00:00 2001 From: Andrei Stepanov Date: Aug 23 2018 14:27:32 +0000 Subject: Adopt for Ansible 2.4 flatten list. Signed-off-by: Andrei Stepanov --- diff --git a/roles/str-common-init/tasks/main.yml b/roles/str-common-init/tasks/main.yml index fa072f3..9529f24 100644 --- a/roles/str-common-init/tasks/main.yml +++ b/roles/str-common-init/tasks/main.yml @@ -19,8 +19,8 @@ name: str-common-pkgs vars: param_req_pkgs: - - "{{ required_packages|d|list|flatten }}" - - "{{ role_pkgs_req|d|list|flatten }}" + - "{{ required_packages|d|list }}" + - "{{ role_pkgs_req|d|list }}" - name: Make artifacts directory file: path={{ remote_artifacts }} state=directory owner=root mode=755 recurse=yes @@ -37,4 +37,4 @@ name: "{{ item }}" state: started with_flattened: - - "{{ required_services|d|list|flatten }}" + - "{{ required_services|d|list }}" diff --git a/roles/str-common-pkgs/tasks/main.yml b/roles/str-common-pkgs/tasks/main.yml index ac2f673..7388351 100644 --- a/roles/str-common-pkgs/tasks/main.yml +++ b/roles/str-common-pkgs/tasks/main.yml @@ -6,17 +6,22 @@ set_fact: pkgs_ordinary_req: > {{ - param_req_pkgs | flatten | + pkgs_ordinary_req|d|list|union([item]) | reject('match', '.*-debuginfo$') | list }} pkgs_debuginfo_req: > {{ - param_req_pkgs | flatten | + pkgs_debuginfo_req|d|list|union([item]) | select('match', '.*-debuginfo$') | list | regex_replace('-debuginfo') }} + with_flattened: + - "{{ param_req_pkgs }}" + +- name: Set package manager variable + set_fact: pkg_mgr: > {{ 'rpm-ostree' if (is_atomic and diff --git a/roles/str-common-pkgs/tasks/pkgs-dnf.yml b/roles/str-common-pkgs/tasks/pkgs-dnf.yml index 31568b5..08649e4 100644 --- a/roles/str-common-pkgs/tasks/pkgs-dnf.yml +++ b/roles/str-common-pkgs/tasks/pkgs-dnf.yml @@ -19,9 +19,9 @@ shell: dnf copr enable -y {{ item }} with_flattened: # Copr repos required by tests - - "{{ copr_repos_req|d|list|flatten }}" + - "{{ copr_repos_req|d|list }}" # Copr repos required by roles - - "{{ role_copr_repos_req|d|list|flatten }}" + - "{{ role_copr_repos_req|d|list }}" ignore_errors: True - name: Install test-specific package requirements @@ -29,7 +29,7 @@ package: name={{ item }} state=present register: result with_flattened: - - "{{ pkgs_ordinary_req|d|list|flatten }}" + - "{{ pkgs_ordinary_req|d|list }}" retries: 5 delay: 10 until: result.failed == false diff --git a/roles/str-common-pkgs/tasks/pkgs-rpm-ostree.yml b/roles/str-common-pkgs/tasks/pkgs-rpm-ostree.yml index a82bd2e..4cd2928 100644 --- a/roles/str-common-pkgs/tasks/pkgs-rpm-ostree.yml +++ b/roles/str-common-pkgs/tasks/pkgs-rpm-ostree.yml @@ -23,15 +23,15 @@ curl "$URL" -L --retry 5 --output "$REPO_FILE" with_flattened: # Copr repos required by tests - - "{{ copr_repos_req|d|list|flatten }}" + - "{{ copr_repos_req|d|list }}" # Copr repos required by roles - - "{{ role_copr_repos_req|d|list|flatten }}" + - "{{ role_copr_repos_req|d|list }}" ignore_errors: True - block: - name: Make a list of requested packages for Atomic Host set_fact: - pkgs_atomic_req: "{{ pkgs_ordinary_req|d|flatten|join(' ') }} " + pkgs_atomic_req: "{{ pkgs_ordinary_req|d|join(' ') }} " - debug: msg: "Requested packages for Atomic Host: {{ pkgs_atomic_req }}" verbosity: 1 diff --git a/roles/str-common-pkgs/tasks/pkgs-yum.yml b/roles/str-common-pkgs/tasks/pkgs-yum.yml index e03baad..f497387 100644 --- a/roles/str-common-pkgs/tasks/pkgs-yum.yml +++ b/roles/str-common-pkgs/tasks/pkgs-yum.yml @@ -12,9 +12,9 @@ shell: yum copr enable -y {{ item }} with_flattened: # Copr repos required by tests - - "{{ copr_repos_req|d|list|flatten }}" + - "{{ copr_repos_req|d|list }}" # Copr repos required by roles - - "{{ role_copr_repos_req|d|list|flatten }}" + - "{{ role_copr_repos_req|d|list }}" ignore_errors: True - name: Install test-specific package requirements @@ -22,7 +22,7 @@ package: name={{ item }} state=present register: result with_flattened: - - "{{ pkgs_ordinary_req|d|list|flatten }}" + - "{{ pkgs_ordinary_req|d|list }}" retries: 5 delay: 10 until: result.failed == false