|
@@ -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))})
|