Giter Site home page Giter Site logo

Support Hash Lookup Type about hiera-regex HOT 10 CLOSED

jjulien avatar jjulien commented on July 30, 2024
Support Hash Lookup Type

from hiera-regex.

Comments (10)

calvn avatar calvn commented on July 30, 2024

I am currently encountering this issue. If the class variable is a hash, hiera-regex does not look for it. Is there going to be a fix for this any time in the near future?

from hiera-regex.

jjulien avatar jjulien commented on July 30, 2024

@cleung2010, hiera-regex supports returning hash values, this ticket is for merging multiple hashed values from more than one matched key. If you are not getting any value returned at all there is likely something wrong with your hierarchy, regex, or this is a different bug.

Can you provide more details to reproduce this?

from hiera-regex.

calvn avatar calvn commented on July 30, 2024

I am using a module called puppet-consul, and there is a class variable named config_hash: https://github.com/solarkennedy/puppet-consul/blob/master/manifests/init.pp

I tried using hiera-regex to fill a key-value pair in that hash like so:

---
 - 'localdc[0-9]{1}':
    consul::config_hash:
        datacenter: 'dc1'

However, the datacenter value does not seem to appear anywhere after the puppet run.

from hiera-regex.

calvn avatar calvn commented on July 30, 2024

It might be also worth mentioning that I have config_hash defined in my default.pp (or site.pp). I only want certain KV pairs from configh_hash to be in hiera so it might be because it is, as you pointed out, not doing the merge.

from hiera-regex.

jjulien avatar jjulien commented on July 30, 2024

Hey @cleung2010 ,
If you are passing in config_hash then hiera will never look that up or attempt to merge it. Sounds like you don't need hiera hash merging but puppet hash merging. If you have the puppetlabs-stdlib module installed, it supports this. Your class would need to do something like this.

class consul($config_hash) {
  $merged_config = merge($config_hash, hiera('consul::config_hash'))
}

Since you don't control the consul class, you could probably just do the merge in site.pp instead.

class {'consul':
    config_hash => merge({'somekey' => 'somevalue'}, hiera('consul::config_hash'))
}

from hiera-regex.

calvn avatar calvn commented on July 30, 2024

What if config_hash is in both common.yaml and hostname.regex, then would that be hiera hash merging? I am planning to remove config_hash from my site.pp and have the common KV values of config_hash in common.yaml

from hiera-regex.

jjulien avatar jjulien commented on July 30, 2024

@cleung2010 ,
Yes, that would be hiera hash merging and what this feature would enable. I do not have an ETA when it will be implemented.

from hiera-regex.

calvn avatar calvn commented on July 30, 2024

Alright, mind if I fork to try to work on it and then send you a pull request?

from hiera-regex.

jjulien avatar jjulien commented on July 30, 2024

Not at all, thanks!

from hiera-regex.

jjulien avatar jjulien commented on July 30, 2024

Fixed in #4

from hiera-regex.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.