From 5df0e54326966a71640368784f22f399c5f467ec Mon Sep 17 00:00:00 2001 From: Swetha Lohith <126152564+swethalohith2@users.noreply.github.com> Date: Fri, 2 Aug 2024 17:50:24 +0530 Subject: [PATCH] Verify tls (#98) * enhance docs * remove --verify-tls from usage * enhance verify-tls * enhance verify-tls * enhance verify-tls --- README.md | 2 +- synctl/cli.py | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index fc27300..fd22a6c 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ After export the variables then command can be run without any options. # Usage ``` -Usage: synctl [--verify-tls] [options] +Usage: synctl [options] Options: -h, --help show this help message and exit diff --git a/synctl/cli.py b/synctl/cli.py index 71b2656..a3f2629 100755 --- a/synctl/cli.py +++ b/synctl/cli.py @@ -100,7 +100,7 @@ def show_version(): def general_helper() -> None: - m = """Usage: synctl [--verify-tls] [options] + m = """Usage: synctl [options] Options: -h, --help show this help message and exit @@ -4383,8 +4383,6 @@ def __init__(self) -> None: def global_options(self): self.parser.add_argument( '--version', '-v', action="store_true", default=True, help="show version") - self.parser.add_argument( - "--verify-tls", action="store_true", default=False, help="verify tls certificate") def config_command_options(self): self.parser_config.add_argument( @@ -4401,6 +4399,8 @@ def config_command_options(self): '--default', action="store_true", help='set as default') def create_command_options(self): + self.parser_create.add_argument( + "--verify-tls", action="store_true", default=False, help="verify tls certificate") self.parser_create.add_argument( 'syn_type', type=str, choices=["test", "cred", "alert"], metavar="test/cred/alert", help="specify test/cred/alert") @@ -4525,6 +4525,8 @@ def create_command_options(self): def get_command_options(self): + self.parser_get.add_argument( + "--verify-tls", action="store_true", default=False, help="verify tls certificate") self.parser_get.add_argument( 'op_type', choices=['location', 'lo', 'test', 'application', 'app', 'cred', 'alert', 'alert-channel', 'result', 'pop-size', 'size', 'pop-cost', 'cost'], help="command list") @@ -4579,6 +4581,8 @@ def get_command_options(self): '--token', type=str, metavar="", help='set token') def patch_command_options(self): + self.parser_patch.add_argument( + "--verify-tls", action="store_true", default=False, help="verify tls certificate") self.parser_patch.add_argument( 'syn_type', type=str, choices=["test"], help="Synthetic type, only test support") @@ -4660,6 +4664,8 @@ def patch_command_options(self): '--token', type=str, metavar="", help='set token') def update_command_options(self): + self.parser_update.add_argument( + "--verify-tls", action="store_true", default=False, help="verify tls certificate") self.parser_update.add_argument( 'syn_type', type=str, choices=["test", "alert", "cred"], help="Synthetic type/ smart alert/ credential") self.parser_update.add_argument( @@ -4769,6 +4775,8 @@ def update_command_options(self): '--token', type=str, metavar="", help='set token') def delete_command_options(self): + self.parser_delete.add_argument( + "--verify-tls", action="store_true", default=False, help="verify tls certificate") self.parser_delete.add_argument( 'delete_type', choices=['location', 'lo', 'test', 'cred', 'alert'], help='specify Synthetic type: location/test/credential/smart alert') self.parser_delete.add_argument( @@ -4930,7 +4938,6 @@ def main(): auth_instance.remove_an_item_from_config(get_args.env) elif COMMAND_GET == get_args.sub_command: - if get_args.op_type == SYN_TEST: # synctl_instanace.synctl_get() # deal test @@ -5046,6 +5053,7 @@ def main(): elif get_args.op_type == POP_COST or get_args.op_type == 'cost': pop_estimate.print_estimated_cost() elif COMMAND_CREATE == get_args.sub_command: + if get_args.syn_type == SYN_CRED: cred_payload = CredentialConfiguration() if get_args.key is not None: