Warning: this code is provided on a best effort basis and is not in any way officially supported or sanctioned by Cohesity. The code is intentionally kept simple to retain value as example code. The code in this repository is provided as-is and the author accepts no liability for damages resulting from its use.
This python script clones a directory within a view.
- cloneDirectory.py: the main python script
- pyhesity.py: the Cohesity REST API helper module
Place both files in a folder together and run the main script like so:
bash:~/python$ ./cloneDirectory.py -s mycluster -u admin -d mydomain -sp /View1/folder1 -dp /View1 -nd folder2
Connected!
Cloning directory /View1/folder1 to /View1/folder2...The helper module provides functions to simplify operations such as authentication, api calls, storing encrypted passwords, and converting date formats. The module requires the requests python module.
sudo yum install python-requestsor
sudo easy_install requestsGo to the folder where you want to download the files, then run the following commands:
curl -O https://raw.githubusercontent.com/bseltz-cohesity/scripts/master/python/cloneDirectory/cloneDirectory.py
curl -O https://raw.githubusercontent.com/bseltz-cohesity/scripts/master/python/cloneDirectory/pyhesity.py
chmod +x cloneDirectory.py