snapshot fix for backporting (#62559)

pull/62586/head
Zim Kalinowski 5 years ago committed by GitHub
parent a684bb9f5b
commit 054519920e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -141,7 +141,7 @@ class AzureRMGalleries(AzureRMModuleBaseExt):
self.body = {}
self.query_parameters = {}
self.query_parameters['api-version'] = '2019-03-01'
self.query_parameters['api-version'] = '2019-07-01'
self.header_parameters = {}
self.header_parameters['Content-Type'] = 'application/json; charset=utf-8'

@ -379,7 +379,7 @@ class AzureRMGalleryImages(AzureRMModuleBaseExt):
self.body = {}
self.query_parameters = {}
self.query_parameters['api-version'] = '2019-03-01'
self.query_parameters['api-version'] = '2019-07-01'
self.header_parameters = {}
self.header_parameters['Content-Type'] = 'application/json; charset=utf-8'

@ -215,7 +215,8 @@ class AzureRMGalleryImageVersions(AzureRMModuleBaseExt):
location=dict(
type='str',
updatable=False,
disposition='/'
disposition='/',
comparison='location'
),
publishing_profile=dict(
type='dict',
@ -227,7 +228,8 @@ class AzureRMGalleryImageVersions(AzureRMModuleBaseExt):
options=dict(
name=dict(
type='str',
required=True
required=True,
comparison='location'
),
regional_replica_count=dict(
type='int',
@ -244,14 +246,14 @@ class AzureRMGalleryImageVersions(AzureRMModuleBaseExt):
pattern=('/subscriptions/{subscription_id}/resourceGroups'
'/{resource_group}/providers/Microsoft.Compute'
'/images/{name}'),
disposition='source/managedImage/id'
comparison='ignore'
),
snapshot=dict(
type='raw',
pattern=('/subscriptions/{subscription_id}/resourceGroups'
'/{resource_group}/providers/Microsoft.Compute'
'/snapshots/{name}'),
disposition='source/managedImage/id'
comparison='ignore'
),
replica_count=dict(
type='int',
@ -295,7 +297,7 @@ class AzureRMGalleryImageVersions(AzureRMModuleBaseExt):
self.body = {}
self.query_parameters = {}
self.query_parameters['api-version'] = '2019-03-01'
self.query_parameters['api-version'] = '2019-07-01'
self.header_parameters = {}
self.header_parameters['Content-Type'] = 'application/json; charset=utf-8'
@ -363,9 +365,13 @@ class AzureRMGalleryImageVersions(AzureRMModuleBaseExt):
if not self.default_compare(modifiers, self.body, old_response, '', self.results):
self.to_do = Actions.Update
# fix leftovers (if empty structures were left)
self.body.get('properties', {}).get('publishingProfile', {}).pop('snapshot', None)
self.body.get('properties', {}).get('publishingProfile', {}).pop('managed_image', None)
# fix for differences between version 2019-03-01 and 2019-07-01
snapshot = self.body.get('properties', {}).get('publishingProfile', {}).pop('snapshot', None)
if snapshot is not None:
self.body['properties'].setdefault('storageProfile', {}).setdefault('osDiskImage', {}).setdefault('source', {})['id'] = snapshot
managed_image = self.body.get('properties', {}).get('publishingProfile', {}).pop('managed_image', None)
if managed_image:
self.body['properties'].setdefault('storageProfile', {}).setdefault('source', {})['id'] = managed_image
if (self.to_do == Actions.Create) or (self.to_do == Actions.Update):
self.log('Need to Create / Update the GalleryImageVersion instance')
@ -393,7 +399,6 @@ class AzureRMGalleryImageVersions(AzureRMModuleBaseExt):
if response:
self.results["id"] = response["id"]
self.results["old_response"] = response
return self.results

@ -78,7 +78,7 @@
azure_rm_gallery:
resource_group: "{{ resource_group }}"
name: myGallery{{ rpfx }}
location: West US
location: eastus
description: This is the gallery description.
register: output
@ -90,7 +90,7 @@
azure_rm_gallery:
resource_group: "{{ resource_group }}"
name: myGallery{{ rpfx }}
location: West US
location: eastus
description: This is the gallery description.
register: output
@ -102,7 +102,7 @@
azure_rm_gallery:
resource_group: "{{ resource_group }}"
name: myGallery{{ rpfx }}
location: West US
location: eastus
description: This is the gallery description - xxx.
register: output
@ -130,7 +130,7 @@
resource_group: "{{ resource_group }}"
gallery_name: myGallery{{ rpfx }}
name: myImage
location: West US
location: eastus
os_type: linux
os_state: generalized
identifier:
@ -149,7 +149,7 @@
resource_group: "{{ resource_group }}"
gallery_name: myGallery{{ rpfx }}
name: myImage
location: West US
location: eastus
os_type: linux
os_state: generalized
identifier:
@ -168,7 +168,7 @@
resource_group: "{{ resource_group }}"
gallery_name: myGallery{{ rpfx }}
name: myImage
location: West US
location: eastus
os_type: linux
os_state: generalized
identifier:
@ -205,16 +205,16 @@
gallery_name: myGallery{{ rpfx }}
gallery_image_name: myImage
name: 10.1.3
location: West US
location: eastus
publishing_profile:
end_of_life_date: "2020-10-01t00:00:00+00:00"
exclude_from_latest: yes
replica_count: 3
storage_account_type: Standard_LRS
target_regions:
- name: West US
- name: eastus
regional_replica_count: 1
- name: East US
- name: westus
regional_replica_count: 2
storage_account_type: Standard_ZRS
managed_image:
@ -232,16 +232,16 @@
gallery_name: myGallery{{ rpfx }}
gallery_image_name: myImage
name: 10.1.3
location: West US
location: eastus
publishing_profile:
end_of_life_date: "2020-10-01t00:00:00+00:00"
exclude_from_latest: yes
replica_count: 3
storage_account_type: Standard_LRS
target_regions:
- name: West US
- name: eastus
regional_replica_count: 1
- name: East US
- name: westus
regional_replica_count: 2
storage_account_type: Standard_ZRS
managed_image:
@ -259,16 +259,16 @@
gallery_name: myGallery{{ rpfx }}
gallery_image_name: myImage
name: 10.1.3
location: West US
location: eastus
publishing_profile:
end_of_life_date: "2021-10-01t00:00:00+00:00"
exclude_from_latest: yes
replica_count: 3
storage_account_type: Standard_LRS
target_regions:
- name: West US
- name: eastus
regional_replica_count: 1
- name: East US
- name: westus
regional_replica_count: 2
storage_account_type: Standard_ZRS
managed_image:

Loading…
Cancel
Save