mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 13:22:48 +00:00
disk fact should return create_option value (#42398)
This commit is contained in:
@@ -146,16 +146,17 @@ except ImportError:
|
||||
|
||||
|
||||
def managed_disk_to_dict(managed_disk):
|
||||
os_type = None
|
||||
if managed_disk.os_type:
|
||||
os_type = managed_disk.os_type.name
|
||||
create_data = managed_disk.creation_data
|
||||
return dict(
|
||||
id=managed_disk.id,
|
||||
name=managed_disk.name,
|
||||
location=managed_disk.location,
|
||||
tags=managed_disk.tags,
|
||||
create_option=create_data.create_option.value.lower(),
|
||||
source_uri=create_data.source_uri,
|
||||
source_resource_uri=create_data.source_resource_id,
|
||||
disk_size_gb=managed_disk.disk_size_gb,
|
||||
os_type=os_type,
|
||||
os_type=managed_disk.os_type.value if managed_disk.os_type else None,
|
||||
storage_account_type=managed_disk.sku.name.value,
|
||||
managed_by=managed_disk.managed_by
|
||||
)
|
||||
|
||||
@@ -79,27 +79,12 @@ from ansible.module_utils.azure_rm_common import AzureRMModuleBase
|
||||
|
||||
try:
|
||||
from msrestazure.azure_exceptions import CloudError
|
||||
from ansible.modules.cloud.azure.azure_rm_managed_disk import managed_disk_to_dict
|
||||
except:
|
||||
# handled in azure_rm_common
|
||||
pass
|
||||
|
||||
|
||||
def managed_disk_to_dict(managed_disk):
|
||||
os_type = None
|
||||
if managed_disk.os_type:
|
||||
os_type = managed_disk.os_type.name
|
||||
return dict(
|
||||
id=managed_disk.id,
|
||||
name=managed_disk.name,
|
||||
location=managed_disk.location,
|
||||
tags=managed_disk.tags,
|
||||
disk_size_gb=managed_disk.disk_size_gb,
|
||||
os_type=os_type,
|
||||
storage_account_type=managed_disk.sku.name.value,
|
||||
managed_by=managed_disk.managed_by
|
||||
)
|
||||
|
||||
|
||||
class AzureRMManagedDiskFacts(AzureRMModuleBase):
|
||||
"""Utility class to get managed disk facts"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user