#
# Script for basic access to the SFA configuration file store.
#
-# $Id$
-#
import sys
import os
sys.exit(1)
-def deprecated (message):
- print "%s: deprecated usage"%sys.argv[0]
+def deprecated(message):
+ print "%s: deprecated usage" % sys.argv[0]
print message
sys.exit(1)
+
def main():
config = Config()
fileobjs = []
for (opt, optval) in opts:
if opt == "--shell" or \
- opt == "--bash":
+ opt == "--bash":
output = config.output_shell
elif opt == "--python":
output = config.output_python
elif opt == "--value":
variable['value'] = optval
elif opt == "--group":
-# group['id'] = optval
+ # group['id'] = optval
deprecated("option --group deprecated -- use .lst files instead")
elif opt == "--package":
-# package['name'] = optval
+ # package['name'] = optval
deprecated("option --package deprecated -- use .lst files instead")
elif opt == "--type":
package['type'] = optval
elif opt == '-s' or opt == "--save":
if not optval:
usage()
- print 'parsed save option',optval
+ print 'parsed save option', optval
save = optval
elif opt == '-h' or opt == "--help":
usage()
# --save
if save:
# create directory if needed
- # so that plc.d/{api,postgres} can create configs/site.xml
- dirname = os.path.dirname (save)
- if (not os.path.exists (dirname)):
- os.makedirs(dirname,0755)
- if (not os.path.exists (dirname)):
+ # so that plc.d/{api,postgres} can create configs/site.xml
+ dirname = os.path.dirname(save)
+ if (not os.path.exists(dirname)):
+ os.makedirs(dirname, 0755)
+ if (not os.path.exists(dirname)):
print "Cannot create dir %s - exiting" % dirname
sys.exit(1)
config.save(save)