Last active
August 29, 2015 14:02
-
-
Save vicenteg/36e6e184f8635b484f3d to your computer and use it in GitHub Desktop.
disk add api
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import logging | |
user = "mapr" | |
password = "mapr" | |
host = "node1" | |
disk_list = [ '/dev/sde', '/dev/sdf', '/dev/sdg' ] | |
def add_disk(): | |
disk_string = '["%s"]' % ",".join(disk_list) | |
logging.warn("disk_string = %s" % disk_string) | |
r = requests.get('https://localhost:8443/rest/disk/add', | |
params={ 'host': host, 'disks': disk_string }, | |
verify=False, | |
auth=(user, password)) | |
logging.warn(r.request.url) | |
return r.json() | |
print add_disk() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python test_add_disk.py | |
WARNING:root:disk_string = ["/dev/sde,/dev/sdf,/dev/sdg"] | |
WARNING:root:https://localhost:8443/rest/disk/add?host=node1&disks=%5B%22%2Fdev%2Fsde%2C%2Fdev%2Fsdf%2C%2Fdev%2Fsdg%22%5D | |
{u'status': u'ERROR', u'timestamp': 1402542979641, u'errors': [{u'id': 19, u'desc': u'Failed operation for disk /dev/"/dev/sde, No such device'}]} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment