summaryrefslogtreecommitdiff
path: root/reconfigure/items
diff options
context:
space:
mode:
authorAndrew Shadura <andrew@shadura.me>2015-08-20 15:58:30 +0200
committerAndrew Shadura <andrew@shadura.me>2015-08-20 15:58:30 +0200
commitfec1da7e6ea8a3b3b03befa4ff8dd31d539f163d (patch)
treef349cf4e0bf6198660dfc1f0cfeec567b0bb84c5 /reconfigure/items
parent25d6c405aff4167e801d0a4995083a56160b969e (diff)
Imported Upstream version 0.1.50+git20140603
Diffstat (limited to 'reconfigure/items')
-rw-r--r--reconfigure/items/ajenti.py4
-rw-r--r--reconfigure/items/csf.py22
-rw-r--r--reconfigure/items/samba.py9
-rw-r--r--reconfigure/items/squid.py6
-rw-r--r--reconfigure/items/util.py3
5 files changed, 36 insertions, 8 deletions
diff --git a/reconfigure/items/ajenti.py b/reconfigure/items/ajenti.py
index ef70501..2a487f1 100644
--- a/reconfigure/items/ajenti.py
+++ b/reconfigure/items/ajenti.py
@@ -18,7 +18,8 @@ class SSLData (BoundData):
class UserData (BoundData):
def template(self):
- return Node('unnamed',
+ return Node(
+ 'unnamed',
PropertyNode('configs', {}),
PropertyNode('password', ''),
PropertyNode('permissions', []),
@@ -48,6 +49,7 @@ SSLData.bind_property('enable', 'enable')
ConfigData.bind_name('name')
UserData.bind_name('name')
+UserData.bind_property('email', 'email')
UserData.bind_property('password', 'password')
UserData.bind_property('permissions', 'permissions')
UserData.bind_collection('configs', lambda x: x.get('configs'), item_class=ConfigData, collection_class=BoundDictionary, key=lambda x: x.name)
diff --git a/reconfigure/items/csf.py b/reconfigure/items/csf.py
new file mode 100644
index 0000000..fb3767f
--- /dev/null
+++ b/reconfigure/items/csf.py
@@ -0,0 +1,22 @@
+from reconfigure.nodes import Node, PropertyNode
+from reconfigure.items.bound import BoundData
+from reconfigure.items.util import onezero_getter, onezero_setter
+
+
+class CSFData (BoundData):
+ pass
+
+
+CSFData.bind_property('TESTING', 'testing', getter=onezero_getter, setter=onezero_setter)
+CSFData.bind_property('IPV6', 'ipv6', getter=onezero_getter, setter=onezero_setter)
+
+CSFData.bind_property('TCP_IN', 'tcp_in')
+CSFData.bind_property('TCP_OUT', 'tcp_out')
+CSFData.bind_property('UDP_IN', 'udp_in')
+CSFData.bind_property('UDP_OUT', 'udp_out')
+CSFData.bind_property('TCP6_IN', 'tcp6_in')
+CSFData.bind_property('TCP6_OUT', 'tcp6_out')
+CSFData.bind_property('UDP6_IN', 'udp6_in')
+CSFData.bind_property('UDP6_OUT', 'udp6_out')
+CSFData.bind_property('ETH_DEVICE', 'eth_device')
+CSFData.bind_property('ETH6_DEVICE', 'eth6_device')
diff --git a/reconfigure/items/samba.py b/reconfigure/items/samba.py
index 01b6f6f..7d9308d 100644
--- a/reconfigure/items/samba.py
+++ b/reconfigure/items/samba.py
@@ -15,15 +15,18 @@ class ShareData (BoundData):
fields = [
'comment', 'path', 'guest ok', 'browseable', 'create mask', 'directory mask', 'read only',
'follow symlinks', 'wide links', 'fstype', 'write list', 'veto files',
- 'force create mode', 'force directory mode',
+ 'force create mode', 'force directory mode', 'dfree command', 'force user', 'force group',
+ 'valid users', 'read list', 'dfree cache time',
]
defaults = [
'', '', 'no', 'yes', '0744', '0755', 'yes',
- 'yes', 'no', 'NTFS', '', '', '000', '000',
+ 'yes', 'no', 'NTFS', '', '', '000', '000', '',
+ '', '', '', '', '',
]
default_values = [
'', '', False, True, '0744', '0755', True,
- True, False, '', '', '', '000', '000',
+ True, False, '', '', '', '000', '000', '',
+ '', '', '', '', '',
]
def template(self):
diff --git a/reconfigure/items/squid.py b/reconfigure/items/squid.py
index 2504b55..92edbbf 100644
--- a/reconfigure/items/squid.py
+++ b/reconfigure/items/squid.py
@@ -7,7 +7,7 @@ class SquidData (BoundData):
class ACLData (BoundData):
- def template(self, name, *args):
+ def template(self, name=None, *args):
children = [PropertyNode('1', name)]
index = 2
for arg in args:
@@ -54,8 +54,8 @@ class HTTPSPortData (BoundData):
class ArgumentData (BoundData):
- def template(self, *args):
- return PropertyNode(*args)
+ def template(self):
+ return PropertyNode('value', 'none')
def __bind_by_name(cls, prop, name, itemcls):
diff --git a/reconfigure/items/util.py b/reconfigure/items/util.py
index 0a615ed..adb0902 100644
--- a/reconfigure/items/util.py
+++ b/reconfigure/items/util.py
@@ -1,3 +1,4 @@
yn_getter = lambda x: x == 'yes'
-
yn_setter = lambda x: 'yes' if x else 'no'
+onezero_getter = lambda x: x == '1'
+onezero_setter = lambda x: '1' if x else '0'