From a536dad95098f992f5cb5d02ef99052c47335a89 Mon Sep 17 00:00:00 2001 From: LegenJCdary Date: Mon, 29 Aug 2022 12:09:52 +0200 Subject: [PATCH] improve error output when validating options --- source/modules/validators/validate.py | 17 +++++- tests/01-argument_parsing.sh | 78 +++++++++++++-------------- tests/01-argument_parsing_short.sh | 72 ++++++++++++------------- 3 files changed, 90 insertions(+), 77 deletions(-) diff --git a/source/modules/validators/validate.py b/source/modules/validators/validate.py index 1f71bfa9..39cb10e8 100644 --- a/source/modules/validators/validate.py +++ b/source/modules/validators/validate.py @@ -71,12 +71,14 @@ def validate_options(self, options: dict): failed = False for req in required: if not options[req]: - self.logger.error("%s is required for %s", req, options["subcommand"]) + self.logger.error("Option %s is required for %s", self.expand_option_name(req), + options["subcommand"]) failed = True for notsup in notsupported: if options[notsup]: - self.logger.error("%s is not supported by %s", notsup, options["subcommand"]) + self.logger.error("Option %s is not supported by %s", + self.expand_option_name(notsup), options["subcommand"]) failed = True if failed: @@ -244,3 +246,14 @@ def verify_task_permissions(self, selected_items: dict, user_groups: list, confi return True self.logger.debug("Task forbidden") return False + + @staticmethod + def expand_option_name(option: str): + """Expand name of option variable name to option argument name""" + if option == "infra": + option = "infrastructure" + elif option == "raw_output": + option = "raw_runner_output" + + formatted_option = "--" + option.replace("_", "-") + return formatted_option diff --git a/tests/01-argument_parsing.sh b/tests/01-argument_parsing.sh index da09b19b..9cb38011 100755 --- a/tests/01-argument_parsing.sh +++ b/tests/01-argument_parsing.sh @@ -6,55 +6,55 @@ source ./tests/testing_lib.sh echo -e " ___ _ _ _\n / _ \/ | __ _ _ __ __ _ _ _ _ __ ___ ___ _ __ | |_ _ __ __ _ _ __ ___(_)_ __ __ _\n | | | | | _____ / _\` | '__/ _\` | | | | '_ \` _ \ / _ \ '_ \| __| | '_ \ / _\` | '__/ __| | '_ \ / _\` |\n | |_| | | |_____| | (_| | | | (_| | |_| | | | | | | __/ | | | |_ | |_) | (_| | | \__ \ | | | | (_| |\n \___/|_| \__,_|_| \__, |\__,_|_| |_| |_|\___|_| |_|\__| | .__/ \__,_|_| |___/_|_| |_|\__, |\n |___/ |_| |___/\n _ _ _ _\n __ ___ __ ___ _ __ __ _ ___ ___ _ __ ___ | |__ (_)_ __ __ _| |_(_) ___ _ __ ___\n \ \ /\ / / '__/ _ \| '_ \ / _\` | / __/ _ \| '_ \` _ \| '_ \| | '_ \ / _\` | __| |/ _ \| '_ \/ __|\n \ V V /| | | (_) | | | | (_| | | (_| (_) | | | | | | |_) | | | | | (_| | |_| | (_) | | | \__ \ \n \_/\_/ |_| \___/|_| |_|\__, | \___\___/|_| |_| |_|_.__/|_|_| |_|\__,_|\__|_|\___/|_| |_|___/\n |___/\n" # Check wrong combinations check_message_in_output "ansible-deployer" "\[CRITICAL\]: Too few arguments" -check_message_in_output "ansible-deployer run" "\[ERROR\]: task is required for run" -check_message_in_output "ansible-deployer verify" "\[ERROR\]: task is required for verify" -check_message_in_output "ansible-deployer run" "\[ERROR\]: infra is required for run" -check_message_in_output "ansible-deployer verify" "\[ERROR\]: infra is required for verify" -check_message_in_output "ansible-deployer run" "\[ERROR\]: stage is required for run" -check_message_in_output "ansible-deployer verify" "\[ERROR\]: stage is required for verify" -check_message_in_output "ansible-deployer run --task task_exec_bin_true" "\[ERROR\]: stage is required for run" -check_message_in_output "ansible-deployer verify --task task_exec_bin_true" "\[ERROR\]: stage is required for verify" -check_message_in_output "ansible-deployer run --task task_exec_bin_true" "\[ERROR\]: infra is required for run" -check_message_in_output "ansible-deployer verify --task task_exec_bin_true" "\[ERROR\]: infra is required for verify" -check_message_in_output "ansible-deployer run --task task_exec_bin_true --infrastructure testInfra" "stage is required for run" -check_message_in_output "ansible-deployer verify --task task_exec_bin_true --infrastructure testInfra" "stage is required for verify" +check_message_in_output "ansible-deployer run" "\[ERROR\]: Option --task is required for run" +check_message_in_output "ansible-deployer verify" "\[ERROR\]: Option --task is required for verify" +check_message_in_output "ansible-deployer run" "\[ERROR\]: Option --infrastructure is required for run" +check_message_in_output "ansible-deployer verify" "\[ERROR\]: Option --infrastructure is required for verify" +check_message_in_output "ansible-deployer run" "\[ERROR\]: Option --stage is required for run" +check_message_in_output "ansible-deployer verify" "\[ERROR\]: Option --stage is required for verify" +check_message_in_output "ansible-deployer run --task task_exec_bin_true" "\[ERROR\]: Option --stage is required for run" +check_message_in_output "ansible-deployer verify --task task_exec_bin_true" "\[ERROR\]: Option --stage is required for verify" +check_message_in_output "ansible-deployer run --task task_exec_bin_true" "\[ERROR\]: Option --infrastructure is required for run" +check_message_in_output "ansible-deployer verify --task task_exec_bin_true" "\[ERROR\]: Option --infrastructure is required for verify" +check_message_in_output "ansible-deployer run --task task_exec_bin_true --infrastructure testInfra" "Option --stage is required for run" +check_message_in_output "ansible-deployer verify --task task_exec_bin_true --infrastructure testInfra" "Option --stage is required for verify" check_message_in_output "ansible-deployer --task task_exec_bin_true --infrastructure testInfra" "\[CRITICAL\]: First positional argument (subcommand) is required! Available commands are: run, lock, unlock, verify, show." -check_message_in_output "ansible-deployer verify --task task_exec_bin_true --infrastructure testInfra --stage prod --commit testCommit" "commit is not supported by verify" -check_message_in_output "ansible-deployer lock --task task_exec_bin_true --infrastructure testInfra" "\[ERROR\]: task is not supported by lock" -check_message_in_output "ansible-deployer lock --task task_exec_bin_true --infrastructure testInfra --stage prod" "\[ERROR\]: task is not supported by lock" -check_message_in_output "ansible-deployer lock --task task_exec_bin_true --stage prod" "\[ERROR\]: infra is required for lock" -check_message_in_output "ansible-deployer lock --task task_exec_bin_true --stage prod --commit X" "\[ERROR\]: commit is not supported by lock" -check_message_in_output "ansible-deployer lock --infra testInfra --stage prod --keep-locked" "\[ERROR\]: keep_locked is not supported by lock" -check_message_in_output "ansible-deployer lock --task task_exec_bin_true --limit test_hosts_1" "\[ERROR\]: limit is not supported by lock" -check_message_in_output "ansible-deployer lock --infra testInfra --stage prod --raw-runner-output" "\[ERROR\]: raw_output is not supported by lock" -check_message_in_output "ansible-deployer lock --infra testInfra --stage prod --self-setup ." "\[ERROR\]: self_setup is not supported by lock" +check_message_in_output "ansible-deployer verify --task task_exec_bin_true --infrastructure testInfra --stage prod --commit testCommit" "Option --commit is not supported by verify" +check_message_in_output "ansible-deployer lock --task task_exec_bin_true --infrastructure testInfra" "\[ERROR\]: Option --task is not supported by lock" +check_message_in_output "ansible-deployer lock --task task_exec_bin_true --infrastructure testInfra --stage prod" "\[ERROR\]: Option --task is not supported by lock" +check_message_in_output "ansible-deployer lock --task task_exec_bin_true --stage prod" "\[ERROR\]: Option --infrastructure is required for lock" +check_message_in_output "ansible-deployer lock --task task_exec_bin_true --stage prod --commit X" "\[ERROR\]: Option --commit is not supported by lock" +check_message_in_output "ansible-deployer lock --infra testInfra --stage prod --keep-locked" "\[ERROR\]: Option --keep-locked is not supported by lock" +check_message_in_output "ansible-deployer lock --task task_exec_bin_true --limit test_hosts_1" "\[ERROR\]: Option --limit is not supported by lock" +check_message_in_output "ansible-deployer lock --infra testInfra --stage prod --raw-runner-output" "\[ERROR\]: Option --raw-runner-output is not supported by lock" +check_message_in_output "ansible-deployer lock --infra testInfra --stage prod --self-setup ." "\[ERROR\]: Option --self-setup is not supported by lock" -check_message_in_output "ansible-deployer unlock --task task_exec_bin_true --infrastructure testInfra" "\[ERROR\]: task is not supported by unlock" -check_message_in_output "ansible-deployer unlock --task task_exec_bin_true --infrastructure testInfra --stage prod" "\[ERROR\]: task is not supported by unlock" -check_message_in_output "ansible-deployer unlock --task task_exec_bin_true --stage test" "\[ERROR\]: infra is required for unlock" -check_message_in_output "ansible-deployer unlock --task task_exec_bin_true --stage prod --commit X" "\[ERROR\]: commit is not supported by unlock" -check_message_in_output "ansible-deployer unlock --infra testInfra --stage prod --keep-locked" "\[ERROR\]: keep_locked is not supported by unlock" -check_message_in_output "ansible-deployer unlock --task task_exec_bin_true --limit test_hosts_1" "\[ERROR\]: limit is not supported by unlock" -check_message_in_output "ansible-deployer unlock --infra testInfra --stage prod --raw-runner-output" "\[ERROR\]: raw_output is not supported by unlock" -check_message_in_output "ansible-deployer unlock --infra testInfra --stage prod --self-setup ." "\[ERROR\]: self_setup is not supported by unlock" +check_message_in_output "ansible-deployer unlock --task task_exec_bin_true --infrastructure testInfra" "\[ERROR\]: Option --task is not supported by unlock" +check_message_in_output "ansible-deployer unlock --task task_exec_bin_true --infrastructure testInfra --stage prod" "\[ERROR\]: Option --task is not supported by unlock" +check_message_in_output "ansible-deployer unlock --task task_exec_bin_true --stage test" "\[ERROR\]: Option --infrastructure is required for unlock" +check_message_in_output "ansible-deployer unlock --task task_exec_bin_true --stage prod --commit X" "\[ERROR\]: Option --commit is not supported by unlock" +check_message_in_output "ansible-deployer unlock --infra testInfra --stage prod --keep-locked" "\[ERROR\]: Option --keep-locked is not supported by unlock" +check_message_in_output "ansible-deployer unlock --task task_exec_bin_true --limit test_hosts_1" "\[ERROR\]: Option --limit is not supported by unlock" +check_message_in_output "ansible-deployer unlock --infra testInfra --stage prod --raw-runner-output" "\[ERROR\]: Option --raw-runner-output is not supported by unlock" +check_message_in_output "ansible-deployer unlock --infra testInfra --stage prod --self-setup ." "\[ERROR\]: Option --self-setup is not supported by unlock" check_message_in_output "ansible-deployer run test" "\[CRITICAL\]: Too many positional arguments! Only subcommand \"show\" can accept following arguments: all, task, infra." check_message_in_output "ansible-deployer verify test" "\[CRITICAL\]: Too many positional arguments! Only subcommand \"show\" can accept following arguments: all, task, infra." check_message_in_output "ansible-deployer lock test" "\[CRITICAL\]: Too many positional arguments! Only subcommand \"show\" can accept following arguments: all, task, infra." check_message_in_output "ansible-deployer unlock test" "\[CRITICAL\]: Too many positional arguments! Only subcommand \"show\" can accept following arguments: all, task, infra." check_message_in_output "ansible-deployer show test" "\[CRITICAL\]: Invalid argument test! Subcommand \"show\" can accept only following arguments: all, task, infra." -check_message_in_output "ansible-deployer show --commit task_exec_bin_true" "\[ERROR\]: commit is not supported by show" -check_message_in_output "ansible-deployer show --limit test_hosts_1" "\[ERROR\]: limit is not supported by show" -check_message_in_output "ansible-deployer show --task task_exec_bin_true" "\[ERROR\]: task is not supported by show" -check_message_in_output "ansible-deployer show --infra testInfra" "\[ERROR\]: infra is not supported by show" -check_message_in_output "ansible-deployer show --stage prod" "\[ERROR\]: stage is not supported by show" -check_message_in_output "ansible-deployer show --dry" "\[ERROR\]: dry is not supported by show" -check_message_in_output "ansible-deployer show --keep-locked" "\[ERROR\]: keep_locked is not supported by show" -check_message_in_output "ansible-deployer show --syslog" "\[ERROR\]: syslog is not supported by show" -check_message_in_output "ansible-deployer show --raw-runner-output" "\[ERROR\]: raw_output is not supported by show" -check_message_in_output "ansible-deployer show --self-setup ." "\[ERROR\]: self_setup is not supported by show" +check_message_in_output "ansible-deployer show --commit task_exec_bin_true" "\[ERROR\]: Option --commit is not supported by show" +check_message_in_output "ansible-deployer show --limit test_hosts_1" "\[ERROR\]: Option --limit is not supported by show" +check_message_in_output "ansible-deployer show --task task_exec_bin_true" "\[ERROR\]: Option --task is not supported by show" +check_message_in_output "ansible-deployer show --infra testInfra" "\[ERROR\]: Option --infrastructure is not supported by show" +check_message_in_output "ansible-deployer show --stage prod" "\[ERROR\]: Option --stage is not supported by show" +check_message_in_output "ansible-deployer show --dry" "\[ERROR\]: Option --dry is not supported by show" +check_message_in_output "ansible-deployer show --keep-locked" "\[ERROR\]: Option --keep-locked is not supported by show" +check_message_in_output "ansible-deployer show --syslog" "\[ERROR\]: Option --syslog is not supported by show" +check_message_in_output "ansible-deployer show --raw-runner-output" "\[ERROR\]: Option --raw-runner-output is not supported by show" +check_message_in_output "ansible-deployer show --self-setup ." "\[ERROR\]: Option --self-setup is not supported by show" echo -e " ___ _ _ _\n / _ \/ | __ _ _ __ __ _ _ _ _ __ ___ ___ _ __ | |_ _ __ __ _ _ __ ___(_)_ __ __ _\n | | | | | _____ / _\` | '__/ _\` | | | | '_ \` _ \ / _ \ '_ \| __| | '_ \ / _\` | '__/ __| | '_ \ / _\` |\n | |_| | | |_____| | (_| | | | (_| | |_| | | | | | | __/ | | | |_ | |_) | (_| | | \__ \ | | | | (_| |\n \___/|_| \__,_|_| \__, |\__,_|_| |_| |_|\___|_| |_|\__| | .__/ \__,_|_| |___/_|_| |_|\__, |\n |___/ |_| |___/\n _ _ _ _ _\n ___ ___ _ __ _ __ ___ ___| |_ ___ ___ _ __ ___ | |__ (_)_ __ __ _| |_(_) ___ _ __ ___\n / __/ _ \| '__| '__/ _ \/ __| __| / __/ _ \| '_ \` _ \| '_ \| | '_ \ / _\` | __| |/ _ \| '_ \/ __|\n | (_| (_) | | | | | __/ (__| |_ | (_| (_) | | | | | | |_) | | | | | (_| | |_| | (_) | | | \__ \ \n \___\___/|_| |_| \___|\___|\__| \___\___/|_| |_| |_|_.__/|_|_| |_|\__,_|\__|_|\___/|_| |_|___/\n" # Check if correct combinations are accepted diff --git a/tests/01-argument_parsing_short.sh b/tests/01-argument_parsing_short.sh index 24a2991f..157df93a 100755 --- a/tests/01-argument_parsing_short.sh +++ b/tests/01-argument_parsing_short.sh @@ -6,55 +6,55 @@ source ./tests/testing_lib.sh echo -e " ___ _ _ _ _ _\n / _ \/ | __ _ _ __ __ _ _ _ _ __ ___ ___ _ __ | |_ _ __ __ _ _ __ ___(_)_ __ __ _ ___| |__ ___ _ __| |_\n | | | | | _____ / _\` | '__/ _\` | | | | '_ \` _ \ / _ \ '_ \| __| | '_ \ / _\` | '__/ __| | '_ \ / _\` | / __| '_ \ / _ \| '__| __|\n | |_| | | |_____| | (_| | | | (_| | |_| | | | | | | __/ | | | |_ | |_) | (_| | | \__ \ | | | | (_| | \__ \ | | | (_) | | | |_\n \___/|_| \__,_|_| \__, |\__,_|_| |_| |_|\___|_| |_|\__| | .__/ \__,_|_| |___/_|_| |_|\__, | |___/_| |_|\___/|_| \__|\n |___/ |_| |___/\n _ _ _ _\n __ ___ __ ___ _ __ __ _ ___ ___ _ __ ___ | |__ (_)_ __ __ _| |_(_) ___ _ __ ___\n \ \ /\ / / '__/ _ \| '_ \ / _\` | / __/ _ \| '_ \` _ \| '_ \| | '_ \ / _\` | __| |/ _ \| '_ \/ __|\n \ V V /| | | (_) | | | | (_| | | (_| (_) | | | | | | |_) | | | | | (_| | |_| | (_) | | | \__ \ \n \_/\_/ |_| \___/|_| |_|\__, | \___\___/|_| |_| |_|_.__/|_|_| |_|\__,_|\__|_|\___/|_| |_|___/\n |___/\n" # Check wrong combinations check_message_in_output "ansible-deployer" "\[CRITICAL\]: Too few arguments" -check_message_in_output "ansible-deployer run" "\[ERROR\]: task is required for run" -check_message_in_output "ansible-deployer verify" "\[ERROR\]: task is required for verify" -check_message_in_output "ansible-deployer run" "\[ERROR\]: infra is required for run" -check_message_in_output "ansible-deployer verify" "\[ERROR\]: infra is required for verify" -check_message_in_output "ansible-deployer run" "\[ERROR\]: stage is required for run" -check_message_in_output "ansible-deployer verify" "\[ERROR\]: stage is required for verify" -check_message_in_output "ansible-deployer run -t task_exec_bin_true" "\[ERROR\]: stage is required for run" -check_message_in_output "ansible-deployer verify -t task_exec_bin_true" "\[ERROR\]: stage is required for verify" -check_message_in_output "ansible-deployer run -t task_exec_bin_true" "\[ERROR\]: infra is required for run" -check_message_in_output "ansible-deployer verify -t task_exec_bin_true" "\[ERROR\]: infra is required for verify" +check_message_in_output "ansible-deployer run" "\[ERROR\]: Option --task is required for run" +check_message_in_output "ansible-deployer verify" "\[ERROR\]: Option --task is required for verify" +check_message_in_output "ansible-deployer run" "\[ERROR\]: Option --infrastructure is required for run" +check_message_in_output "ansible-deployer verify" "\[ERROR\]: Option --infrastructure is required for verify" +check_message_in_output "ansible-deployer run" "\[ERROR\]: Option --stage is required for run" +check_message_in_output "ansible-deployer verify" "\[ERROR\]: Option --stage is required for verify" +check_message_in_output "ansible-deployer run -t task_exec_bin_true" "\[ERROR\]: Option --stage is required for run" +check_message_in_output "ansible-deployer verify -t task_exec_bin_true" "\[ERROR\]: Option --stage is required for verify" +check_message_in_output "ansible-deployer run -t task_exec_bin_true" "\[ERROR\]: Option --infrastructure is required for run" +check_message_in_output "ansible-deployer verify -t task_exec_bin_true" "\[ERROR\]: Option --infrastructure is required for verify" check_message_in_output "ansible-deployer run -t task_exec_bin_true -i testInfra" "stage is required for run" check_message_in_output "ansible-deployer verify -t task_exec_bin_true -i testInfra" "stage is required for verify" check_message_in_output "ansible-deployer -t task_exec_bin_true -i testInfra" "\[CRITICAL\]: First positional argument (subcommand) is required! Available commands are: run, lock, unlock, verify, show." check_message_in_output "ansible-deployer verify -t task_exec_bin_true -i testInfra -s prod -c testCommit" "commit is not supported by verify" -check_message_in_output "ansible-deployer lock -t task_exec_bin_true -i testInfra" "\[ERROR\]: task is not supported by lock" -check_message_in_output "ansible-deployer lock -t task_exec_bin_true -i testInfra -s prod" "\[ERROR\]: task is not supported by lock" -check_message_in_output "ansible-deployer lock -t task_exec_bin_true -s prod" "\[ERROR\]: infra is required for lock" -check_message_in_output "ansible-deployer lock -t task_exec_bin_true -s prod -c X" "\[ERROR\]: commit is not supported by lock" -check_message_in_output "ansible-deployer lock -i testInfra -s prod --keep-locked" "\[ERROR\]: keep_locked is not supported by lock" -check_message_in_output "ansible-deployer lock -t task_exec_bin_true -l test_hosts_1" "\[ERROR\]: limit is not supported by lock" -check_message_in_output "ansible-deployer lock -i testInfra -s prod --raw-runner-output" "\[ERROR\]: raw_output is not supported by lock" -check_message_in_output "ansible-deployer lock -i testInfra -s prod --self-setup ." "\[ERROR\]: self_setup is not supported by lock" +check_message_in_output "ansible-deployer lock -t task_exec_bin_true -i testInfra" "\[ERROR\]: Option --task is not supported by lock" +check_message_in_output "ansible-deployer lock -t task_exec_bin_true -i testInfra -s prod" "\[ERROR\]: Option --task is not supported by lock" +check_message_in_output "ansible-deployer lock -t task_exec_bin_true -s prod" "\[ERROR\]: Option --infrastructure is required for lock" +check_message_in_output "ansible-deployer lock -t task_exec_bin_true -s prod -c X" "\[ERROR\]: Option --commit is not supported by lock" +check_message_in_output "ansible-deployer lock -i testInfra -s prod --keep-locked" "\[ERROR\]: Option --keep-locked is not supported by lock" +check_message_in_output "ansible-deployer lock -t task_exec_bin_true -l test_hosts_1" "\[ERROR\]: Option --limit is not supported by lock" +check_message_in_output "ansible-deployer lock -i testInfra -s prod --raw-runner-output" "\[ERROR\]: Option --raw-runner-output is not supported by lock" +check_message_in_output "ansible-deployer lock -i testInfra -s prod --self-setup ." "\[ERROR\]: Option --self-setup is not supported by lock" -check_message_in_output "ansible-deployer unlock -t task_exec_bin_true -i testInfra" "\[ERROR\]: task is not supported by unlock" -check_message_in_output "ansible-deployer unlock -t task_exec_bin_true -i testInfra -s prod" "\[ERROR\]: task is not supported by unlock" -check_message_in_output "ansible-deployer unlock -t task_exec_bin_true -s test" "\[ERROR\]: infra is required for unlock" -check_message_in_output "ansible-deployer unlock -t task_exec_bin_true -s prod -c X" "\[ERROR\]: commit is not supported by unlock" -check_message_in_output "ansible-deployer unlock -i testInfra -s prod --keep-locked" "\[ERROR\]: keep_locked is not supported by unlock" -check_message_in_output "ansible-deployer unlock -t task_exec_bin_true -l test_hosts_1" "\[ERROR\]: limit is not supported by unlock" -check_message_in_output "ansible-deployer unlock -i testInfra -s prod --raw-runner-output" "\[ERROR\]: raw_output is not supported by unlock" -check_message_in_output "ansible-deployer unlock -i testInfra -s prod --self-setup ." "\[ERROR\]: self_setup is not supported by unlock" +check_message_in_output "ansible-deployer unlock -t task_exec_bin_true -i testInfra" "\[ERROR\]: Option --task is not supported by unlock" +check_message_in_output "ansible-deployer unlock -t task_exec_bin_true -i testInfra -s prod" "\[ERROR\]: Option --task is not supported by unlock" +check_message_in_output "ansible-deployer unlock -t task_exec_bin_true -s test" "\[ERROR\]: Option --infrastructure is required for unlock" +check_message_in_output "ansible-deployer unlock -t task_exec_bin_true -s prod -c X" "\[ERROR\]: Option --commit is not supported by unlock" +check_message_in_output "ansible-deployer unlock -i testInfra -s prod --keep-locked" "\[ERROR\]: Option --keep-locked is not supported by unlock" +check_message_in_output "ansible-deployer unlock -t task_exec_bin_true -l test_hosts_1" "\[ERROR\]: Option --limit is not supported by unlock" +check_message_in_output "ansible-deployer unlock -i testInfra -s prod --raw-runner-output" "\[ERROR\]: Option --raw-runner-output is not supported by unlock" +check_message_in_output "ansible-deployer unlock -i testInfra -s prod --self-setup ." "\[ERROR\]: Option --self-setup is not supported by unlock" check_message_in_output "ansible-deployer run test" "\[CRITICAL\]: Too many positional arguments! Only subcommand \"show\" can accept following arguments: all, task, infra." check_message_in_output "ansible-deployer verify test" "\[CRITICAL\]: Too many positional arguments! Only subcommand \"show\" can accept following arguments: all, task, infra." check_message_in_output "ansible-deployer lock test" "\[CRITICAL\]: Too many positional arguments! Only subcommand \"show\" can accept following arguments: all, task, infra." check_message_in_output "ansible-deployer unlock test" "\[CRITICAL\]: Too many positional arguments! Only subcommand \"show\" can accept following arguments: all, task, infra." check_message_in_output "ansible-deployer show test" "\[CRITICAL\]: Invalid argument test! Subcommand \"show\" can accept only following arguments: all, task, infra." -check_message_in_output "ansible-deployer show -c task_exec_bin_true" "\[ERROR\]: commit is not supported by show" -check_message_in_output "ansible-deployer show -l test_hosts_1" "\[ERROR\]: limit is not supported by show" -check_message_in_output "ansible-deployer show -t task_exec_bin_true" "\[ERROR\]: task is not supported by show" -check_message_in_output "ansible-deployer show -i testInfra" "\[ERROR\]: infra is not supported by show" -check_message_in_output "ansible-deployer show -s prod" "\[ERROR\]: stage is not supported by show" -check_message_in_output "ansible-deployer show --dry" "\[ERROR\]: dry is not supported by show" -check_message_in_output "ansible-deployer show --keep-locked" "\[ERROR\]: keep_locked is not supported by show" -check_message_in_output "ansible-deployer show --syslog" "\[ERROR\]: syslog is not supported by show" -check_message_in_output "ansible-deployer show --raw-runner-output" "\[ERROR\]: raw_output is not supported by show" -check_message_in_output "ansible-deployer show --self-setup ." "\[ERROR\]: self_setup is not supported by show" +check_message_in_output "ansible-deployer show -c task_exec_bin_true" "\[ERROR\]: Option --commit is not supported by show" +check_message_in_output "ansible-deployer show -l test_hosts_1" "\[ERROR\]: Option --limit is not supported by show" +check_message_in_output "ansible-deployer show -t task_exec_bin_true" "\[ERROR\]: Option --task is not supported by show" +check_message_in_output "ansible-deployer show -i testInfra" "\[ERROR\]: Option --infrastructure is not supported by show" +check_message_in_output "ansible-deployer show -s prod" "\[ERROR\]: Option --stage is not supported by show" +check_message_in_output "ansible-deployer show --dry" "\[ERROR\]: Option --dry is not supported by show" +check_message_in_output "ansible-deployer show --keep-locked" "\[ERROR\]: Option --keep-locked is not supported by show" +check_message_in_output "ansible-deployer show --syslog" "\[ERROR\]: Option --syslog is not supported by show" +check_message_in_output "ansible-deployer show --raw-runner-output" "\[ERROR\]: Option --raw-runner-output is not supported by show" +check_message_in_output "ansible-deployer show --self-setup ." "\[ERROR\]: Option --self-setup is not supported by show" echo -e " ___ _ _ _ _ _\n / _ \/ | __ _ _ __ __ _ _ _ _ __ ___ ___ _ __ | |_ _ __ __ _ _ __ ___(_)_ __ __ _ ___| |__ ___ _ __| |_\n | | | | | _____ / _\` | '__/ _\` | | | | '_ \` _ \ / _ \ '_ \| __| | '_ \ / _\` | '__/ __| | '_ \ / _\` | / __| '_ \ / _ \| '__| __|\n | |_| | | |_____| | (_| | | | (_| | |_| | | | | | | __/ | | | |_ | |_) | (_| | | \__ \ | | | | (_| | \__ \ | | | (_) | | | |_\n \___/|_| \__,_|_| \__, |\__,_|_| |_| |_|\___|_| |_|\__| | .__/ \__,_|_| |___/_|_| |_|\__, | |___/_| |_|\___/|_| \__|\n |___/ |_| |___/\n _ _ _ _ _\n ___ ___ _ __ _ __ ___ ___| |_ ___ ___ _ __ ___ | |__ (_)_ __ __ _| |_(_) ___ _ __ ___\n / __/ _ \| '__| '__/ _ \/ __| __| / __/ _ \| '_ \` _ \| '_ \| | '_ \ / _\` | __| |/ _ \| '_ \/ __|\n | (_| (_) | | | | | __/ (__| |_ | (_| (_) | | | | | | |_) | | | | | (_| | |_| | (_) | | | \__ \ \n \___\___/|_| |_| \___|\___|\__| \___\___/|_| |_| |_|_.__/|_|_| |_|\__,_|\__|_|\___/|_| |_|___/\n" # Check if correct combinations are accepted