-
Notifications
You must be signed in to change notification settings - Fork 23.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixing managed disk facts #51781
Fixing managed disk facts #51781
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
bugfixes: | ||
- azure_rm_managed_disk_facts - added missing implementation of listing managed disks by resource group | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -175,7 +175,7 @@ def exec_module(self, **kwargs): | |
|
||
self.results['ansible_facts']['azure_managed_disk'] = ( | ||
self.get_item() if self.name | ||
else self.list_items() | ||
else (self.list_items_by_resource_group() if self.resource_group else self.list_items()) | ||
) | ||
|
||
return self.results | ||
|
@@ -210,6 +210,19 @@ def list_items(self): | |
results.append(managed_disk_to_dict(item)) | ||
return results | ||
|
||
def list_items_by_resource_group(self): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. at least one test? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yungezz the test is there. and it just started failing, so this fix is fixing that test There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @zikalino why it didn't failed during time of module merging? |
||
"""Get managed disks in a resource group""" | ||
try: | ||
response = self.compute_client.disks.list_by_resource_group(resource_group_name=self.resource_group) | ||
except CloudError as exc: | ||
self.fail('Failed to list items by resource group - {}'.format(str(exc))) | ||
|
||
results = [] | ||
for item in response: | ||
if self.has_tags(item.tags, self.tags): | ||
results.append(managed_disk_to_dict(item)) | ||
return results | ||
|
||
|
||
def main(): | ||
"""Main module execution code path""" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put this into backport rather than devel?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jborean93 mentioned that it's best practice to add changelog fragments with pr in devel already, so I am adding now.