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 #13035] Wrong syntax of "apply" in object.conf.erb template (afaik) #143

Closed
icinga-migration opened this issue Nov 3, 2016 · 7 comments
Labels
Milestone

Comments

@icinga-migration
Copy link

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

Created by alorenzi on 2016-11-03 11:43:53 +00:00

Assignee: bsheqa
Status: Closed (closed on 2016-11-10 16:01:21 +00:00)
Target Version: v0.6.0
Last Update: 2016-11-10 16:18:46 +00:00 (in Redmine)


file: ./templates/object.conf.erb

at the moment it create a file like this:

apply for ( xxxxx )

should be

apply  "" to  etc etc etc 

Relations:

@icinga-migration
Copy link
Author

@icinga-migration
Copy link
Author

Updated by bsheqa on 2016-11-08 10:22:13 +00:00

  • Target Version set to v0.6.0

@icinga-migration
Copy link
Author

Updated by bsheqa on 2016-11-08 10:48:37 +00:00

Apply rules can be used in multiple ways. Generally an apply rule can target either a host or a service.
A Service apply rule targets a host implicitly, therefore you don't need to set a target in your icinga2 config. BUT you can do so if you wish.
Icinga2 is not consequent with the configuration here, because for all other object types that can be applied you must set the target. For services its optional.
An apply target can either be a service or a host, nothing else.

Beside the described default way, there is also a configuration with 'apply for'. With that you can create a loop to apply objects based on a set of arrays or hashes combined with expressions.

To cover all these cases, my solution would be this:

  • When $apply is true or a string, the object is an apply rule. The 'apply' keyword must only be used in the template if $apply is not false.
  • When parameter $apply_target is either 'Host' or 'Service' the rule will have a target, therefore will not be a 'apply for' loop. (apply $object_type to $apply_target)
  • Check if $object_type and $apply_target are not the same. (A service cannot be applied to a service)
  • If parameter $apply_target unset and $apply is a string, we create an 'apply for' loop with $apply as expression (apply for ($apply))

I would not differ service object types from other object types. Service apply rules can work without setting a target, but they also work with it. By setting the target for every object type we handle all types the same way and I like this better.

Please give me feedback on this. I hope this would cover all cases in a "simple to use" way.

@icinga-migration
Copy link
Author

Updated by bsheqa on 2016-11-08 10:52:34 +00:00

  • Relates set to 12349

@icinga-migration
Copy link
Author

Updated by alorenzi on 2016-11-08 11:50:19 +00:00

Simple to use but hard to understand, i had to read a couple of times. :)

Anyway, make sense.

@icinga-migration
Copy link
Author

Updated by bsheqa on 2016-11-10 16:01:21 +00:00

  • Status changed from New to Closed
  • Assigned to set to bsheqa
  • Done % changed from 0 to 100

@icinga-migration
Copy link
Author

Updated by alorenzi on 2016-11-10 16:18:46 +00:00

thanks :)

@icinga-migration icinga-migration added this to the v0.6.0 milestone Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant