From 5e1853a28f9ca1d13280db06fdb9edaf33fd7354 Mon Sep 17 00:00:00 2001 From: earthmant Date: Fri, 4 Aug 2017 09:02:48 +0300 Subject: [OOM-71] Message Router Kubernetes-Tosca Templates Change-Id: I6f3afcea03a033a502b85aa7e7729b42e9e5dd4f Signed-off-by: earthmant --- cloudify/scripts/tasks.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 cloudify/scripts/tasks.py (limited to 'cloudify/scripts/tasks.py') 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) -- cgit 1.2.3-korg