From 9033a133fb8540de436766e97b34984fee43a4c1 Mon Sep 17 00:00:00 2001 From: Evgeni Golov Date: Wed, 29 May 2024 12:14:45 +0200 Subject: [PATCH] make ansible-lint happy --- .ansible-lint | 1 + .yamllint | 33 -------- plugins/modules/activation_key.py | 8 +- plugins/modules/compute_profile.py | 80 +++++++++---------- plugins/modules/compute_resource.py | 1 - plugins/modules/content_export_info.py | 1 - plugins/modules/content_export_version.py | 34 ++++---- plugins/modules/content_view_filter_info.py | 1 - .../modules/content_view_filter_rule_info.py | 1 - plugins/modules/host.py | 36 ++++----- plugins/modules/host_power.py | 6 +- plugins/modules/job_template.py | 1 - plugins/modules/partition_table.py | 1 - plugins/modules/provisioning_template.py | 1 - plugins/modules/repository_set.py | 32 ++++---- plugins/modules/subnet.py | 8 +- plugins/modules/user.py | 1 - plugins/modules/wait_for_task.py | 6 +- 18 files changed, 105 insertions(+), 147 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index c1619cb06..671656b1b 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -8,5 +8,6 @@ only_builtins_allow_collections: - theforeman.foreman exclude_paths: - meta/runtime.yml + - plugins/inventory/foreman.py - tests/ - .github/ diff --git a/.yamllint b/.yamllint index aeaa9155c..8ab59a83b 100644 --- a/.yamllint +++ b/.yamllint @@ -1,39 +1,6 @@ --- -# Based on ansible-lint config -extends: default - rules: - braces: - max-spaces-inside: 1 - level: error - brackets: - max-spaces-inside: 1 - level: error - colons: - max-spaces-after: -1 - level: error - commas: - max-spaces-after: -1 - level: error - comments: disable - comments-indentation: disable - document-start: - present: true - empty-lines: - max: 3 - level: error - - hyphens: - level: error - indentation: {spaces: 2, indent-sequences: consistent} - key-duplicates: enable line-length: disable - new-line-at-end-of-file: disable - new-lines: - type: unix - trailing-spaces: enable - truthy: - level: error ignore: | tests/test_playbooks/fixtures/ diff --git a/plugins/modules/activation_key.py b/plugins/modules/activation_key.py index 25f7a6e4e..7a6836420 100644 --- a/plugins/modules/activation_key.py +++ b/plugins/modules/activation_key.py @@ -171,11 +171,11 @@ lifecycle_environment: "Library" content_view: 'client content view' host_collections: - - rhel7-servers - - rhel7-production + - rhel7-servers + - rhel7-production content_overrides: - - label: rhel-7-server-optional-rpms - override: enabled + - label: rhel-7-server-optional-rpms + override: enabled auto_attach: false release_version: 7Server service_level: Standard diff --git a/plugins/modules/compute_profile.py b/plugins/modules/compute_profile.py index 5f87fdf22..56949c8e3 100644 --- a/plugins/modules/compute_profile.py +++ b/plugins/modules/compute_profile.py @@ -73,11 +73,11 @@ theforeman.foreman.compute_profile: name: another_example_compute_profile compute_attributes: - - compute_resource: ovirt_compute_resource1 - vm_attrs: - cluster: 'a96d44a4-f14a-1015-82c6-f80354acdf01' - template: 'c88af4b7-a24a-453b-9ac2-bc647ca2ef99' - instance_type: 'cb8927e7-a404-40fb-a6c1-06cbfc92e077' + - compute_resource: ovirt_compute_resource1 + vm_attrs: + cluster: 'a96d44a4-f14a-1015-82c6-f80354acdf01' + template: 'c88af4b7-a24a-453b-9ac2-bc647ca2ef99' + instance_type: 'cb8927e7-a404-40fb-a6c1-06cbfc92e077' server_url: "https://foreman.example.com" username: "admin" password: "changeme" @@ -87,41 +87,41 @@ theforeman.foreman.compute_profile: name: example_compute_profile2 compute_attributes: - - compute_resource: ovirt_compute_resource01 - vm_attrs: - cluster: a96d44a4-f14a-1015-82c6-f80354acdf01 - cores: 1 - sockets: 1 - memory: 1073741824 - ha: 0 - interfaces_attributes: - 0: - name: "" - network: 390666e1-dab3-4c99-9f96-006b2e2fd801 - interface: virtio - volumes_attributes: - 0: - size_gb: 16 - storage_domain: 19c50090-1ab4-4023-a63f-75ee1018ed5e - preallocate: '1' - wipe_after_delete: '0' - interface: virtio_scsi - bootable: 'true' - - compute_resource: libvirt_compute_resource03 - vm_attrs: - cpus: 1 - memory: 2147483648 - nics_attributes: - 0: - type: bridge - bridge: "" - model: virtio - volumes_attributes: - 0: - pool_name: default - capacity: 16G - allocation: 16G - format_type: raw + - compute_resource: ovirt_compute_resource01 + vm_attrs: + cluster: a96d44a4-f14a-1015-82c6-f80354acdf01 + cores: 1 + sockets: 1 + memory: 1073741824 + ha: 0 + interfaces_attributes: + 0: + name: "" + network: 390666e1-dab3-4c99-9f96-006b2e2fd801 + interface: virtio + volumes_attributes: + 0: + size_gb: 16 + storage_domain: 19c50090-1ab4-4023-a63f-75ee1018ed5e + preallocate: '1' + wipe_after_delete: '0' + interface: virtio_scsi + bootable: 'true' + - compute_resource: libvirt_compute_resource03 + vm_attrs: + cpus: 1 + memory: 2147483648 + nics_attributes: + 0: + type: bridge + bridge: "" + model: virtio + volumes_attributes: + 0: + pool_name: default + capacity: 16G + allocation: 16G + format_type: raw server_url: "https://foreman.example.com" username: "admin" password: "changeme" diff --git a/plugins/modules/compute_resource.py b/plugins/modules/compute_resource.py index ff8ff5f32..700180fd1 100644 --- a/plugins/modules/compute_resource.py +++ b/plugins/modules/compute_resource.py @@ -379,7 +379,6 @@ username: "admin" password: "changeme" state: present - ''' RETURN = ''' diff --git a/plugins/modules/content_export_info.py b/plugins/modules/content_export_info.py index 4c3e7e2c5..7a68c8b08 100644 --- a/plugins/modules/content_export_info.py +++ b/plugins/modules/content_export_info.py @@ -119,7 +119,6 @@ password: "changeme" server_url: "https://foreman.example.com" organization: "Default Organization" - ''' from ansible_collections.theforeman.foreman.plugins.module_utils.foreman_helper import KatelloInfoAnsibleModule diff --git a/plugins/modules/content_export_version.py b/plugins/modules/content_export_version.py index 12a3e1105..2d034b8f2 100644 --- a/plugins/modules/content_export_version.py +++ b/plugins/modules/content_export_version.py @@ -90,26 +90,26 @@ - name: "Export content view version (incremental) since the most recent export" theforeman.foreman.content_export_version: - content_view: RHEL8 - content_view_version: '1.0' - username: "admin" - password: "changeme" - server_url: "https://foreman.example.com" - organization: "Default Organization" - destination_server: "airgapped.example.com" - incremental: true + content_view: RHEL8 + content_view_version: '1.0' + username: "admin" + password: "changeme" + server_url: "https://foreman.example.com" + organization: "Default Organization" + destination_server: "airgapped.example.com" + incremental: true - name: "Export content view version (incremental) since a specific export" theforeman.foreman.content_export_version: - content_view: RHEL8 - content_view_version: '1.0' - username: "admin" - password: "changeme" - server_url: "https://foreman.example.com" - organization: "Default Organization" - destination_server: "airgapped.example.com" - incremental: true - from_history_id: 12345 + content_view: RHEL8 + content_view_version: '1.0' + username: "admin" + password: "changeme" + server_url: "https://foreman.example.com" + organization: "Default Organization" + destination_server: "airgapped.example.com" + incremental: true + from_history_id: 12345 ''' from ansible_collections.theforeman.foreman.plugins.module_utils.foreman_helper import KatelloContentExportBaseModule diff --git a/plugins/modules/content_view_filter_info.py b/plugins/modules/content_view_filter_info.py index 49bb4e2d1..a08284d81 100644 --- a/plugins/modules/content_view_filter_info.py +++ b/plugins/modules/content_view_filter_info.py @@ -48,7 +48,6 @@ server_url: "https://foreman.example.com" content_view: "SOE_RHEL9" name: "AllRPMNoErrata" - ''' RETURN = ''' diff --git a/plugins/modules/content_view_filter_rule_info.py b/plugins/modules/content_view_filter_rule_info.py index 83e43b28a..788031ab5 100644 --- a/plugins/modules/content_view_filter_rule_info.py +++ b/plugins/modules/content_view_filter_rule_info.py @@ -58,7 +58,6 @@ content_view: "SOE_RHEL9" content_view_filter: "NoFireFox" name: firefox - ''' RETURN = ''' diff --git a/plugins/modules/host.py b/plugins/modules/host.py index e0da3bbf3..76764ecfb 100644 --- a/plugins/modules/host.py +++ b/plugins/modules/host.py @@ -327,11 +327,11 @@ server_url: "https://foreman.example.com" name: "new_host" interfaces_attributes: - - type: "interface" - compute_attributes: - name: "nic1" - network: "969efbe6-f9e0-4383-a19a-a7ee65ad5007" - interface: "virtio" + - type: "interface" + compute_attributes: + name: "nic1" + network: "969efbe6-f9e0-4383-a19a-a7ee65ad5007" + interface: "virtio" state: present - name: "Create a VM with 2 NICs on specific ovirt networks" @@ -341,19 +341,19 @@ server_url: "https://foreman.example.com" name: "new_host" interfaces_attributes: - - type: "interface" - primary: true - compute_attributes: - name: "nic1" - network: "969efbe6-f9e0-4383-a19a-a7ee65ad5007" - interface: "virtio" - - type: "interface" - name: "new_host_nic2" - managed: true - compute_attributes: - name: "nic2" - network: "969efbe6-f9e0-4383-a19a-a7ee65ad5008" - interface: "e1000" + - type: "interface" + primary: true + compute_attributes: + name: "nic1" + network: "969efbe6-f9e0-4383-a19a-a7ee65ad5007" + interface: "virtio" + - type: "interface" + name: "new_host_nic2" + managed: true + compute_attributes: + name: "nic2" + network: "969efbe6-f9e0-4383-a19a-a7ee65ad5008" + interface: "e1000" state: present - name: "Delete a host" diff --git a/plugins/modules/host_power.py b/plugins/modules/host_power.py index c594f04f5..47cdccea1 100644 --- a/plugins/modules/host_power.py +++ b/plugins/modules/host_power.py @@ -63,7 +63,7 @@ password: "changeme" server_url: "https://foreman.example.com" hostname: "test-host.domain.test" - state: on + state: 'on' - name: "Switch a host off" theforeman.foreman.host_power: @@ -71,7 +71,7 @@ password: "changeme" server_url: "https://foreman.example.com" hostname: "test-host.domain.test" - state: off + state: 'off' - name: "Query host power state" theforeman.foreman.host_power: @@ -83,8 +83,6 @@ register: result - debug: msg: "Host power state is {{ result.power_state }}" - - ''' RETURN = ''' diff --git a/plugins/modules/job_template.py b/plugins/modules/job_template.py index 57ed1577e..905db8fb9 100644 --- a/plugins/modules/job_template.py +++ b/plugins/modules/job_template.py @@ -279,7 +279,6 @@ - DALEK INC - sky.net - Doc Brown's garage - ''' RETURN = ''' diff --git a/plugins/modules/partition_table.py b/plugins/modules/partition_table.py index 669a74dd1..b9e5d94f4 100644 --- a/plugins/modules/partition_table.py +++ b/plugins/modules/partition_table.py @@ -175,7 +175,6 @@ - DALEK INC - sky.net - Doc Brown's garage - ''' RETURN = ''' diff --git a/plugins/modules/provisioning_template.py b/plugins/modules/provisioning_template.py index e47da4d6a..6a8ee649c 100644 --- a/plugins/modules/provisioning_template.py +++ b/plugins/modules/provisioning_template.py @@ -202,7 +202,6 @@ - DALEK INC - sky.net - Doc Brown's garage - ''' RETURN = ''' diff --git a/plugins/modules/repository_set.py b/plugins/modules/repository_set.py index b442befef..ff21fd872 100644 --- a/plugins/modules/repository_set.py +++ b/plugins/modules/repository_set.py @@ -91,14 +91,14 @@ organization: "Default Organization" product: "Red Hat Enterprise Linux Server" repositories: - - releasever: "7.0" - basearch: "x86_64" - - releasever: "7.1" - basearch: "x86_64" - - releasever: "7.2" - basearch: "x86_64" - - releasever: "7.3" - basearch: "x86_64" + - releasever: "7.0" + basearch: "x86_64" + - releasever: "7.1" + basearch: "x86_64" + - releasever: "7.2" + basearch: "x86_64" + - releasever: "7.3" + basearch: "x86_64" state: enabled - name: "Enable RHEL 7 RPMs repositories with label" @@ -109,14 +109,14 @@ organization: "Default Organization" label: rhel-7-server-rpms repositories: - - releasever: "7.0" - basearch: "x86_64" - - releasever: "7.1" - basearch: "x86_64" - - releasever: "7.2" - basearch: "x86_64" - - releasever: "7.3" - basearch: "x86_64" + - releasever: "7.0" + basearch: "x86_64" + - releasever: "7.1" + basearch: "x86_64" + - releasever: "7.2" + basearch: "x86_64" + - releasever: "7.3" + basearch: "x86_64" state: enabled - name: "Disable RHEL 7 Extras RPMs repository" diff --git a/plugins/modules/subnet.py b/plugins/modules/subnet.py index a79c9e7b9..b48e55fe1 100644 --- a/plugins/modules/subnet.py +++ b/plugins/modules/subnet.py @@ -187,12 +187,12 @@ vlanid: 452 mtu: 9000 domains: - - "foo.example.com" - - "bar.example.com" + - "foo.example.com" + - "bar.example.com" organizations: - - "Example Org" + - "Example Org" locations: - - "Toulouse" + - "Toulouse" server_url: "https://foreman.example.com" username: "admin" password: "changeme" diff --git a/plugins/modules/user.py b/plugins/modules/user.py index 535b17a98..53e6228f8 100644 --- a/plugins/modules/user.py +++ b/plugins/modules/user.py @@ -309,7 +309,6 @@ theforeman.foreman.user: name: test user_password: newp@ss - ''' RETURN = ''' diff --git a/plugins/modules/wait_for_task.py b/plugins/modules/wait_for_task.py index ecca4a821..1b7bde1f0 100644 --- a/plugins/modules/wait_for_task.py +++ b/plugins/modules/wait_for_task.py @@ -47,7 +47,7 @@ EXAMPLES = ''' - name: Wait for a task to finish theforeman.foreman.wait_for_task: - server_url: "https://foreman.example.com" + server_url: "https://foreman.example.com" password: changeme username: admin task: a03ba49f-4dc2-4ad6-a48b-b271b46f3347 @@ -55,7 +55,7 @@ - name: Sarch for previously created tasks resource_info: - server_url: "https://foreman.example.com" + server_url: "https://foreman.example.com" password: changeme username: admin resource: foreman_tasks @@ -64,7 +64,7 @@ - name: Wait for all found tasks to finish wait_for_task: - server_url: "https://foreman.example.com" + server_url: "https://foreman.example.com" password: changeme username: admin task: "{{ item }}"