VSYSCONF="/etc/vsys.conf"
VSYSBKEND="/vsys"
-def start(options, conf):
+def start():
logger.log("vsys: plugin starting up...")
def GetSlivers(data, config=None, plc=None):
_restart = createVsysDir(sliver['name']) or _restart
if attribute['value'] in scripts.keys():
scripts[attribute['value']].append(sliver['name'])
-
+
# Write the conf
_restart = writeConf(slices, parseConf()) or _restart
# Write out the ACLs
def createVsysDir(sliver):
'''Create /vsys directory in slice. Update vsys conf file.'''
- try:
+ try:
os.mkdir("/vservers/%s/vsys" % sliver)
return True
- except OSError:
+ except OSError:
return False
def touchAcls():
- '''Creates empty acl files for scripts.
+ '''Creates empty acl files for scripts.
To be ran in case of new scripts that appear in the backend.
Returns list of available scripts.'''
acls = []
f = open("%s/%s.acl" %(VSYSBKEND, new), "w")
f.write("\n")
f.close()
-
+
return scripts
f = open(root+"/"+file,"r+")
scriptname = file.replace(".acl", "")
scriptacls[scriptname] = []
- for slice in f.readlines():
+ for slice in f.readlines():
scriptacls[scriptname].append(slice.rstrip())
f.close()
# return what scripts are configured for which slices.
'''Parse the vsys conf and return list of slices in conf.'''
scriptacls = {}
slicesinconf = []
- try:
+ try:
f = open(VSYSCONF)
for line in f.readlines():
(path, slice) = line.split()