summaryrefslogtreecommitdiff
path: root/reconfigure/items/supervisor.py
diff options
context:
space:
mode:
authorAndrew Shadura <andrew@shadura.me>2015-08-20 15:58:26 +0200
committerAndrew Shadura <andrew@shadura.me>2015-08-20 15:58:26 +0200
commitff1408420159488a106492ccd11dd234967029b6 (patch)
tree473420cee1c5229a427ec4cafead1aa6c0a26800 /reconfigure/items/supervisor.py
Imported Upstream version 0.1.29
Diffstat (limited to 'reconfigure/items/supervisor.py')
-rw-r--r--reconfigure/items/supervisor.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/reconfigure/items/supervisor.py b/reconfigure/items/supervisor.py
new file mode 100644
index 0000000..a8e462f
--- /dev/null
+++ b/reconfigure/items/supervisor.py
@@ -0,0 +1,22 @@
+from reconfigure.nodes import Node, PropertyNode
+from reconfigure.items.bound import BoundData
+
+
+class SupervisorData (BoundData):
+ pass
+
+
+class ProgramData (BoundData):
+ fields = ['command', 'autostart', 'autorestart', 'startsecs', 'startretries', \
+ 'user', 'directory', 'umask', 'environment']
+
+ def template(self):
+ return Node('program:new',
+ PropertyNode('command', '127.0.0.1'),
+ )
+
+
+SupervisorData.bind_collection('programs', item_class=ProgramData, selector=lambda x: x.name.startswith('program:'))
+ProgramData.bind_name('name', getter=lambda x: x[8:], setter=lambda x: 'program:%s' % x)
+for i in range(0, len(ProgramData.fields)):
+ ProgramData.bind_property(ProgramData.fields[i], ProgramData.fields[i], default_remove=[None, ''])