summaryrefslogtreecommitdiffstats
path: root/cloudify/scripts/tasks.py
diff options
context:
space:
mode:
authorHong Guan <hg4105@att.com>2017-08-14 13:28:23 +0000
committerGerrit Code Review <gerrit@onap.org>2017-08-14 13:28:23 +0000
commitca98432389ae8b432bafdf53ffa9b6b077883b91 (patch)
treebdf2d381dd640c53a526296ae0aa04b4b7c949a4 /cloudify/scripts/tasks.py
parent5197e2e88144a536068fb75e912f91b20e39db2e (diff)
parent5e1853a28f9ca1d13280db06fdb9edaf33fd7354 (diff)
Merge "[OOM-71] Message Router Kubernetes-Tosca Templates"
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)