Validate command line arguments. Args: args: Parsed command line arguments Returns: bool: True if valid, False otherwise
(args)
| 641 | # ============================================================================= |
| 642 | |
| 643 | def _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 | |
| 693 | def _execute_command(args): |
no test coverage detected