The new option --config-profile accepts a INI style file, so that
installation options are passed in via a file. this is useful for
testing and automated installs.
This file can have 2 sections: globals, arguments.
The globals section can change global variable in the install script
like: TEMPLATES, CONFDIR, DATADIR, HTTPDCONFD and so on, so that an
installation can use non-standad directories.
The argumets section accepts any argument option.
The config profile file is parsed after all arguments have parsed and
can override any plugin argument.
Signed-off-by: Simo Sorce <simo@redhat.com>
from ipsilon.tools.certs import Certificate
from ipsilon.tools import files
import argparse
from ipsilon.tools.certs import Certificate
from ipsilon.tools import files
import argparse
import logging
import os
import pwd
import logging
import os
import pwd
+def parse_config_profile(args):
+ config = ConfigParser.ConfigParser()
+ files = config.read(args['config_profile'])
+ if len(files) == 0:
+ raise ConfigurationError('Config Profile file %s not found!' %
+ args['config_profile'])
+
+ if 'globals' in config.sections():
+ G = config.options('globals')
+ for g in G:
+ val = config.get('globals', g)
+ if val == 'False':
+ val = False
+ elif val == 'True':
+ val = True
+ if g in globals():
+ globals()[g] = val
+ else:
+ for k in globals().keys():
+ if k.lower() == g.lower():
+ globals()[k] = val
+ break
+
+ if 'arguments' in config.sections():
+ A = config.options('arguments')
+ for a in A:
+ val = config.get('arguments', a)
+ if val == 'False':
+ val = False
+ elif val == 'True':
+ val = True
+ args[a] = val
+
+ return args
+
+
def parse_args():
global args
def parse_args():
global args
default=True, help="Turn on all security checks")
parser.add_argument('--debug', action='store_true', default=False,
help="Turn on script debugging")
default=True, help="Turn on all security checks")
parser.add_argument('--debug', action='store_true', default=False,
help="Turn on script debugging")
+ parser.add_argument('--config-profile', default=None,
+ help="File containing install options")
parser.add_argument('--uninstall', action='store_true',
help="Uninstall the server and all data")
args = vars(parser.parse_args())
parser.add_argument('--uninstall', action='store_true',
help="Uninstall the server and all data")
args = vars(parser.parse_args())
+ if args['config_profile']:
+ args = parse_config_profile(args)
+
if len(args['hostname'].split('.')) < 2:
raise ValueError('Hostname: %s is not a FQDN.')
if len(args['hostname'].split('.')) < 2:
raise ValueError('Hostname: %s is not a FQDN.')
from ipsilon.helpers.common import EnvHelpersInstall
from ipsilon.util.data import Store
from ipsilon.tools import files
from ipsilon.helpers.common import EnvHelpersInstall
from ipsilon.util.data import Store
from ipsilon.tools import files
import argparse
import cherrypy
import logging
import argparse
import cherrypy
import logging
+def parse_config_profile(args):
+ config = ConfigParser.ConfigParser()
+ files = config.read(args['config_profile'])
+ if len(files) == 0:
+ raise ConfigurationError('Config Profile file %s not found!' %
+ args['config_profile'])
+
+ if 'globals' in config.sections():
+ G = config.options('globals')
+ for g in G:
+ val = config.get('globals', g)
+ if g in globals():
+ globals()[g] = val
+ else:
+ for k in globals().keys():
+ if k.lower() == g.lower():
+ globals()[k] = val
+ break
+
+ if 'arguments' in config.sections():
+ A = config.options('arguments')
+ for a in A:
+ args[a] = config.get('arguments', a)
+
+ return args
+
+
def parse_args(plugins):
parser = argparse.ArgumentParser(description='Ipsilon Install Options')
parser.add_argument('--version',
def parse_args(plugins):
parser = argparse.ArgumentParser(description='Ipsilon Install Options')
parser.add_argument('--version',
help="User account used to run the server")
parser.add_argument('--admin-user', default='admin',
help="User account that is assigned admin privileges")
help="User account used to run the server")
parser.add_argument('--admin-user', default='admin',
help="User account that is assigned admin privileges")
+ parser.add_argument('--config-profile', default=None,
+ help="File containing install options")
parser.add_argument('--uninstall', action='store_true',
help="Uninstall the server and all data")
parser.add_argument('--uninstall', action='store_true',
help="Uninstall the server and all data")
args = vars(parser.parse_args())
args = vars(parser.parse_args())
+ if args['config_profile']:
+ args = parse_config_profile(args)
+
if not args['hostname']:
args['hostname'] = socket.getfqdn()
if not args['hostname']:
args['hostname'] = socket.getfqdn()