Created
April 19, 2016 21:45
-
-
Save pbasov/7123dcfe12516c32233d737bbe369587 to your computer and use it in GitHub Desktop.
This file contains 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 keystoneclient | |
import json | |
keystoneauth={"auth":{"passwordCredentials":{"username": "admin", "password": "admin"},"tenantName": "admin"}} | |
token = requests.post('http://localhost:5000/v2.0/tokens', headers={'Content-Type': 'application/json'}, data=json.dumps(keystoneauth)) | |
token = json.loads(token.text)['access']['token']['id'] | |
nodes = requests.get('http://localhost:8000/api/nodes', headers={'X-Auth-Token': token}) | |
nodes = json.loads(nodes.text) | |
for node in nodes: | |
if node['id'] in nodes: | |
nodeready = requests.put('http://localhost:8000/api/nodes/%s' % node['id'], headers={'X-Auth-Token': token}, data=json.dumps({'status':'ready'})) | |
print(nodeready.status_code) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment