From 79508bee86ab18d92fe83a83845429be50417ea6 Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Wed, 27 Apr 2016 03:55:09 +0200 Subject: Added support for fine-grained installation steps. https://fedorahosted.org/pki/ticket/2244 --- base/server/sbin/pkispawn | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/base/server/sbin/pkispawn b/base/server/sbin/pkispawn index 7c38cf915..58946aa3d 100755 --- a/base/server/sbin/pkispawn +++ b/base/server/sbin/pkispawn @@ -104,6 +104,18 @@ def main(argv): 'PKI Instance Installation and Configuration', log.PKISPAWN_EPILOG) + parser.arg_parser.add_argument( + '--start-from', + dest='start_from', action='store', + nargs='?', metavar='', + help='execute installation starting from the specified scriptlet') + + parser.arg_parser.add_argument( + '--stop-at', + dest='stop_at', action='store', + nargs='?', metavar='', + help='stop installation before the specified scriptlet') + parser.optional.add_argument( '-f', dest='user_deployment_cfg', action='store', @@ -519,14 +531,40 @@ def main(argv): deployer.init() try: + # by default run all scriptlets from the beginning + run_scriptlet = True + + # if starting point defined, don't run from the beginning + if args.start_from: + + if args.start_from not in pki_subsystem_scriptlets: + raise Exception('Invalid starting point: %s' % args.start_from) + + run_scriptlet = False + + if args.stop_at and args.stop_at not in pki_subsystem_scriptlets: + raise Exception('Invalid stopping point: %s' % args.stop_at) + for scriptlet_name in pki_subsystem_scriptlets: + # skip the scriptlets before the starting point + if not run_scriptlet: + + if args.start_from and args.start_from == scriptlet_name: + run_scriptlet = True + + else: + continue + + # if stopping point found, stop the execution + if args.stop_at == scriptlet_name: + break + scriptlet_module = __import__( "pki.server.deployment.scriptlets." + scriptlet_name, fromlist=[scriptlet_name]) scriptlet = scriptlet_module.PkiScriptlet() - scriptlet.spawn(deployer) # pylint: disable=W0703 -- cgit