Validate command line arguments. Args: args: Parsed command line arguments Returns: bool: True if valid, False otherwise
(args)
| 676 | # ============================================================================= |
| 677 | |
| 678 | def _validate_command_args(args): |
| 679 | """ |
| 680 | Validate command line arguments. |
| 681 | |
| 682 | Args: |
| 683 | args: Parsed command line arguments |
| 684 | |
| 685 | Returns: |
| 686 | bool: True if valid, False otherwise |
| 687 | """ |
| 688 | # Handle process-config command separately |
| 689 | if args.command == 'process-config': |
| 690 | if not args.ksm_config: |
| 691 | print("ERROR: --ksm-config is required for process-config command") |
| 692 | return False |
| 693 | return True |
| 694 | |
| 695 | # For other commands, validate required parameters |
| 696 | if not args.record_uid: |
| 697 | print("ERROR: --record-uid is required for this command") |
| 698 | return False |
| 699 | |
| 700 | if not args.config_file: |
| 701 | print("ERROR: --config-file is required for this command") |
| 702 | return False |
| 703 | |
| 704 | # Validate authentication parameters |
| 705 | if not args.ksm_config and not args.ksm_token: |
| 706 | print("Either --ksm-config or --ksm-token must be provided") |
| 707 | return False |
| 708 | |
| 709 | if args.ksm_config and args.ksm_token: |
| 710 | print("Cannot specify both --ksm-config and --ksm-token") |
| 711 | return False |
| 712 | |
| 713 | # Validate file paths early |
| 714 | if args.ksm_config: |
| 715 | is_valid, _ = validate_file_path(args.ksm_config) |
| 716 | if not is_valid: |
| 717 | print("Invalid KSM config file path") |
| 718 | return False |
| 719 | |
| 720 | is_valid, _ = validate_file_path(args.config_file) |
| 721 | if not is_valid: |
| 722 | print("Invalid config file path") |
| 723 | return False |
| 724 | |
| 725 | return True |
| 726 | |
| 727 | |
| 728 | def _execute_command(args): |
no test coverage detected