Add user configuration option
authorSimo Sorce <simo@redhat.com>
Wed, 19 Mar 2014 20:30:53 +0000 (16:30 -0400)
committerSimo Sorce <simo@redhat.com>
Thu, 20 Mar 2014 21:28:02 +0000 (17:28 -0400)
This allow to specifify what system user should be used to configure
the ipsilon server to run as.

Signed-off-by: Simo Sorce <simo@redhat.com>
ipsilon/install/server.py

index 70b3caa..28e5bdb 100755 (executable)
@@ -23,6 +23,7 @@ import argparse
 import cherrypy
 import logging
 import os
 import cherrypy
 import logging
 import os
+import pwd
 import shutil
 import socket
 import sys
 import shutil
 import socket
 import sys
@@ -129,6 +130,8 @@ def parse_args(plugins):
                         help='Comma separated list of login managers')
     parser.add_argument('--hostname',
                         help="Machine's fully qualified host name")
                         help='Comma separated list of login managers')
     parser.add_argument('--hostname',
                         help="Machine's fully qualified host name")
+    parser.add_argument('--system-user', default='ipsilon',
+                        help="User account used to run the server")
     parser.add_argument('--ipa', choices=['yes', 'no'], default='yes',
                         help='Detect and use an IPA server for authentication')
     parser.add_argument('--uninstall', action='store_true',
     parser.add_argument('--ipa', choices=['yes', 'no'], default='yes',
                         help='Detect and use an IPA server for authentication')
     parser.add_argument('--uninstall', action='store_true',
@@ -152,6 +155,11 @@ def parse_args(plugins):
     if len(args['hostname'].split('.')) < 2:
         raise ConfigurationError('Hostname: %s is not a FQDN')
 
     if len(args['hostname'].split('.')) < 2:
         raise ConfigurationError('Hostname: %s is not a FQDN')
 
+    try:
+        pwd.getpwnam(args['system_user'])
+    except KeyError:
+        raise ConfigurationError('User: %s not found on the system')
+
     if args['lm_order'] is None:
         args['lm_order'] = []
         for name in lms:
     if args['lm_order'] is None:
         args['lm_order'] = []
         for name in lms: