From 65af925b2d115e7ea3262ec450ce92dc7641924a Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 4 Mar 2014 21:09:17 -0500 Subject: [PATCH] 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 --- bin/nodepower | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 bin/nodepower diff --git a/bin/nodepower b/bin/nodepower new file mode 100644 index 00000000..d0ff5ad3 --- /dev/null +++ b/bin/nodepower @@ -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']))