Skip to content

Commit

Permalink
fix ansible lint: no-changed-when:
Browse files Browse the repository at this point in the history
'Commands should not change things if nothing needs doing'

Since the tag 'skip_ansible_lint oVirt#301' doesn't work and '# noqa no-changed-when' cannot be set on code blocks,
adding it to skip list
  • Loading branch information
dangel101 authored and mwperina committed Oct 10, 2022
1 parent 777ca4d commit a0539d4
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 34 deletions.
2 changes: 2 additions & 0 deletions build/ansible-lint.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ skip_list:
- 'role-name'
# name: All tasks should be named. (name[missing])
- 'name'
# no-changed-when: Commands should not change things if nothing needs doing.
- 'no-changed-when'
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@
grep -A1 {{ gluster_old_node | mandatory }} |
awk -F: '/uid/ { print $2}'
register: uuid
tags:
- skip_ansible_lint # E301

- name: Get the state from peer file
ansible.builtin.command: grep state "/var/lib/glusterd/peers/{{ uuid.stdout | trim }}"
register: grepres1
tags:
- skip_ansible_lint # E301

- name: Get the state from the peer command
ansible.builtin.shell: >
Expand All @@ -24,8 +20,6 @@
wc -l
ignore_errors: true
register: grepres2
tags:
- skip_ansible_lint # E301

- name: Fail the play if the previous command did not succeed
ansible.builtin.fail:
Expand All @@ -43,8 +37,6 @@
executable: /usr/bin/bash
register: old_node_uuid
run_once: true
tags:
- skip_ansible_lint # E301

- name: Fail if parsed hostname is different from the back-end FQDN
ansible.builtin.fail: msg="Hostname mentioned in inventory should be same with back-end gluster FQDN"
Expand Down Expand Up @@ -85,8 +77,6 @@
awk -F= '/UUID/ { print $2}'
register: current_node_uuid
run_once: true
tags:
- skip_ansible_lint # E301

- name: Fail if current node UUID is empty
ansible.builtin.fail: msg="Execute this playbook on the active host"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
args:
executable: /usr/bin/bash
register: host_count
tags:
- skip_ansible_lint # E301

- name: Get the number of hostname in the peer output
ansible.builtin.shell: |
Expand All @@ -33,8 +31,6 @@
args:
executable: /usr/bin/bash
register: hostname_count
tags:
- skip_ansible_lint # E301

- name: Check if Parsed hosts are Ipv4 or not
ansible.builtin.shell: |
Expand All @@ -43,8 +39,6 @@
args:
executable: /usr/bin/bash
register: isipv4
tags:
- skip_ansible_lint # E301

- name: Check if Parsed hosts are IPv6 or not
ansible.builtin.shell: >
Expand All @@ -55,8 +49,6 @@
args:
executable: /usr/bin/bash
register: isipv6
tags:
- skip_ansible_lint # E301

- name: Check if gluster is configured as another network
block:
Expand All @@ -67,8 +59,6 @@
grep -A1 -B1 {{ gluster_old_node | mandatory }} |
grep -v {{ gluster_old_node }} | grep hostname | sed -n -e 's/^.*'='//p'
register: old_node_temp
tags:
- skip_ansible_lint # E301

- name: Fetch the maintenance host's hostname from the ip
ansible.builtin.shell: >
Expand All @@ -89,8 +79,6 @@
register: cluster_node_2_temp
delegate_to: "{{ gluster_cluster_node | mandatory }}"
connection: ssh
tags:
- skip_ansible_lint # E301

- name: Store the HostName's
ansible.builtin.set_fact:
Expand All @@ -105,5 +93,3 @@
when: gluster_maintenance_old_node == gluster_maintenance_new_node

when: host_count.stdout != hostname_count.stdout and isipv4.stdout == "true" or isipv6.stdout == "true"
tags:
- skip_ansible_lint # E301
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
- name: Get the list of volumes on the machine
ansible.builtin.command: ls "{{ glusterd_libdir }}/vols"
register: dir_list
tags:
- skip_ansible_lint # E301

- name: Setting Facts for Volume
ansible.builtin.set_fact:
Expand All @@ -21,12 +19,8 @@
awk -F: '{ print $2 }'
with_items: "{{ volumes }}"
register: brick_list
tags:
- skip_ansible_lint # E301
delegate_to: "{{ gluster_cluster_node }}"
connection: ssh
tags:
- skip_ansible_lint # E301

- name: Run replace-brick commit on the brick
connection: ssh
Expand All @@ -41,5 +35,3 @@
- "{{ brick_list.results }}"
- stdout_lines
delegate_to: "{{ gluster_new_node }}"
tags:
- skip_ansible_lint # E301
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@
register: measurement_result
become: true
become_user: vdsm
tags:
- skip_ansible_lint # E301

0 comments on commit a0539d4

Please sign in to comment.