Unsolved
1 Message
0
365
Copy local files to Isilon using the API
Hello Dell Community,
TLDR - How can I copy a local file to an Isilon system using the API ?
using this API, I want to create files on an Isilon cluster using OneFS version 9.1.0.14. More specifically, I want to read a source file from my local file system and write it to an `/ifs` file system on Isilon
My source file looks like this
root@af814b21a468 /c/i/c/res# cat file1
line1
line2⏎
root@af814b21a468 /c/i/c/res#
Here is the part of the code, that reads this file and uses the create-file API to create the file
file_path = 'ifs/data/config/api_test/file1' # str | File path relative to /.
x_isi_ifs_target_type = 'object' # str | Specifies the resource type. (default to object)
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)
content_type = 'binary/octet-stream' # str | Specifies a standard MIME-type description of the content format. (optional) (default to binary/octet-stream)
overwrite = True # bool | Deletes and replaces the existing user attributes and ACLs of the directory with user-specified attributes and ACLS from the header, when set to true. (optional)
with open('../res/file1','r') as f:
file_contents = f.read()
print(file_contents)
try:
api_response = api_instance.create_file(file_path, x_isi_ifs_target_type, file_contents, x_isi_ifs_access_control=x_isi_ifs_access_control,overwrite=overwrite, content_encoding=content_encoding, content_type=content_type)
pprint(api_response)
except ApiException as e:
print("Exception when calling NamespaceApi->create_file: %s\n" % e)
running the code results with no error messages, as you can see reading and printing the file to the prompt is also showing the expected results
root@af814b21a468 /c/i/c/src# python create-file.py
Password:
line1
line2
''
but if I log in to the target Isilon and do a cat on the file, you can see the formatting is messed up by the API
ifsclustervm1-1# cat /ifs/data/config/api_test/file1
"line1\nline2"#
ifsclustervm1-1#
I could not find anything related on documentation, GitHub issues, this community or general Google/Bing/DuckDuckGo searches. My question would be:
How can I copy a local file to an Isilon system using the API ?