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

NamespaceAPI is adding an additional " when creating files #64

Open
laucianexones opened this issue Jun 27, 2023 · 0 comments
Open

NamespaceAPI is adding an additional " when creating files #64

laucianexones opened this issue Jun 27, 2023 · 0 comments

Comments

@laucianexones
Copy link

this is blocking most of our configuration work.. any help is appreciated..

here is my code

def create_file(api_client):

    api_instance = isi_sdk.NamespaceApi(api_client)
    file_path = 'ifs/data/test_file_2' # str | File path relative to /.
    x_isi_ifs_target_type = 'object' # str | Specifies the resource type. (default to object)
    # file_contents = 'blaaaaaa'.encode("utf-8").decode("utf-8") # str | The contents of the file object.
    file_contents = 'bla'

    x_isi_ifs_access_control = '0600' # str | Specifies a pre-defined ACL value or POSIX mode with a string in octal string format. (optional) (default to 0600)
    content_encoding = 'utf-8' # str | Specifies the content encoding that was applied to the object content, so that decoding can be applied when retrieving the content. (optional)
    content_type = 'text/plain' # str | Specifies a standard MIME-type description of the content format. (optional) (default to binary/octet-stream)
    overwrite = True #

    try:
        api_response = api_instance.create_file(file_path,x_isi_ifs_target_type, file_contents)

        print(api_response)
        print(dir(api_response))
    except ApiException as e:
        print(e)


def main():

    # we use this string to match the set of values on the YAML file
    cluster_tag = "vm1"

    endpoint = endpoints[cluster_tag]
    # user = data["api_user"]
    user = "api_test"
    api_client = connect(endpoint, user)
    create_file(api_client)



if __name__ == "__main__":

    main()

i can create the file

ifsclustervm1-1# cat /ifs/data/test_file_2
"bla"#

but the file should look like this without "

ifsclustervm1-1# cat /ifs/data/test_file_2
bla

If i use the API directly

import requests
import json

username = "api_test"
password = "***"


file_content = 'bla\n'


headers = {
    "x-isi-ifs-target-type" : "object" ## object for file, container for folder
}

params = {
    "overwrite" : True
}



isiapi = requests.put('https://{0}:8080/{1}'.format('ifsclustervm1', "namespace/ifs/data/test_file_2"), verify=False,headers=headers, data=file_content, params=params, auth=(username,password))
print(isiapi)

i am getting the expected output. Something is wrong with the SDK wrapper around the namespace API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant