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

Make http_header repeatable (fixes #8573) #8574

Merged
merged 3 commits into from
Oct 1, 2021
Merged

Make http_header repeatable (fixes #8573) #8574

merged 3 commits into from
Oct 1, 2021

Conversation

peteeckel
Copy link
Contributor

@peteeckel peteeckel commented Dec 21, 2020

fixes #8573.

@icinga-probot icinga-probot bot added this to the 2.13.0 milestone Dec 21, 2020
@@ -502,7 +502,8 @@ object CheckCommand "http" {
}
"-k" = {
value = "$http_header$"
description = "Any other tags to be sent in http header"
description = "Any other tags to be sent in http header (may be repeated)"
repeat_key = true
Copy link
Member

Choose a reason for hiding this comment

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

Are you sure this is needed?

"If the argument value is an array, repeat the argument key, or not. Defaults to true (repeat)."
https://icinga.com/docs/icinga-2/latest/doc/09-object-types/#checkcommand-arguments

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Argh ... probably not. But it is specified explicitly in several other places (even in the same config file).

It also might have pretty strange results with the current default when someone repeats a key for a value where the plugin does not allow repetition. But that's a different story.

Copy link
Member

Choose a reason for hiding this comment

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

So... we'll probably close this one?

Copy link
Contributor Author

@peteeckel peteeckel Dec 24, 2020

Choose a reason for hiding this comment

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

The question is whether to close it or add the flag for clarification's sake. It doesn't hurt after all, and IMO it makes the usage of the command clearer - I wouldn't have brought this up at all had the repeat_key attribute been specified for the command (or had it not been specified for other command options).

Copy link
Member

Choose a reason for hiding this comment

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

Yes, it makes sense to clarify this in the descriptions. Please have a look how the other commands describe it.

@julianbrost julianbrost modified the milestones: 2.13.0, 2.14.0 May 31, 2021
@peteeckel
Copy link
Contributor Author

There is unfortunately not too much of standard practice in wording the description it seems. I adjusted the wording in the documentation to the most common statement.

Copy link
Member

@Al2Klimov Al2Klimov left a comment

Choose a reason for hiding this comment

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

Rebase the PR onto the current master, so that it contains only your changes. Sure, I've build PRs on each other myself, but 413 commits suggest that something went terribly wrong.

Or – better:

  1. Pull our master
  2. Checkout your branch
  3. git merge --no-edit master
  4. git reset --soft master

This should make you fall back to I've changed and git-added everything, but not committed, yet. Of course on top of the current master and with everything of your desired changes.

@peteeckel
Copy link
Contributor Author

Indeed, something did go terribly wrong ... should be OK now.

@Al2Klimov
Copy link
Member

... except repeat_key = true.

Copy link
Member

@Al2Klimov Al2Klimov left a comment

Choose a reason for hiding this comment

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

Oh and one more thing:

@@ -656,7 +656,7 @@ http_method | **Optional.** Set http method (for example: H
http_maxage | **Optional.** Warn if document is more than seconds old.
http_contenttype | **Optional.** Specify Content-Type header when POSTing.
http_useragent | **Optional.** String to be sent in http header as User Agent.
http_header | **Optional.** Any other tags to be sent in http header.
http_header | **Optional.** Any other tags to be sent in http header. Can be an array if multiple headers should be passed to `check_http'.
Copy link
Member

Choose a reason for hiding this comment

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

Why not to take a shorter clarification...

@@ -502,7 +502,7 @@ object CheckCommand "http" {
}
"-k" = {
value = "$http_header$"
description = "Any other tags to be sent in http header"
description = "Any other tags to be sent in http header (may be repeated)"
Copy link
Member

Choose a reason for hiding this comment

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

... e.g. from here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's how I formulated it in the first PR. I took it from your answer "Please have a look how the other commands describe it." that you weren't satisfied with it (and I agree, it could be clearer).

Copy link
Member

Choose a reason for hiding this comment

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

Ah! Sorry!

Copy link
Member

Choose a reason for hiding this comment

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

So the other commands do it like you did here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As I wrote above, I could not make out a "standard phrasing" for the fact that a parameter accepts arrays. In the command definitions sometimes it's "may be repeated", sometimes "may be used repeatedly".

In the documentation file the wording is even more inconsistent (just a few examples):

doc/10-icinga-template-library.md:1208:smtp_command          | **Optional.** SMTP command (may be used repeatedly).
doc/10-icinga-template-library.md:1209:smtp_response         | **Optional.** Expected response to command (may be used repeatedly).
doc/10-icinga-template-library.md:206:apt_include             | **Optional.** Include only packages matching REGEXP. Can be specified multiple times the values will be combined together.
doc/10-icinga-template-library.md:207:apt_exclude             | **Optional.** Exclude packages matching REGEXP from the list of packages that would otherwise be included. Can be specified multiple times.
doc/10-icinga-template-library.md:240:by_ssh_command     | **Required.** The command that should be executed. Can be an array if multiple arguments should be passed to `check_by_ssh`.
doc/10-icinga-template-library.md:356:disk\_ignore\_eregi\_path | **Optional.** Regular expression to ignore selected path/partition (case insensitive). Multiple regular expression strings must be defined as array.
doc/10-icinga-template-library.md:1937:nscp_disk_exclude      | **Optional.** Drive character, default to none. Can be an array of drive characters if multiple drives should be excluded.

But generally, the documentation is a bit more verbose than the descriptions from the command definition.

@peteeckel
Copy link
Contributor Author

peteeckel commented Jul 29, 2021

It makes sense not to specify default options explicitly, agreed.

What about the other ones? There are 9 other instances in command-plugins.conf alone ...

pete@ardbeg icinga2 % git grep -ni 'repeat_key.*true'  itl/command-plugins.conf
itl/command-plugins.conf:1366:                  repeat_key = true
itl/command-plugins.conf:1430:                  repeat_key = true
itl/command-plugins.conf:1435:                  repeat_key = true
itl/command-plugins.conf:1440:                  repeat_key = true
itl/command-plugins.conf:1446:                  repeat_key = true
itl/command-plugins.conf:1460:                  repeat_key = true
itl/command-plugins.conf:1465:                  repeat_key = true
itl/command-plugins.conf:2537:                  repeat_key = true
itl/command-plugins.conf:3126:                  repeat_key = true

Copy link
Member

@Al2Klimov Al2Klimov left a comment

Choose a reason for hiding this comment

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

OK. Change

`check_http'

to

`check_http`

and it’s fine for me.

Copy link
Member

@Al2Klimov Al2Klimov left a comment

Choose a reason for hiding this comment

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

Fine. (The merger will have to adjust the GH merge button to squash your three commits.)

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

Successfully merging this pull request may close these issues.

check_http -k option not correctly specified in ITL CheckCommand "http"
3 participants