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

[dev.icinga.com #10205] config checker reports wrong error on apply for rules #3428

Closed
icinga-migration opened this issue Sep 23, 2015 · 5 comments
Labels
area/configuration DSL, parser, compiler, error handling bug Something isn't working
Milestone

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/10205

Created by arlecchino on 2015-09-23 16:02:55 +00:00

Assignee: gbeutner
Status: Resolved (closed on 2015-09-24 06:30:47 +00:00)
Target Version: 2.3.11
Last Update: 2015-09-25 12:38:51 +00:00 (in Redmine)

Icinga Version: 2.3.10
Backport?: Already backported
Include in Changelog: 1

If the rule uses a Dictionary iterator syntax and the value is an array the reported error is:
"critical/config: Error: Array iterator requires value to be an array."

Other way round:
If the rule uses an Array iterator syntax and the value is a dictionary the reported error is:
"critical/config: Error: Dictionary iterator requires value to be a dictionary."

I don't think this error reporting makes sense.

Changesets

2015-09-24 06:30:03 +00:00 by (unknown) 0c10d64

Fix incorrect error messages for apply-for

fixes #10205

2015-09-25 12:38:40 +00:00 by (unknown) 992e045

Fix incorrect error messages for apply-for

fixes #10205
@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-09-23 16:14:35 +00:00

  • Category set to Configuration
  • Status changed from New to Feedback
  • Assigned to set to arlecchino

Please attach the configuration snippets and detailed error output in order to reproduce your description.

@icinga-migration
Copy link
Author

Updated by arlecchino on 2015-09-23 18:08:45 +00:00

Configuration:

object Host "ahost" {
  import "generic-host"

  check_command = "dummy"

  address = "127.0.0.1"
  vars.os = "Linux"

  vars.zones = ["zone1", "zone2", "zone3"]
}


apply Service "reproduce" for (cfg => zone in host.vars.zones) {
  import "generic-service"

  check_command = "dummy"

  vars.zone = zone

  assign where host.vars.zones
}

This reports error:
critical/config: Error: Array iterator requires value to be an array.

At apply Service "reproduce" for (cfg => zone in host.vars.zones):

  1. I don't see any array iterator.
  2. host.vars.zones is an array.

So what the error message wants to tell me?!
Shouldn't this instead report "Dictionary iterator requires value to be a dictionary"?
Then I would have understood what was wrong.

IMO you simply have twisted the 2 error messages.

@icinga-migration
Copy link
Author

Updated by gbeutner on 2015-09-24 06:28:41 +00:00

  • Status changed from Feedback to Assigned
  • Assigned to changed from arlecchino to gbeutner
  • Target Version set to 2.4.0

"for (cfg => zone in host.vars.zones" is a dictionary iterator, i.e. it expects host.vars.zones to be a dictionary and iterates over each key-value pair.

The problem here is that the error message is incorrect. It should be: "Dictionary iterator requires value to be a dictionary."

@icinga-migration
Copy link
Author

Updated by Anonymous on 2015-09-24 06:30:47 +00:00

  • Status changed from Assigned to Resolved
  • Done % changed from 0 to 100

Applied in changeset 0c10d64.

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-09-25 12:38:51 +00:00

  • Target Version changed from 2.4.0 to 2.3.11
  • Backport? changed from TBD to Yes

@icinga-migration icinga-migration added bug Something isn't working area/configuration DSL, parser, compiler, error handling labels Jan 17, 2017
@icinga-migration icinga-migration added this to the 2.3.11 milestone Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/configuration DSL, parser, compiler, error handling bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant