From 0f0f7681e97ea10b391b991b6609a08854dc9ed0 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Thu, 11 May 2023 10:55:14 -0400 Subject: [PATCH] cephadm: move the definition of most deploy args into a function Moving the bulk of the arguments specific to the `deploy` command will allow future reuse of these arguments. Signed-off-by: John Mulligan --- src/cephadm/cephadm.py | 122 +++++++++++++++++++++-------------------- 1 file changed, 63 insertions(+), 59 deletions(-) diff --git a/src/cephadm/cephadm.py b/src/cephadm/cephadm.py index 5d982db700a..824408b096a 100755 --- a/src/cephadm/cephadm.py +++ b/src/cephadm/cephadm.py @@ -9397,6 +9397,68 @@ def command_maintenance(ctx: CephadmContext) -> str: ################################## +def _add_deploy_parser_args(parser_deploy: argparse.ArgumentParser) -> None: + parser_deploy.add_argument( + '--config', '-c', + help='config file for new daemon') + parser_deploy.add_argument( + '--config-json', + help='Additional configuration information in JSON format') + parser_deploy.add_argument( + '--keyring', + help='keyring for new daemon') + parser_deploy.add_argument( + '--key', + help='key for new daemon') + parser_deploy.add_argument( + '--osd-fsid', + help='OSD uuid, if creating an OSD container') + parser_deploy.add_argument( + '--skip-firewalld', + action='store_true', + help='Do not configure firewalld') + parser_deploy.add_argument( + '--tcp-ports', + help='List of tcp ports to open in the host firewall') + parser_deploy.add_argument( + '--reconfig', + action='store_true', + help='Reconfigure a previously deployed daemon') + parser_deploy.add_argument( + '--allow-ptrace', + action='store_true', + help='Allow SYS_PTRACE on daemon container') + parser_deploy.add_argument( + '--container-init', + action='store_true', + default=CONTAINER_INIT, + help=argparse.SUPPRESS) + parser_deploy.add_argument( + '--memory-request', + help='Container memory request/target' + ) + parser_deploy.add_argument( + '--memory-limit', + help='Container memory hard limit' + ) + parser_deploy.add_argument( + '--meta-json', + help='JSON dict of additional metadata' + ) + parser_deploy.add_argument( + '--extra-container-args', + action='append', + default=[], + help='Additional container arguments to apply to daemon' + ) + parser_deploy.add_argument( + '--extra-entrypoint-args', + action='append', + default=[], + help='Additional entrypoint arguments to apply to deamon' + ) + + def _get_parser(): # type: () -> argparse.ArgumentParser parser = argparse.ArgumentParser( @@ -9899,65 +9961,7 @@ def _get_parser(): '--fsid', required=True, help='cluster FSID') - parser_deploy.add_argument( - '--config', '-c', - help='config file for new daemon') - parser_deploy.add_argument( - '--config-json', - help='Additional configuration information in JSON format') - parser_deploy.add_argument( - '--keyring', - help='keyring for new daemon') - parser_deploy.add_argument( - '--key', - help='key for new daemon') - parser_deploy.add_argument( - '--osd-fsid', - help='OSD uuid, if creating an OSD container') - parser_deploy.add_argument( - '--skip-firewalld', - action='store_true', - help='Do not configure firewalld') - parser_deploy.add_argument( - '--tcp-ports', - help='List of tcp ports to open in the host firewall') - parser_deploy.add_argument( - '--reconfig', - action='store_true', - help='Reconfigure a previously deployed daemon') - parser_deploy.add_argument( - '--allow-ptrace', - action='store_true', - help='Allow SYS_PTRACE on daemon container') - parser_deploy.add_argument( - '--container-init', - action='store_true', - default=CONTAINER_INIT, - help=argparse.SUPPRESS) - parser_deploy.add_argument( - '--memory-request', - help='Container memory request/target' - ) - parser_deploy.add_argument( - '--memory-limit', - help='Container memory hard limit' - ) - parser_deploy.add_argument( - '--meta-json', - help='JSON dict of additional metadata' - ) - parser_deploy.add_argument( - '--extra-container-args', - action='append', - default=[], - help='Additional container arguments to apply to daemon' - ) - parser_deploy.add_argument( - '--extra-entrypoint-args', - action='append', - default=[], - help='Additional entrypoint arguments to apply to deamon' - ) + _add_deploy_parser_args(parser_deploy) parser_check_host = subparsers.add_parser( 'check-host', help='check host configuration') -- 2.39.5