浏览代码

add kill switch neuron

nico 8 年之前
父节点
当前提交
a6a8eb6e30
共有 4 个文件被更改,包括 20 次插入1 次删除
  1. 9 1
      brain.yml
  2. 1 0
      neurons/__init__.py
  3. 1 0
      neurons/kill_switch/__init__.py
  4. 9 0
      neurons/kill_switch/kill_switch.py

+ 9 - 1
brain.yml

@@ -87,4 +87,12 @@
       - say:
           message: "Tache terminée"
     when:
-      - order: "playbook"
+      - order: "playbook"
+
+  - name: "Stop jarvis"
+    neurons:
+      - say:
+          message: "Aurevoir"
+      - kill_switch
+    when:
+      - order: "ferme-toi"

+ 1 - 0
neurons/__init__.py

@@ -5,3 +5,4 @@ from script import Script
 from command import Command
 from ansible_tasks import Ansible_tasks
 from sleep import Sleep
+from kill_switch import Kill_switch

+ 1 - 0
neurons/kill_switch/__init__.py

@@ -0,0 +1 @@
+from kill_switch import Kill_switch

+ 9 - 0
neurons/kill_switch/kill_switch.py

@@ -0,0 +1,9 @@
+from neurons import Neurone
+import sys
+
+class Kill_switch(Neurone):
+
+    def __init__(self, *args , **kwargs):
+        Neurone.__init__(self)
+
+        sys.exit()