-
Notifications
You must be signed in to change notification settings - Fork 50
Fix acl update on single element list #132
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
Changes from 2 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 |
---|---|---|
|
@@ -7,3 +7,6 @@ ansible_cache/ | |
roles | ||
venv | ||
build/ | ||
|
||
## IDE specific files/folders | ||
.idea |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,7 +32,7 @@ def process_module_acl(module): | |
'acl_resource_type': params['acl_resource_type'], | ||
'state': params['state'] | ||
}] | ||
|
||
params['mark_others_as_absent'] = False | ||
process_module_acls(module, params) | ||
|
||
|
||
|
@@ -62,40 +62,16 @@ def process_module_acls(module, params=None): | |
'instead' | ||
) | ||
|
||
if len(acls) > 1: | ||
acl_resource = ACLResource( | ||
acl_resources_found = manager.describe_acls( | ||
|
||
ACLResource( | ||
resource_type=ACLResourceType.ANY, | ||
operation=ACLOperation.ANY, | ||
permission_type=ACLPermissionType.ANY, | ||
pattern_type=ACLPatternType.ANY, | ||
name=None, | ||
principal=None, | ||
host=None | ||
) | ||
else: | ||
acl = acls[0] | ||
|
||
acl_name = acl['name'] | ||
acl_resource_type = acl['acl_resource_type'] | ||
acl_principal = acl['acl_principal'] | ||
acl_operation = acl['acl_operation'] | ||
acl_permission = acl['acl_permission'] | ||
acl_pattern_type = acl['acl_pattern_type'] | ||
acl_host = acl['acl_host'] | ||
|
||
acl_resource = ACLResource( | ||
resource_type=ACLResourceType.from_name(acl_resource_type), | ||
operation=ACLOperation.from_name(acl_operation), | ||
permission_type=ACLPermissionType.from_name( | ||
acl_permission | ||
), | ||
pattern_type=ACLPatternType.from_name(acl_pattern_type), | ||
name=acl_name, | ||
principal=acl_principal, | ||
host=acl_host | ||
) | ||
acl_resource_found = manager.describe_acls( | ||
acl_resource, api_version | ||
), api_version | ||
) | ||
|
||
acls_marked_present = [ACLResource( | ||
|
@@ -132,14 +108,14 @@ def process_module_acls(module, params=None): | |
return | ||
|
||
acls_to_add = [acl for acl in acls_marked_present | ||
if acl not in acl_resource_found] | ||
if acl not in acl_resources_found] | ||
acls_to_delete = [acl for acl in acls_marked_absent | ||
if acl in acl_resource_found] | ||
if acl in acl_resources_found] | ||
|
||
# Cleanup others acls | ||
if mark_others_as_absent: | ||
acls_to_delete.extend( | ||
[acl for acl in acl_resource_found | ||
[acl for acl in acl_resources_found | ||
if acl not in acls_marked_present + acls_marked_absent] | ||
) | ||
if len(acls_to_add) > 0: | ||
|
Uh oh!
There was an error while loading. Please reload this page.
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.
mark_others_as_absent
will always beFalse
when calling from kafka_acl module (see line 43)