Backport/2.9/62559 (#62570)

* snapshot fix for backporting (#62559)

(cherry picked from commit 054519920e)

* changelog fragment
pull/62607/head
Zim Kalinowski 5 years ago committed by Toshio Kuratomi
parent 5a99d473d3
commit b8e905cd4d

@ -0,0 +1,2 @@
bugfixes:
- Fix support for Specialized images in Azure Shared Image Gallery

@ -141,7 +141,7 @@ class AzureRMGalleries(AzureRMModuleBaseExt):
self.body = {} self.body = {}
self.query_parameters = {} 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 = {}
self.header_parameters['Content-Type'] = 'application/json; charset=utf-8' self.header_parameters['Content-Type'] = 'application/json; charset=utf-8'

@ -379,7 +379,7 @@ class AzureRMGalleryImages(AzureRMModuleBaseExt):
self.body = {} self.body = {}
self.query_parameters = {} 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 = {}
self.header_parameters['Content-Type'] = 'application/json; charset=utf-8' self.header_parameters['Content-Type'] = 'application/json; charset=utf-8'

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

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

Loading…
Cancel
Save