/bin/env is not safe (macos) - prefer /usr/bin/env instead
[myplc.git] / bin / plc-config-tty
1 #!/usr/bin/env python
2
3 import sys
4 import readline
5 import plc_config
6
7 def validator(validated_variables):
8     maint_user = validated_variables["PLC_API_MAINTENANCE_USER"]
9     root_user = validated_variables["PLC_ROOT_USER"]
10     if maint_user == root_user:
11         errStr="PLC_API_MAINTENANCE_USER=%s cannot be the same as PLC_ROOT_USER=%s"%(maint_user,root_user)
12         raise plc_config.ConfigurationException(errStr)
13
14 usual_variables = [
15     "PLC_NAME",
16     "PLC_SHORTNAME",
17     "PLC_SLICE_PREFIX",
18     "PLC_ROOT_USER",
19     "PLC_ROOT_PASSWORD",
20     "PLC_MAIL_ENABLED",
21     "PLC_MAIL_SUPPORT_ADDRESS",
22     "PLC_DB_HOST",
23     "PLC_API_HOST",
24     "PLC_WWW_HOST",
25     "PLC_BOOT_HOST",
26     "PLC_NET_DNS1",
27     "PLC_NET_DNS2",
28     ]
29
30 configuration={ \
31     'name':'plc',
32     'service':"plc",
33     'usual_variables':usual_variables,
34     'config_dir':"/etc/planetlab",
35     'validate_variables':{"PLC_API":"MAINTENANCE_USER","PLC":"ROOT_USER"},
36     'validator':validator,
37     }
38
39 if __name__ == '__main__':
40     command=sys.argv[0]
41     argv = sys.argv[1:]
42     plc_config.main(command,argv,configuration)