Skip to content

Commit

Permalink
Fix "risky-shell-pipe" violations.
Browse files Browse the repository at this point in the history
Adding the missing "pipefail" option.
Fixing 1 violation:
  risky-shell-pipe: Shells that use pipes should set the pipefail option.
Some code reformatting.

Signed-off-by: Pavel Bar <pbar@redhat.com>
Bug-Url: https://bugzilla.redhat.com/2097332
  • Loading branch information
barpavel committed Jun 30, 2022
1 parent f485191 commit 3493a54
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion automation/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ cd "$COLLECTION_DIR"
ansible-test sanity
antsibull-changelog lint -v
ansible-lint roles/* --exclude roles/hosted_engine_setup --exclude roles/disaster_recovery --exclude roles/remove_stale_lun -x experimental
ansible-lint -x unnamed-task,fqcn-builtins,no-changed-when,risky-shell-pipe,ignore-errors roles/disaster_recovery roles/remove_stale_lun
ansible-lint -x unnamed-task,fqcn-builtins,no-changed-when,ignore-errors roles/disaster_recovery roles/remove_stale_lun

cd "$ROOT_PATH"

Expand Down
5 changes: 4 additions & 1 deletion roles/remove_stale_lun/tasks/remove_mpath_device.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
lun_wwid: "{{ lun_wwid | mandatory }}"

- name: Get underlying disks (paths) for a multipath device(s) and turn them into a list.
ansible.builtin.shell: 'for dev in {{ lun_wwid }}; do dmsetup deps -o devname $dev | cut -f 2 |cut -c 3- |tr -d "()"|tr "\r\n" " "; done'
ansible.builtin.shell: |
for dev in {{ lun_wwid }}; do
set -euo pipefail && dmsetup deps -o devname $dev | cut -f 2 | cut -c 3- | tr -d "()" | tr "\r\n" " ";
done
register: disks
check_mode: "no"

Expand Down

0 comments on commit 3493a54

Please sign in to comment.