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