-
Notifications
You must be signed in to change notification settings - Fork 33
Closed
Description
I'm trying to use the set_acl method, but I'm getting an error even though I'm sending the data correctly (or at least I think I am).
Below is an example of the code and its output.
import isi_sdk_8_2_1
from isi_sdk_8_2_1.rest import ApiException
from pprint import pprint
from backend.settings import api_namespaces
def sdk_test():
namespace_path = "/ifs/isilon8201/lab8201/smb/textosmb.txt" # str | Namespace path relative to /.
acl = True # bool | Update access control lists.
namespace_acl = isi_sdk_8_2_1.NamespaceAcl(
authoritative="mode",
group=isi_sdk_8_2_1.MemberObject(
name="Guests",
type="group"
),
action="update",
mode="0775",
acl=[],
owner=isi_sdk_8_2_1.MemberObject(
name="Guest",
type="user"
)
)
try:
api_response = api_namespaces.set_acl(namespace_path=namespace_path, acl=acl, namespace_acl=namespace_acl)
pprint(api_response)
except ApiException as e:
print("Exception when calling NamespaceApi->set_acl: %s\n" % e)
sdk_test()
Output:
Exception when calling NamespaceApi->set_acl: (400)
Reason: Bad Request
HTTP response headers: HTTPHeaderDict({'Date': 'Tue, 20 Jul 2021 16:11:41 GMT', 'Server': 'Apache', 'Allow': 'GET, PUT, POST, DELETE, HEAD', 'x-isi-ifs-spec-version': '1.0', 'X-Frame-Options': 'sameorigin', 'Strict-Transport-Security': 'max-age=31536000;', 'Content-Security-Policy': "default-src 'none'", 'Connection': 'close', 'Transfer-Encoding': 'chunked', 'Content-Type': 'application/json'})
HTTP response body:
{
"errors" :
[
{
"code" : "AEC_BAD_REQUEST",
"message" : "The namespace name is missing from the URI."
}
]
}
I solved this error just commenting a part of the code inside isi_sdk_8_2_1/api_client.py. Lines: 128 - 146
replacement = path_params[0][1] # Added by me
for k, v in path_params:
v_str = str(v)
# Check for the special case of the
# x-isi-url-encode-path-param, which indicates that the
# parameter should be encoded with quote_plus in order
# to encode the '/' character.
# check if the first part of v_str matches the tag
# if v_str[:self.quote_plus_tag_len] == self.quote_plus_tag:
# # remove "__x-isi-url-encode-path-param__"
# v_str = v_str[self.quote_plus_tag_len:]
# # then url-encode with quote_plus
# replacement = quote_plus(v_str)
# else:
# replacement = quote(v_str, safe=config.safe_chars_for_path_param)
# specified safe chars, encode everything
resource_path = resource_path.replace(
'{%s}' % k, replacement)
When I make these changes the method starts to work correctly. What makes me believe that this part of encoding the '/' is causing this error.
Can you tell me something about it? Can they solve it or am I wrong?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels