Skip to content

NamespaceAPI is adding an additional " when creating files #64

@laucianexones

Description

@laucianexones

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions