Skip to content
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

Adding fix for ACL user/group trustee #118

Merged
merged 4 commits into from
Oct 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 9 additions & 15 deletions plugins/modules/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,8 @@ def get_filesystem(self, path):
try:
resp = self.namespace_api.get_directory_metadata(
path,
metadata=True)
return resp.to_dict()
metadata=True).to_dict()
return resp
except utils.ApiException as e:
if str(e.status) == "404":
log_msg = "Filesystem {0} status is " \
Expand All @@ -643,12 +643,6 @@ def get_filesystem(self, path):
LOG.error(error_message)
self.module.fail_json(msg=error_message)

except Exception as e:
error_message = "Failed to get details of Filesystem {0} with" \
" error {1} ".format(path, str(e))
LOG.error(error_message)
self.module.fail_json(msg=error_message)

def get_acl(self, effective_path):
"""Retrieves ACL rights of filesystem"""
try:
Expand Down Expand Up @@ -687,7 +681,6 @@ def determine_path(self):
if self.module.params['path']:
path = self.module.params['path']
access_zone = self.module.params['access_zone']

if access_zone.lower() != 'system' and path:
path = self.get_zone_base_path(access_zone) + path

Expand Down Expand Up @@ -752,7 +745,7 @@ def get_group_info(self, group):
self.get_group_id(
name=group['name'],
zone=self.module.params['access_zone'],
provider=group_provider)['groups'][0]['gid']['id']
provider=group_provider)['groups'][0]['sid']['id']

create_group = {'type': 'group', 'id': group_id,
'name': group['name']}
Expand All @@ -767,7 +760,6 @@ def create_filesystem(self, path, recursive, acl, acl_rights, quota, owner, grou
create_group = None
if group:
create_group = self.get_group_info(group=group)

info_message = "Attempting to create new FS {0}".format(path)
LOG.info(info_message)
if not self.module.check_mode:
Expand Down Expand Up @@ -1262,11 +1254,11 @@ def get_trustee_id(self, trustee_name, type, access_zone, provider):
if type == 'user':
return self.get_owner_id(name=trustee_name,
zone=access_zone,
provider=provider)['users'][0]['uid']['id']
provider=provider)['users'][0]['sid']['id']
elif type == 'group':
return self.get_group_id(name=trustee_name,
zone=access_zone,
provider=provider)['groups'][0]['gid']['id']
provider=provider)['groups'][0]['sid']['id']
else:
return self.get_wellknown_id(name=trustee_name)['wellknowns'][0]['id']

Expand Down Expand Up @@ -1309,7 +1301,7 @@ def get_owner_id(self, name, zone, provider):
try:
resp = self.auth_api.get_auth_user(
auth_user_id='USER:' + name,
zone=zone, provider=provider).to_dict()
zone=zone, provider=provider.upper() + ":" + zone).to_dict()
return resp
except Exception as e:
error_msg = self.determine_error(error_obj=e)
Expand All @@ -1324,9 +1316,12 @@ def get_owner_id(self, name, zone, provider):
def get_group_id(self, name, zone, provider):
"""Get the group account details in PowerScale"""
try:
LOG.info("Getting group details here")
resp = self.auth_api.get_auth_group(
auth_group_id='GROUP:' + name,
zone=zone, provider=provider).to_dict()

LOG.info(resp)
return resp
except Exception as e:
error_msg = self.determine_error(error_obj=e)
Expand Down Expand Up @@ -1679,7 +1674,6 @@ class FilesystemHandler():
def handle(self, filesystem_obj, filesystem_params):
quota = copy.deepcopy(filesystem_params['quota'])
filesystem_obj.validate_input(quota)

effective_path = filesystem_obj.determine_path()
filesystem_details = filesystem_obj.get_filesystem(path=effective_path)
filesystem_quota = filesystem_obj.get_quota(effective_path)
Expand Down
Loading