Skip to content

Commit

Permalink
Fix azure_rm_roleassignment idempotence error (#296)
Browse files Browse the repository at this point in the history
* fixing idempotency issue
  • Loading branch information
Fred-sun authored Oct 15, 2020
1 parent 5dab633 commit b83b4f9
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions plugins/modules/azure_rm_roleassignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
name:
description:
- Unique name of role assignment.
- The role assignment name must be a GUID, sample as "3ce0cbb0-58c4-4e6d-a16d-99d86a78b3ca".
required: True
assignee_object_id:
description:
- The object id of assignee. This maps to the ID inside the Active Directory.
Expand Down Expand Up @@ -82,8 +84,6 @@
sample: "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/providers/Microsoft.Authorization/roleAssignments/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
'''

import uuid

try:
from ansible_collections.azure.azcollection.plugins.module_utils.azure_rm_common import AzureRMModuleBase
from msrestazure.azure_exceptions import CloudError
Expand Down Expand Up @@ -114,7 +114,8 @@ class AzureRMRoleAssignment(AzureRMModuleBase):
def __init__(self):
self.module_arg_spec = dict(
name=dict(
type='str'
type='str',
required=True
),
scope=dict(
type='str'
Expand Down Expand Up @@ -167,9 +168,6 @@ def exec_module(self, **kwargs):
# build cope
self.scope = self.build_scope()

if self.name is None:
self.name = str(uuid.uuid4())

# get existing role assignment
old_response = self.get_roleassignment()

Expand Down

0 comments on commit b83b4f9

Please sign in to comment.