[Freeipa-devel] [PATCHES] PoC: improve CLI and config option processing for installer

Martin Babinsky mbabinsk at redhat.com
Tue Nov 10 13:12:42 UTC 2015


these patches are a rough PoC of a new machinery that abstracts option 
handling/processing for installers ported on Jan's new installer 
framework and also implement https://fedorahosted.org/freeipa/ticket/4517

The code is admittedly ugly but functional and demonstrated the base 
architecture of the module. The user-facing entrypoints are the 
FrontendManager function call and the individual Frontend 
implementations which handle processing of options.

Here is a short example of the usage:

"""
# we want the Server installer to accept options from both CLI and
# config file

ServerCLIConfig = FrontendManager(Server, ConfigFrontend, CLIFrontend)

# add frontend-specific options to external option parser
# in case of CLIFrontend, all installer knobs are fed to the parser as # 
options
# in case of ConfigFrontend, a single option is added which holds
# the location of config file
option_parser = IPAOptionParser()
ServerCLIConfig.add_options(option_parser)

# let the parser parse the command line
options, args = option_parser.parse_args(sys.argv[1:])

# get and validate all CLI/config options, instantiate the Server
# configurator and run installation

ServerCLIConfig.run(options, args)

"""

The second patch contains some basic tests for the new functionality

The third patch in the series plugs this functionality into the existing 
CLI interface in a particularly nasty but (sorta-) functional way.

I would very much appreciate any of your comments concerning the whole 
design and implementation. Suggestions to clean up the code are most 
welcome.

-- 
Martin^3 Babinsky
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-mbabinsk-0003-POC-plug-the-new-option-handling-machinery-to-ipa-se.patch
Type: text/x-patch
Size: 14127 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20151110/61904001/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-mbabinsk-0002-POC-test-suite-for-the-CLI-config-option-handlers.patch
Type: text/x-patch
Size: 13222 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20151110/61904001/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-mbabinsk-0001-POC-modular-processing-of-installer-options-from-mul.patch
Type: text/x-patch
Size: 15210 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20151110/61904001/attachment-0002.bin>


More information about the Freeipa-devel mailing list