[Qa-jenkins-scm] [Git][qa/jenkins.debian.net][master] reproducible: add script to ease powercycling x86 nodes

Holger Levsen gitlab at salsa.debian.org
Mon Oct 28 18:30:34 GMT 2019



Holger Levsen pushed to branch master at Debian QA / jenkins.debian.net


Commits:
8a69efc8 by Holger Levsen at 2019-10-28T18:30:12Z
reproducible: add script to ease powercycling x86 nodes

Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -


1 changed file:

- + bin/powercycle_x86_nodes.py


Changes:

=====================================
bin/powercycle_x86_nodes.py
=====================================
@@ -0,0 +1,47 @@
+#!/usr/bin/python3
+
+# Copyright 2019 Holger Levsen <holger at layer-acht.org>
+# released under the GPLv2
+
+from profitbricks.client import ProfitBricksService
+import json
+import os
+import sys
+
+# expects node numbers or 'jenkins' as params...
+nodes=[]
+for argument in sys.argv:   
+    try:
+        node=int(argument)
+        name=('build'+str(node))
+        nodes.append(name)
+    except:
+        try:
+            if argument=='jenkins':
+                nodes.append(argument)
+        except:
+            pass
+
+#for node in nodes:
+#    print (node)
+
+client = ProfitBricksService(
+    username=os.getenv('IONOS_USERNAME'),
+    password=os.getenv('IONOS_PASSWORD'))
+
+response = client.list_datacenters(0)
+#print (json.dumps(response, indent=4))
+
+for item in response['items']:
+    datacenter=item['id']
+    #print (datacenter)
+    response = client.list_servers(datacenter_id=datacenter)
+    #print (json.dumps(response, indent=4))
+    for item in response['items']:
+        #print (item['id'])
+        #print (item['type'])
+        for server in nodes:
+            if item['type'] == 'server' and item['properties']['name'] == server:
+                print ('Rebooting '+item['properties']['name']+' aka '+server) 
+                result = client.reboot_server(datacenter, item['id'])
+                print (result)



View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/commit/8a69efc868844ecaeabe46ea8dd461772c458cd5

-- 
View it on GitLab: https://salsa.debian.org/qa/jenkins.debian.net/commit/8a69efc868844ecaeabe46ea8dd461772c458cd5
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/qa-jenkins-scm/attachments/20191028/6c9b5795/attachment-0001.html>


More information about the Qa-jenkins-scm mailing list