Explorar el Código

Added a basic engine

nee2c hace 4 años
padre
commit
50e9c03402
Se han modificado 1 ficheros con 26 adiciones y 0 borrados
  1. 26 0
      salt/_engines/vroom.py

+ 26 - 0
salt/_engines/vroom.py

@@ -0,0 +1,26 @@
+"""
+This is an example engine for example
+
+
+"""
+
+import time
+import random
+
+def __virtual__():
+    if "nico.com" in __salt__:
+        return True
+    return False
+
+
+def busywork(stime, num):
+    """
+    Function to do something
+    """
+    time.sleep(stime)
+    return __salt__["nico.com"](num)
+
+
+def start(time=60, rand=1000):
+    while True:
+        __salt__["event.send"](f'salt/{__grains__["id"]}/engine/vroom', {'num': busywork(time, random.randint(2, rand))})