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

Add common option --change-output-adv #5155

Conversation

garnier-quentin
Copy link
Contributor

@garnier-quentin garnier-quentin commented Aug 30, 2024

Community contributors

Description

Add a common option to change the short output and the exit code at the same time.

CTOR-820

Type of change

  • Patch fixing an issue (non-breaking change)
  • New functionality (non-breaking change)
  • Functionality enhancement or optimization (non-breaking change)
  • Breaking change (patch or feature) that might cause side effects breaking part of the Software

How this pull request can be tested ?

--change-output-adv='%(short_output) =~ /No daemon/ and %(exit_code) == 0,OK: no daemon,OK'

Checklist

  • I have followed the coding style guidelines provided by Centreon
  • I have commented my code, especially hard-to-understand areas of the PR.
  • I have rebased my development branch on the base branch (develop).
  • I have provide data or shown output displaying the result of this code in the plugin area concerned.

@omercier
Copy link
Contributor

Hi @garnier-quentin,
Have you tried solving your issue with --change-short-output/--change-long-output and --change-exit. I suppose so but just to make sure.

@omercier omercier force-pushed the CTOR-820-option-change-output-adv branch from 8f460d5 to efbfa9d Compare January 7, 2025 15:25
push @{$self->{change_output_adv}}, {
expr => $expr,
short_output => $short_output,
exit_code => defined($exit_code) && $exit_code ne '' && $self->{errors}->{uc($exit_code)} ? uc($exit_code) : undef
Copy link
Contributor

@omercier omercier Jan 7, 2025

Choose a reason for hiding this comment

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

If you use OK here, it will return 0 => false => exit_code will be set to undef ;-)
I'll use defined() in the final PR.

EDIT: done #5379

@omercier
Copy link
Contributor

omercier commented Jan 7, 2025

Pull request replaced with #5379

@omercier omercier closed this Jan 7, 2025
omercier added a commit that referenced this pull request Jan 13, 2025
…it code (#5155, #5379)

Co-authored-by: garnier-quentin <garnier.quentin@gmail.com>
Refs: CTOR-820
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhance existing external
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants