mirror of
https://github.com/xcat2/confluent.git
synced 2024-12-25 12:41:39 +00:00
Add quick and dirty example of a command
'nodepower' is not yet 'rpower' like, but it's a quick demonstration of using the python confluent client library. It only supports unix socket as written
This commit is contained in:
parent
a5504ec62f
commit
65af925b2d
16
bin/nodepower
Normal file
16
bin/nodepower
Normal file
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
import sys
|
||||
|
||||
path = os.path.dirname(os.path.realpath(__file__))
|
||||
path = os.path.realpath(os.path.join(path, '..'))
|
||||
sys.path.append(path)
|
||||
|
||||
import confluent.common.client as client
|
||||
|
||||
|
||||
node = sys.argv[1]
|
||||
|
||||
session = client.Command()
|
||||
for res in session.read("/node/{0}/power/state".format(node)):
|
||||
print("%s: %s" % (node, res['state']['value']))
|
Loading…
Reference in New Issue
Block a user