Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce verbose ansible and set a basic one #19256

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

hadeskun
Copy link
Contributor

@hadeskun hadeskun commented May 7, 2024

Reduce verbosity on ansible outputs

Copy link

github-actions bot commented May 7, 2024

Great PR! Please pay attention to the following items before merging:

Files matching lib/**.pm:

  • Consider adding or extending unit tests in t/

This is an automatically generated QA checklist based on modified files.

@@ -540,7 +540,7 @@ sub qesap_execute_conditional_retry {
$args{retries} //= 1;

my @ret = qesap_execute(cmd => $args{cmd},
verbose => $args{verbose},
($args{cmd} eq 'ansible' ? () : (verbose => '--verbose')),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strange syntax in the middle of conditional code. How it works?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If $args{cmd} is equal to 'ansible', the condition is true, so () is returned. This is an empty list.
If $args{cmd} is not equal to 'ansible', the condition is false, so (verbose => '--verbose') is returned. That means verbosity will be activate with the '-vvv'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If $args{cmd} is the same as the ansible string, then return an empty list; otherwise return a list with 2 elements: verbose and --verbose.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have to add that this works because the ternary operator is limiting a list of 0 or 2 elements from being added to %args ... if it were an odd number, it could create trouble.

Copy link
Contributor

@alvarocarvajald alvarocarvajald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM, but:

1. Can we get some examples on how the ansible output looks with and without these commits
2. Can you clean up the commits in the PR? You have 7 commits for a change that's not too big. The commits also include 4 branch merges which shouldn't be propagated to the master branch.

Copy link
Contributor

@alvarocarvajald alvarocarvajald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code LGTM, but:

  1. Can we get some examples on how the ansible output looks with and without these commits
  2. Can you clean up the commits in the PR? You have 7 commits for a change that's not too big. The commits also include 4 branch merges which shouldn't be propagated to the master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants