4 """vsys configurator. Maintains ACLs and script pipes inside vservers based on slice attributes."""
10 def start(options, config):
14 """For each sliver with the vsys attribute, set the script ACL, create the vsys directory in the slice, and restart vsys."""
15 confedSlivers = parseConf("/etc/vsys.conf")
17 for sliver in data['slivers']:
18 for attribute in sliver['attributes']:
19 if attribute['name'] == 'vsys':
20 # As the name implies, when we find an attribute, we
22 if sliver['name'] not in confedSlivers: newSlivers.append(sliver['name'])
24 writeConf(confedSlivers + newSlivers, "/etc/vsys.conf")
28 def createVsysDir(sliver):
29 '''Create /vsys directory in slice. Update vsys conf file.'''
30 try: os.makedirs("/vservers/%s/vsys" % sliver['name'])
35 '''Parse the vserver conf. Return [slices] in conf.'''
38 for line in f.readlines():
39 (slice, path) = line.split()
45 def writeConf(slivers, file):
47 for sliver in slivers:
48 f.write("/vservers/%(name)s/vsys %(name)s\n" % {"name": sliver})