Add PLC_HRN_ROOT to usual config variables
[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_HRN_ROOT",
19     "PLC_ROOT_USER",
20     "PLC_ROOT_PASSWORD",
21     "PLC_MAIL_ENABLED",
22     "PLC_MAIL_SUPPORT_ADDRESS",
23     "PLC_DB_HOST",
24     "PLC_API_HOST",
25     "PLC_WWW_HOST",
26     "PLC_BOOT_HOST",
27     "PLC_NET_DNS1",
28     "PLC_NET_DNS2",
29     ]
30
31 configuration={ \
32     'name':'plc',
33     'service':"plc",
34     'usual_variables':usual_variables,
35     'config_dir':"/etc/planetlab",
36     'validate_variables':{"PLC_API":"MAINTENANCE_USER","PLC":"ROOT_USER"},
37     'validator':validator,
38     }
39
40 if __name__ == '__main__':
41     command=sys.argv[0]
42     argv = sys.argv[1:]
43     plc_config.main(command,argv,configuration)