summaryrefslogtreecommitdiffstats
path: root/cloudify/scripts/tasks.py
diff options
context:
space:
mode:
authorearthmant <trammell@cloudify.co>2017-08-04 09:02:48 +0300
committerearthmant <trammell@cloudify.co>2017-08-04 09:06:05 +0300
commit5e1853a28f9ca1d13280db06fdb9edaf33fd7354 (patch)
treee244ffeac22da30c27cbfd0edbc90d4d25f0201b /cloudify/scripts/tasks.py
parent097208524f1954a08e3c6d82d15bb4090678b2ed (diff)
[OOM-71] Message Router Kubernetes-Tosca Templates
Change-Id: I6f3afcea03a033a502b85aa7e7729b42e9e5dd4f Signed-off-by: earthmant <trammell@cloudify.co>
Diffstat (limited to 'cloudify/scripts/tasks.py')
-rw-r--r--cloudify/scripts/tasks.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/cloudify/scripts/tasks.py b/cloudify/scripts/tasks.py
new file mode 100644
index 0000000000..035a780cb3
--- /dev/null
+++ b/cloudify/scripts/tasks.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+
+from fabric.api import run
+
+
+def label_node(labels, hostname):
+ if labels:
+ label_list = []
+ for key, value in labels.items():
+ label_pair_string = '%s=%s' % (key, value)
+ label_list.append(label_pair_string)
+ label_string = ' '.join(label_list)
+ command = 'kubectl label nodes %s %s' % (hostname, label_string)
+ run(command)
+
+
+def stop_node(hostname):
+ command = 'kubectl drain %s' % (hostname)
+ run(command)
+
+
+def delete_node(hostname):
+ command = 'kubectl delete no %s' % (hostname)
+ run(command)