From 69ca89858c9a36cdde9d262ca5361dfec8c89b7d Mon Sep 17 00:00:00 2001 From: Zim Kalinowski Date: Thu, 4 Apr 2019 12:24:03 +0800 Subject: [PATCH] Renaming azure_rm_managed_disk for consistency (#54825) --- lib/ansible/config/module_defaults.yml | 4 +- .../cloud/azure/_azure_rm_managed_disk.py | 1 + .../azure/_azure_rm_managed_disk_facts.py | 1 + ...anaged_disk.py => azure_rm_manageddisk.py} | 15 +++-- ...facts.py => azure_rm_manageddisk_facts.py} | 13 ++-- .../targets/azure_rm_image/tasks/main.yml | 4 +- .../aliases | 1 + .../meta/main.yml | 0 .../tasks/main.yml | 64 +++++++++---------- test/sanity/validate-modules/ignore.txt | 2 +- 10 files changed, 57 insertions(+), 48 deletions(-) create mode 120000 lib/ansible/modules/cloud/azure/_azure_rm_managed_disk.py create mode 120000 lib/ansible/modules/cloud/azure/_azure_rm_managed_disk_facts.py rename lib/ansible/modules/cloud/azure/{azure_rm_managed_disk.py => azure_rm_manageddisk.py} (98%) rename lib/ansible/modules/cloud/azure/{azure_rm_managed_disk_facts.py => azure_rm_manageddisk_facts.py} (95%) rename test/integration/targets/{azure_rm_managed_disk => azure_rm_manageddisk}/aliases (67%) rename test/integration/targets/{azure_rm_managed_disk => azure_rm_manageddisk}/meta/main.yml (100%) rename test/integration/targets/{azure_rm_managed_disk => azure_rm_manageddisk}/tasks/main.yml (93%) diff --git a/lib/ansible/config/module_defaults.yml b/lib/ansible/config/module_defaults.yml index bbedb2e4be..4202694c25 100644 --- a/lib/ansible/config/module_defaults.yml +++ b/lib/ansible/config/module_defaults.yml @@ -524,9 +524,9 @@ groupings: - azure azure_rm_loadbalancer_facts: - azure - azure_rm_managed_disk: + azure_rm_manageddisk: - azure - azure_rm_managed_disk_facts: + azure_rm_manageddisk_facts: - azure azure_rm_mysqldatabase: - azure diff --git a/lib/ansible/modules/cloud/azure/_azure_rm_managed_disk.py b/lib/ansible/modules/cloud/azure/_azure_rm_managed_disk.py new file mode 120000 index 0000000000..ccccd42483 --- /dev/null +++ b/lib/ansible/modules/cloud/azure/_azure_rm_managed_disk.py @@ -0,0 +1 @@ +azure_rm_manageddisk.py \ No newline at end of file diff --git a/lib/ansible/modules/cloud/azure/_azure_rm_managed_disk_facts.py b/lib/ansible/modules/cloud/azure/_azure_rm_managed_disk_facts.py new file mode 120000 index 0000000000..c752929d4b --- /dev/null +++ b/lib/ansible/modules/cloud/azure/_azure_rm_managed_disk_facts.py @@ -0,0 +1 @@ +azure_rm_manageddisk_facts.py \ No newline at end of file diff --git a/lib/ansible/modules/cloud/azure/azure_rm_managed_disk.py b/lib/ansible/modules/cloud/azure/azure_rm_manageddisk.py similarity index 98% rename from lib/ansible/modules/cloud/azure/azure_rm_managed_disk.py rename to lib/ansible/modules/cloud/azure/azure_rm_manageddisk.py index f5a0f05b1c..599a275549 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_managed_disk.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_manageddisk.py @@ -15,7 +15,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', DOCUMENTATION = ''' --- -module: azure_rm_managed_disk +module: azure_rm_manageddisk version_added: "2.4" @@ -24,6 +24,9 @@ short_description: Manage Azure Manage Disks description: - Create, update and delete an Azure Managed Disk +notes: + - This module was called C(azure_rm_managed_disk) before Ansible 2.8. The usage did not change. + options: resource_group: description: @@ -112,14 +115,14 @@ author: EXAMPLES = ''' - name: Create managed disk - azure_rm_managed_disk: + azure_rm_manageddisk: name: mymanageddisk location: eastus resource_group: myResourceGroup disk_size_gb: 4 - name: Create managed operating system disk from page blob - azure_rm_managed_disk: + azure_rm_manageddisk: name: mymanageddisk location: eastus2 resource_group: myResourceGroup @@ -129,7 +132,7 @@ EXAMPLES = ''' storage_account_type: Premium_LRS - name: Mount the managed disk to VM - azure_rm_managed_disk: + azure_rm_manageddisk: name: mymanageddisk location: eastus resource_group: myResourceGroup @@ -137,7 +140,7 @@ EXAMPLES = ''' managed_by: testvm001 - name: Unmount the managed disk to VM - azure_rm_managed_disk: + azure_rm_manageddisk: name: mymanageddisk location: eastus resource_group: myResourceGroup @@ -178,7 +181,7 @@ except ImportError: pass -# duplicated in azure_rm_managed_disk_facts +# duplicated in azure_rm_manageddisk_facts def managed_disk_to_dict(managed_disk): create_data = managed_disk.creation_data return dict( diff --git a/lib/ansible/modules/cloud/azure/azure_rm_managed_disk_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_manageddisk_facts.py similarity index 95% rename from lib/ansible/modules/cloud/azure/azure_rm_managed_disk_facts.py rename to lib/ansible/modules/cloud/azure/azure_rm_manageddisk_facts.py index 05e15ad27d..41ef9d7c58 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_managed_disk_facts.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_manageddisk_facts.py @@ -14,7 +14,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', DOCUMENTATION = r''' --- -module: azure_rm_managed_disk_facts +module: azure_rm_manageddisk_facts version_added: "2.4" @@ -23,6 +23,9 @@ short_description: Get managed disk facts description: - Get facts for a specific managed disk or all managed disks. +notes: + - This module was called C(azure_rm_managed_disk_facts) before Ansible 2.8. The usage did not change. + options: name: description: @@ -48,15 +51,15 @@ author: EXAMPLES = r''' - name: Get facts for one managed disk - azure_rm_managed_disk_facts: + azure_rm_manageddisk_facts: name: Testing resource_group: myResourceGroup - name: Get facts for all managed disks - azure_rm_managed_disk_facts: + azure_rm_manageddisk_facts: - name: Get facts by tags - azure_rm_managed_disk_facts: + azure_rm_manageddisk_facts: tags: - testing ''' @@ -122,7 +125,7 @@ except Exception: pass -# duplicated in azure_rm_managed_disk +# duplicated in azure_rm_manageddisk def managed_disk_to_dict(managed_disk): create_data = managed_disk.creation_data return dict( diff --git a/test/integration/targets/azure_rm_image/tasks/main.yml b/test/integration/targets/azure_rm_image/tasks/main.yml index 7a7bc7095f..8b87adfae7 100644 --- a/test/integration/targets/azure_rm_image/tasks/main.yml +++ b/test/integration/targets/azure_rm_image/tasks/main.yml @@ -56,7 +56,7 @@ register: vm - name: Create new empty managed disk - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "{{ empty_disk_name }}" storage_account_type: "Standard_LRS" @@ -150,7 +150,7 @@ - not output.changed - name: Delete empty disk - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "{{ empty_disk_name }}" state: absent diff --git a/test/integration/targets/azure_rm_managed_disk/aliases b/test/integration/targets/azure_rm_manageddisk/aliases similarity index 67% rename from test/integration/targets/azure_rm_managed_disk/aliases rename to test/integration/targets/azure_rm_manageddisk/aliases index 9076720829..6f0d233f41 100644 --- a/test/integration/targets/azure_rm_managed_disk/aliases +++ b/test/integration/targets/azure_rm_manageddisk/aliases @@ -2,3 +2,4 @@ cloud/azure shippable/azure/group3 destructive disabled +azure_rm_manageddisk_facts diff --git a/test/integration/targets/azure_rm_managed_disk/meta/main.yml b/test/integration/targets/azure_rm_manageddisk/meta/main.yml similarity index 100% rename from test/integration/targets/azure_rm_managed_disk/meta/main.yml rename to test/integration/targets/azure_rm_manageddisk/meta/main.yml diff --git a/test/integration/targets/azure_rm_managed_disk/tasks/main.yml b/test/integration/targets/azure_rm_manageddisk/tasks/main.yml similarity index 93% rename from test/integration/targets/azure_rm_managed_disk/tasks/main.yml rename to test/integration/targets/azure_rm_manageddisk/tasks/main.yml index 6f93dd10b5..79661337cb 100644 --- a/test/integration/targets/azure_rm_managed_disk/tasks/main.yml +++ b/test/integration/targets/azure_rm_manageddisk/tasks/main.yml @@ -5,7 +5,7 @@ run_once: yes - name: Clearing (if) previous disks were created - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "{{ item }}" state: absent @@ -16,7 +16,7 @@ - "md{{ rpfx }}1" - name: Create managed disk (Check Mode) - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}1" storage_account_type: "Standard_LRS" @@ -34,7 +34,7 @@ - output.state - name: Test invalid account name (should give error) - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "invalid_char$" disk_size_gb: 1 @@ -46,7 +46,7 @@ assert: { that: "output['failed'] == True" } - name: Create new managed disk succesfully - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}1" storage_account_type: "Standard_LRS" @@ -66,7 +66,7 @@ - output.state.storage_account_type == "Standard_LRS" - name: Create new managed disk with zone - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}3" storage_account_type: "Standard_LRS" @@ -84,7 +84,7 @@ - output.state.zone == ["1"] - name: Change the operating system type of the managed disk to linux - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}1" disk_size_gb: 1 @@ -101,7 +101,7 @@ - output.state.os_type == 'linux' - name: Create new managed disk with an os_type specified at creation - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}os" storage_account_type: "Standard_LRS" @@ -116,13 +116,13 @@ - win.state.os_type == 'windows' - name: Clean up managed disk created with os_type - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}os" state: absent - name: Copy disk to a new managed disk - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}2" create_option: "copy" @@ -137,7 +137,7 @@ - copy.state.id is defined - name: Update a new disk without changes - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}1" storage_account_type: "Standard_LRS" @@ -151,7 +151,7 @@ - output.state.id is defined - name: Change storage account type to an invalid type - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}1" storage_account_type: "PremiumL" @@ -163,7 +163,7 @@ assert: { that: "output['failed'] == True" } - name: Change disk size to incompatible size - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}1" disk_size_gb: 3000000 @@ -174,7 +174,7 @@ assert: { that: "output['failed'] == True" } - name: Change disk to bigger size - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}1" disk_size_gb: 2 @@ -187,7 +187,7 @@ - output.state.disk_size_gb == 2 - name: Change disk to Standard SSD - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}1" storage_account_type: "StandardSSD_LRS" @@ -201,7 +201,7 @@ - output.state.storage_account_type == "StandardSSD_LRS" - name: Gather facts to one specific disk - azure_rm_managed_disk_facts: + azure_rm_manageddisk_facts: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}1" @@ -211,7 +211,7 @@ - azure_managed_disk[0].storage_account_type == "StandardSSD_LRS" - name: Change disk to Premium (SSD) - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}1" storage_account_type: "Premium_LRS" @@ -225,7 +225,7 @@ - output.state.storage_account_type == "Premium_LRS" - name: Update disk tags - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}1" disk_size_gb: 2 @@ -242,7 +242,7 @@ - "output.state.tags.galaxy == 'no'" - name: Update disk tags - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}1" disk_size_gb: 2 @@ -259,7 +259,7 @@ - "output.state.tags.delete == 'never'" - name: Gather facts to one specific disk - azure_rm_managed_disk_facts: + azure_rm_manageddisk_facts: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}1" @@ -271,7 +271,7 @@ - "azure_managed_disk[0].os_type == 'linux'" - name: Gather facts - azure_rm_managed_disk_facts: + azure_rm_manageddisk_facts: resource_group: "{{ resource_group }}" - assert: @@ -284,7 +284,7 @@ with_dict: "{{ azure_managed_disk[0] }}" - name: Create disk with facts return value - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" location: "{{ parameter.location }}" name: "{{ parameter.name }}" @@ -348,7 +348,7 @@ version: latest - name: Mount the disk to virtual machine (check mode) - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}1" disk_size_gb: 2 @@ -364,7 +364,7 @@ - not mounted.state.managed_by - name: Mount the disk to virtual machine - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}1" disk_size_gb: 2 @@ -379,7 +379,7 @@ - "'tr{{ rpfx }}' in mounted.state.managed_by" - name: Mount the disk to virtual machine (idempotent) - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}1" disk_size_gb: 2 @@ -394,7 +394,7 @@ - "'tr{{ rpfx }}' in mounted.state.managed_by" - name: Unmount the disk to virtual machine (check mode) - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}1" disk_size_gb: 2 @@ -410,7 +410,7 @@ - mounted.changed - name: Unmount the disk to virtual machine - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}1" disk_size_gb: 2 @@ -426,7 +426,7 @@ - not mounted.state.managed_by - name: Unmount the disk to virtual machine (idempotent) - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}1" managed_by: '' @@ -442,7 +442,7 @@ - not mounted.state.managed_by - name: Update disk size - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}1" disk_size_gb: 4 @@ -456,7 +456,7 @@ - output.state.disk_size_gb == 4 - name: Attach the disk to virtual machine again - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}1" disk_size_gb: 4 @@ -472,7 +472,7 @@ - "'tr{{ rpfx }}' in mounted.state.managed_by" - name: Change disk size to incompatible size - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}1" state: absent @@ -484,7 +484,7 @@ assert: { that: "output['failed'] == True" } - name: Delete managed disk (Check Mode) - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}1" state: absent @@ -498,7 +498,7 @@ - output.state - name: Delete all managed disk - azure_rm_managed_disk: + azure_rm_manageddisk: resource_group: "{{ resource_group }}" name: "md{{ rpfx }}{{ item }}" managed_by: '' diff --git a/test/sanity/validate-modules/ignore.txt b/test/sanity/validate-modules/ignore.txt index 451f09bfd4..008d92b0d9 100644 --- a/test/sanity/validate-modules/ignore.txt +++ b/test/sanity/validate-modules/ignore.txt @@ -85,7 +85,7 @@ lib/ansible/modules/cloud/amazon/s3_website.py E324 lib/ansible/modules/cloud/amazon/sts_assume_role.py E317 lib/ansible/modules/cloud/atomic/atomic_container.py E317 lib/ansible/modules/cloud/azure/azure_rm_dnszone_facts.py E325 -lib/ansible/modules/cloud/azure/azure_rm_managed_disk_facts.py E325 +lib/ansible/modules/cloud/azure/azure_rm_manageddisk_facts.py E325 lib/ansible/modules/cloud/centurylink/clc_aa_policy.py E335 lib/ansible/modules/cloud/centurylink/clc_alert_policy.py E317 lib/ansible/modules/cloud/centurylink/clc_blueprint_package.py E335