Skip to content

Commit

Permalink
Fix "fqcn-builtins" violations.
Browse files Browse the repository at this point in the history
FQCN stands for "Fully Qualified Collection Name".
Adding the missing "ansible.builtin." prefix.
Fixing 54 violations:
  fqcn-builtins: Use FQCN for builtin actions.

Signed-off-by: Pavel Bar <[email protected]>
Bug-Url: https://bugzilla.redhat.com/2097332
  • Loading branch information
barpavel committed Jul 2, 2022
1 parent bd04efc commit 50e7af0
Show file tree
Hide file tree
Showing 21 changed files with 61 additions and 55 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 fqcn-builtins,no-changed-when,ignore-errors roles/disaster_recovery roles/remove_stale_lun
ansible-lint -x no-changed-when,ignore-errors roles/disaster_recovery roles/remove_stale_lun

cd "$ROOT_PATH"

Expand Down
6 changes: 3 additions & 3 deletions roles/disaster_recovery/tasks/clean/remove_domain_process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
# We set an initial value for sp_uuid since this task is being called
# multiple times from the main task and sp_uuid is stateful.
- name: Set default boolean value for sp_uuid
set_fact: sp_uuid=True
ansible.builtin.set_fact: sp_uuid=True

- name: Detached storage domain - Set sp_uuid with empty GUID
set_fact: sp_uuid="00000000-0000-0000-0000-000000000000"
ansible.builtin.set_fact: sp_uuid="00000000-0000-0000-0000-000000000000"
when: sd.data_centers is not defined

- name: Detached storage domain - Fetch active host for remove
Expand All @@ -31,7 +31,7 @@
# If sp_uuid is still initiated with the default boolean value,
# that means that there is a data center which the storage domain is attached to it.
- name: Attached storage domain - Set sp_uuid
set_fact: sp_uuid="{{ sd.data_centers[0].id }}"
ansible.builtin.set_fact: sp_uuid="{{ sd.data_centers[0].id }}"
when: sp_uuid

- name: Remove storage domain with no force
Expand Down
14 changes: 7 additions & 7 deletions roles/disaster_recovery/tasks/clean_engine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@
loop_var: storage

- name: Set force remove flag to false for non master domains
set_fact: dr_force=False
ansible.builtin.set_fact: dr_force=False

# Set all the queries suffix to fetch a storage domain in a specific status.
# Note: Export storage domain is not supported and should not be part of storage mapping
- name: Setup queries for storage domains
set_fact:
ansible.builtin.set_fact:
dr_active_domain_search='status = active and type != cinder'
dr_maintenance_domain_search='status = maintenance and type != cinder'
dr_unattached_domain_search='status = unattached and type != cinder and type != glance'
dr_inactive_domain_search='type != glance and type != cinder and status != active'

- name: Set master storage domain filter
set_fact: only_master=False
ansible.builtin.set_fact: only_master=False

- name: Remove non master storage domains with valid statuses
include_tasks: clean/remove_valid_filtered_master_domains.yml
Expand All @@ -47,7 +47,7 @@
# We use inactive filter only at the end, since we are not sure if there were any storage domains
# which became inactive on the process or if there were any at the beginning.
- name: Set force remove flag to true for non master storage domains
set_fact: dr_force=True
ansible.builtin.set_fact: dr_force=True

- name: Remove non master storage domains with invalid statuses using force remove
include_tasks: clean/remove_invalid_filtered_master_domains.yml
Expand All @@ -57,10 +57,10 @@
loop_var: storage

- name: Set master storage domain filter
set_fact: only_master=True
ansible.builtin.set_fact: only_master=True

- name: Set force remove flag to false for master domain
set_fact: dr_force=False
ansible.builtin.set_fact: dr_force=False

- name: Remove master storage domains with valid statuses
include_tasks: clean/remove_valid_filtered_master_domains.yml
Expand All @@ -70,7 +70,7 @@
loop_var: storage

- name: Set force remove flag to true for master domain
set_fact: dr_force=True
ansible.builtin.set_fact: dr_force=True

- name: Remove master storage domains with invalid statuses using force remove
include_tasks: clean/remove_invalid_filtered_master_domains.yml
Expand Down
8 changes: 7 additions & 1 deletion roles/disaster_recovery/tasks/generate_mapping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
- name: Generate mapping var file main block
block:
- name: Generate mapping var file
command: python3 {{ role_path }}/files/generate_mapping.py -a "{{ site }}" -u "{{ username }}" -p "{{ password }}" -c "{{ ca }}" -f "{{ var_file }}"
ansible.builtin.command: >-
python3 {{ role_path }}/files/generate_mapping.py
-a {{ site }}
-u {{ username }}
-p {{ password }}
-c {{ ca }}
-f {{ var_file }}
run_once: true
tags:
- generate_mapping
2 changes: 1 addition & 1 deletion roles/disaster_recovery/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
- clean_engine

- name: Failback Replication Sync pause
pause:
ansible.builtin.pause:
prompt: "[Failback Replication Sync] Please press ENTER once the destination storage domains are ready to be used for the destination setup"
tags:
- fail_back
Expand Down
2 changes: 1 addition & 1 deletion roles/disaster_recovery/tasks/recover/add_domain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
- name: Check for available hosts block
block:
- name: "Check for available hosts"
fail: msg="No hosts available"
ansible.builtin.fail: msg="No hosts available"
when: host_info.ovirt_hosts.0 is undefined

- name: Add storage domain block
Expand Down
4 changes: 2 additions & 2 deletions roles/disaster_recovery/tasks/recover/add_fcp_domain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
register: result

- name: Log append to succeed_storage_domains
set_fact:
ansible.builtin.set_fact:
succeed_storage_domains: "{{ succeed_storage_domains }} + [ \"{{ fcp_storage['dr_' + dr_target_host + '_name'] | default('') }}\" ]"
when: result is succeeded

- name: Log append to failed_storage_domains
set_fact:
ansible.builtin.set_fact:
failed_storage_domains: "{{ failed_storage_domains }} + [ \"{{ fcp_storage['dr_' + dr_target_host + '_name'] | default('') }}\" ]"
when: result is failed
ignore_errors: "{{ dr_ignore_error_recover }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
register: result

- name: Log append to succeed_storage_domains
set_fact:
ansible.builtin.set_fact:
succeed_storage_domains: "{{ succeed_storage_domains }} + [ \"{{ gluster_storage['dr_' + dr_target_host + '_name'] }}\" ]"
when: result is succeeded

- name: Log append to failed_storage_domains
set_fact:
ansible.builtin.set_fact:
failed_storage_domains: "{{ failed_storage_domains }} + [ \"{{ gluster_storage['dr_' + dr_target_host + '_name'] }}\" ]"
when: result is failed
ignore_errors: "{{ dr_ignore_error_recover }}"
Expand Down
4 changes: 2 additions & 2 deletions roles/disaster_recovery/tasks/recover/add_iscsi_domain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@
loop_control:
loop_var: dr_target
- name: Log append to succeed_storage_domains
set_fact:
ansible.builtin.set_fact:
succeed_storage_domains: "{{ succeed_storage_domains }} + [ \"{{ iscsi_storage['dr_' + dr_target_host + '_name'] | default('') }}\" ]"
rescue:
- name: Log append to failed_storage_domains
set_fact:
ansible.builtin.set_fact:
failed_storage_domains: "{{ failed_storage_domains }} + [ \"{{ iscsi_storage['dr_' + dr_target_host + '_name'] | default('') }}\" ]"
ignore_errors: "{{ dr_ignore_error_recover }}"
tags:
Expand Down
4 changes: 2 additions & 2 deletions roles/disaster_recovery/tasks/recover/add_nfs_domain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
path: "{{ nfs_storage['dr_' + dr_target_host + '_path'] }}"
address: "{{ nfs_storage['dr_' + dr_target_host + '_address'] }}"
- name: Log append to successful storage domains
set_fact:
ansible.builtin.set_fact:
succeed_storage_domains: "{{ succeed_storage_domains }} + [ \"{{ nfs_storage['dr_' + dr_target_host + '_name'] }}\" ]"

rescue:
- name: Log append to failed storage domains
set_fact:
ansible.builtin.set_fact:
failed_storage_domains: "{{ failed_storage_domains }} + [ \"{{ nfs_storage['dr_' + dr_target_host + '_name'] }}\" ]"
ignore_errors: "{{ dr_ignore_error_recover }}"
tags:
Expand Down
4 changes: 2 additions & 2 deletions roles/disaster_recovery/tasks/recover/add_posixfs_domain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
register: result

- name: Log append to succeed_storage_domains
set_fact:
ansible.builtin.set_fact:
succeed_storage_domains: "{{ succeed_storage_domains }} + [ \"{{ posix_storage['dr_' + dr_target_host + '_name'] }}\" ]"
when: result is succeeded

- name: Log append to failed_storage_domains
set_fact:
ansible.builtin.set_fact:
failed_storage_domains: "{{ failed_storage_domains }} + [ \"{{ posix_storage['dr_' + dr_target_host + '_name'] }}\" ]"
when: result is failed
ignore_errors: "{{ dr_ignore_error_recover }}"
Expand Down
6 changes: 3 additions & 3 deletions roles/disaster_recovery/tasks/recover/print_info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
- name: Print report file main block
block:
- name: Generate log file through template
template:
ansible.builtin.template:
src: report_log_template.j2
dest: /tmp/{{ dr_report_file }}
mode: preserve

- name: Print report file
command: cat /tmp/{{ dr_report_file }}
ansible.builtin.command: cat /tmp/{{ dr_report_file }}
register: content

- name: Print report file to stdout
debug: msg="{{ content.stdout_lines | quote }}"
ansible.builtin.debug: msg="{{ content.stdout_lines | quote }}"
tags:
- fail_over
- fail_back
4 changes: 2 additions & 2 deletions roles/disaster_recovery/tasks/recover/register_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
register: template_register_result

- name: Log append failed template to failed_template_names
set_fact:
ansible.builtin.set_fact:
failed_template_names: "{{ failed_template_names }} + [ '{{ unreg_template.name }}' ]"
when: template_register_result is failed

- name: Log append succeeded template succeed_template_names
set_fact:
ansible.builtin.set_fact:
succeed_template_names: "{{ succeed_template_names }} + [ '{{ unreg_template.name }}' ]"
when: template_register_result is succeeded
ignore_errors: "{{ dr_ignore_error_recover }}"
Expand Down
4 changes: 2 additions & 2 deletions roles/disaster_recovery/tasks/recover/register_vm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
register: vm_register_result

- name: Log append failed VM to failed_vm_names
set_fact:
ansible.builtin.set_fact:
failed_vm_names: "{{ failed_vm_names }} + [ '{{ unreg_vm.name }}' ]"
when: vm_register_result is failed

- name: Log append succeeded VM to succeed_vm_names
set_fact:
ansible.builtin.set_fact:
succeed_vm_names: "{{ succeed_vm_names }} + [ '{{ unreg_vm.name }}' ]"
when: vm_register_result is succeeded
ignore_errors: "{{ dr_ignore_error_recover }}"
Expand Down
2 changes: 1 addition & 1 deletion roles/disaster_recovery/tasks/recover/register_vms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
register: storage_vm_info

- name: Set unregistered VMs
set_fact:
ansible.builtin.set_fact:
unreg_vms: "{{ unreg_vms | default([]) + storage_vm_info.ovirt_storage_vms }}"

# TODO: We should filter out VMs which already exist in the setup (diskless VMs)
Expand Down
4 changes: 2 additions & 2 deletions roles/disaster_recovery/tasks/recover/run_vms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
auth: "{{ ovirt_auth }}"
register: result
- name: Log append succeed_to_run_vms
set_fact:
ansible.builtin.set_fact:
succeed_to_run_vms: "{{ succeed_to_run_vms }} + [ '{{ vms.name }}' ]"
when: result is succeeded

- name: Log append failed_to_run_vms
set_fact:
ansible.builtin.set_fact:
failed_to_run_vms: "{{ failed_to_run_vms }} + [ '{{ vms.name }}' ]"
when: result is failed
ignore_errors: "{{ dr_ignore_error_recover }}"
Expand Down
22 changes: 11 additions & 11 deletions roles/disaster_recovery/tasks/recover_engine.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@
ignore_errors: false

- name: Delete previous report log
file:
ansible.builtin.file:
path: "/tmp/{{ dr_report_file }}"
state: absent
ignore_errors: true

- name: Create report file
file:
ansible.builtin.file:
path: "/tmp/{{ dr_report_file }}"
state: touch
mode: 0644

- name: Init entity status list
set_fact:
ansible.builtin.set_fact:
failed_vm_names: []
succeed_vm_names: []
failed_template_names: []
Expand Down Expand Up @@ -67,7 +67,7 @@
register: storage_domain_info

- name: Set initial Maps
set_fact:
ansible.builtin.set_fact:
dr_cluster_map: "{{ [] }}"
dr_affinity_group_map: "{{ [] }}"
dr_affinity_label_map: "{{ [] }}"
Expand All @@ -77,7 +77,7 @@
dr_network_map: "{{ [] }}"

- name: Set Cluster Map
set_fact:
ansible.builtin.set_fact:
dr_cluster_map: "{{ dr_cluster_map + [
{
'source_name': item[dr_source_map + '_name'] | default('EMPTY_ELEMENT', true),
Expand All @@ -88,7 +88,7 @@
when: dr_cluster_mappings is not none

- name: Set Affinity Group Map
set_fact:
ansible.builtin.set_fact:
dr_affinity_group_map: "{{ dr_affinity_group_map + [
{
'source_name': item[dr_source_map + '_name'] | default('EMPTY_ELEMENT', true),
Expand All @@ -99,7 +99,7 @@
when: dr_affinity_group_mappings is not none

- name: Set Network Map
set_fact:
ansible.builtin.set_fact:
dr_network_map: "{{ dr_network_map + [
{
'source_network_name': item[dr_source_map + '_network_name'] | default('EMPTY_ELEMENT', true),
Expand All @@ -112,7 +112,7 @@
when: dr_network_mappings is not none

- name: Set Affinity Label Map
set_fact:
ansible.builtin.set_fact:
dr_affinity_label_map: "{{ dr_affinity_label_map + [
{
'source_name': item[dr_source_map + '_name'] | default('EMPTY_ELEMENT', true),
Expand All @@ -123,7 +123,7 @@
when: dr_affinity_label_mappings is not none

- name: Set aaa extensions Map
set_fact:
ansible.builtin.set_fact:
dr_domain_map: "{{ dr_domain_map + [
{
'source_name': item[dr_source_map + '_name'] | default('EMPTY_ELEMENT', true),
Expand All @@ -134,7 +134,7 @@
when: dr_domain_mappings is not none

- name: Set Role Map
set_fact:
ansible.builtin.set_fact:
dr_role_map: "{{ dr_role_map + [
{
'source_name': item[dr_source_map + '_name'] | default('EMPTY_ELEMENT', true),
Expand All @@ -145,7 +145,7 @@
when: dr_role_mappings is not none

- name: Set Lun Map
set_fact:
ansible.builtin.set_fact:
dr_lun_map: "{{ dr_lun_map + [
{
'source_logical_unit_id': item[dr_source_map + '_logical_unit_id'] | default('EMPTY_ELEMENT', true),
Expand Down
4 changes: 2 additions & 2 deletions roles/disaster_recovery/tasks/run_unregistered_entities.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
ca_file: "{{ vars['dr_sites_' + dr_target_host + '_ca_file'] }}"

- name: Read file that contains running VMs from the previous setup
set_fact: running_vms_fail_back="{{ lookup('file', dr_running_vms) }}"
ansible.builtin.set_fact: running_vms_fail_back="{{ lookup('file', dr_running_vms) }}"

- name: Remove dr_running_vms file after being used
file:
ansible.builtin.file:
path: "{{ dr_running_vms }}"
state: absent

Expand Down
Loading

0 comments on commit 50e7af0

Please sign in to comment.