MCPcopy Create free account
hub / github.com/Keeper-Security/Commander / _validate_command_args

Function _validate_command_args

docker_ksm_utility.py:643–690  ·  view source on GitHub ↗

Validate command line arguments. Args: args: Parsed command line arguments Returns: bool: True if valid, False otherwise

(args)

Source from the content-addressed store, hash-verified

641# =============================================================================
642
643def _validate_command_args(args):
644 """
645 Validate command line arguments.
646
647 Args:
648 args: Parsed command line arguments
649
650 Returns:
651 bool: True if valid, False otherwise
652 """
653 # Handle process-config command separately
654 if args.command == 'process-config':
655 if not args.ksm_config:
656 print("ERROR: --ksm-config is required for process-config command")
657 return False
658 return True
659
660 # For other commands, validate required parameters
661 if not args.record_uid:
662 print("ERROR: --record-uid is required for this command")
663 return False
664
665 if not args.config_file:
666 print("ERROR: --config-file is required for this command")
667 return False
668
669 # Validate authentication parameters
670 if not args.ksm_config and not args.ksm_token:
671 print("Either --ksm-config or --ksm-token must be provided")
672 return False
673
674 if args.ksm_config and args.ksm_token:
675 print("Cannot specify both --ksm-config and --ksm-token")
676 return False
677
678 # Validate file paths early
679 if args.ksm_config:
680 is_valid, _ = validate_file_path(args.ksm_config)
681 if not is_valid:
682 print("Invalid KSM config file path")
683 return False
684
685 is_valid, _ = validate_file_path(args.config_file)
686 if not is_valid:
687 print("Invalid config file path")
688 return False
689
690 return True
691
692
693def _execute_command(args):

Callers 1

mainFunction · 0.85

Calls 1

validate_file_pathFunction · 0.85

Tested by

no test coverage detected