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 #9554] Don't allow "ignore where" for groups when there's no "assign where" #3120

Closed
icinga-migration opened this issue Jul 3, 2015 · 8 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/9554

Created by penyilas on 2015-07-03 11:14:21 +00:00

Assignee: mfriedrich
Status: Resolved (closed on 2015-07-16 11:56:18 +00:00)
Target Version: 2.3.8
Last Update: 2015-07-20 06:52:47 +00:00 (in Redmine)

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

Hi,

Here's my simple setup:

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

  vars.environment = "prod"
}

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

  vars.environment = "test"
}

apply Service "service1" {

  groups += [ SG1 ]
  assign where match("host*", host.name)
}

object ServiceGroup "SG1" {
  ignore where host.vars.environment == "prod"
}

I'd like to exclude non production hosts' services from servicegroup, but it's not working...

I'm using icinga2-2.3.5-1.el7.centos.x86_64 (CentOS7)

Thanks

Changesets

2015-07-16 11:56:12 +00:00 by (unknown) 51d0e71

Don't allow "ignore where" for groups when there's no "assign where"

fixes #9554

2015-07-20 06:52:35 +00:00 by (unknown) 92aa963

Don't allow "ignore where" for groups when there's no "assign where"

fixes #9554

Relations:

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-07-09 08:40:05 +00:00

  • Description updated

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-07-09 08:44:51 +00:00

You are explicitely assigning the service group membership in your service apply rule with

groups += [ SG1 ]

The service group ignore where rule does not have any effect for explicitly assigned group memberships.

We should probably add a warning when an 'ignore where' expression misses an 'assign where' expression before.

@icinga-migration
Copy link
Author

Updated by penyilas on 2015-07-13 17:22:49 +00:00

dnsmichi wrote:

You are explicitely assigning the service group membership in your service apply rule with

[...]

The service group ignore where rule does not have any effect for explicitly assigned group memberships.

We should probably add a warning when an 'ignore where' expression misses an 'assign where' expression before.
Ok, I can understand... thanks

@icinga-migration
Copy link
Author

Updated by gbeutner on 2015-07-16 08:40:07 +00:00

  • Subject changed from Servicegroup ignore not working to Don't allow "ignore where" for groups when there's no "assign where"
  • Category set to Configuration

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-07-16 11:52:30 +00:00

  • Relates set to 9535

@icinga-migration
Copy link
Author

Updated by mfriedrich on 2015-07-16 11:55:45 +00:00

  • Status changed from New to Assigned
  • Assigned to set to mfriedrich
  • Target Version set to 2.4.0
  • Estimated Hours set to 0.5

Take that as a test config from #9535, slightly modified.

Works

template Service "ignore-svc-tmpl" {
  //ignore where match("*", host.name)
  //assign where true
}

object Host "test-12345" {
  check_command = "ping4"
  vars.test = [ 1, 2, 3, 4 ]
}

apply Service "test-1234" for (i in host.vars.test) {
  import "ignore-svc-tmpl"
  check_command = "ping4"

  log(i)
  //assign where true
  ignore where i > 2
}

object HostGroup "test-ignore" {
  assign where true
  ignore where false
}

Broken

With an applied fix.

object HostGroup "test-ignore" {
  //assign where true
  ignore where false
}

critical/config: Error: object rule 'ignore' is missing 'assign' for type 'HostGroup'
Location:
/etc/icinga2/tests/ignore.conf(18): }
/etc/icinga2/tests/ignore.conf(19): 
/etc/icinga2/tests/ignore.conf(20): object HostGroup "test-ignore" {
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/etc/icinga2/tests/ignore.conf(21):   //assign where true
/etc/icinga2/tests/ignore.conf(22):   ignore where false

@icinga-migration
Copy link
Author

Updated by Anonymous on 2015-07-16 11:56:18 +00:00

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

Applied in changeset 51d0e71.

@icinga-migration
Copy link
Author

Updated by gbeutner on 2015-07-20 06:52:47 +00:00

  • Target Version changed from 2.4.0 to 2.3.8
  • 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.8 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