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

Allow to specify both vars + config as custom vars using hash #566

Closed
pieterjanpintens opened this issue Jun 6, 2019 · 3 comments
Closed
Assignees

Comments

@pieterjanpintens
Copy link

We are currently working on puppet migration for icinga.
We came need to migrate service objects that specify both:

vars += config
vars.prio = 'high'

I tried some combinations but it seems that this is not possible yet using a proper icinga2::object::service. Would it be possible to make this work with an empty key in the hash? For example:

  icinga2::object::service { 'ping4':
    apply => 'ping => config in host.vars.ping',
    target => '/etc/icinga2/conf.d/services.conf',

    groups => ['system'],
    vars => {
      '' => 'vars + config',
      'prio' => 'high',
      'extra_info' => 'This check does a ping to the configured IP of the instance',
    },
    assign => [
      'host.vars.os == Ubuntu',
    ]
  }

At the moment this would generate:

vars. = vars + config
vars.prio = "high"

This is of course invalid syntax (there is a dot too much). But since it does not make much sense to use an empty hash key anyway I think an extra check in the parser can ensure that this becomes.

vars = vars + config
vars.prio = "high"

This way one can combine both constructions.

Your Environment

  • Module version (2.1.1):
  • Puppet version (6.4):
  • Operating System and version: ubuntu 18.04
@pieterjanpintens
Copy link
Author

pieterjanpintens commented Jun 6, 2019

I'm willing to make an attempt for a fix and Pull Request if you are willing to take it

@lbetz
Copy link
Contributor

lbetz commented Jun 6, 2019

I'm not sure if I like this syntax. Or maybe something like that:

vars => [ 'config', { prio => 'high'} ]

should returns:

vars += config
vars.prio = "high"

I'll have a look in the evening how complicate it will be.

@lbetz
Copy link
Contributor

lbetz commented Jul 12, 2019

refs #574

@lbetz lbetz removed the enhancement label Jul 12, 2019
@lbetz lbetz removed this from the 2.2.0 milestone Jul 12, 2019
@lbetz lbetz closed this as completed Jul 12, 2019
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

No branches or pull requests

2 participants