- CheckMates
- :
- Products
- :
- Quantum
- :
- Management
- :
- R80.10 Management API "put-file" command's undocum...
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Are you a member of CheckMates?
×- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
R80.10 Management API "put-file" command's undocumented flag
The Management API "put-file" command allows uploading a file to a management server or a gateway.
If you run this API command using a mgmt_cli tool, you may use a new "--treat-value-as-file-by-prefix" flag, which will replace the value of file-content argument with the content of a file on your machine.
Here is an example using the standard syntax -
mgmt_cli put-file file-path "/home/admin/" file-name "vsx_conf" file-content "vs ip 192.0.2.1\nvs2 ip 192.0.2.2" targets.1 "corporate-gateway"
Here is an example using the new syntax -
mgmt_cli put-file file-path "/home/admin/" file-name "vsx_conf" file-content @my_file.txt --treat-value-as-file-by-prefix @ targets.1 "corporate-gateway"
while the content of the file my_file.txt will be "vs ip 192.0.2.1\nvs2 ip 192.0.2.2".
The new flag informs the mgmt_cli tool that an argument file-content with a value my_file.txt starting with a '@' character, should have a new value - the content of my_file.txt file.
You may use any prefix of any length for this flag.
If the file is not located in the current directory, you should specify an absolute path.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey Robert,
Thanks for explanation.
Is it possible to use the mgmt-cli to simply put a file at the target?
say:
mgmt_cli put-file file-path "/home/admin/" file-name "my_file.txt" targets.1 "corporate-gateway"
And then the file located in my directory will be in the target directory of the command?
Thanks
Adiel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This command eventually uploads the content of the file to the specified target.
You must specify either the parameter for the file-content argument or use the new flag mentioned above.
Robert.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Another way of transferring files. Python SDK:
f = open("dynamic_id_users_info.lst", "r")
filecontent = f.read()
put_file_response = client.api_call("put-file", {"file-path" : "/var/opt/CPshrd-R80.40/conf/", "file-name" : "dynamic_id_users_info.lst", "file-content" : f"{filecontent}", "targets" : [ "target1","target2" ]})
