Hi,

I've been slowly converting old 3.x codebase (which has seen days of 
0.24...) to 4.x and there is a lot of following pattern used for hashes:'

    $hash = {
      "some" => "defaults"
    }
    
    if $thing_one == "is_true" {
        $hash["option1"] = $thing_one,
    }
    
    if $thing_two == "is_something" {
        $hash["option2"] = "something"
    }
    else {
        $hash["option2"] = "something else"
    }

etc. Now with immutable hashes I'm forced either to do:'

    $hash1 = {
      "some" => "defaults"
    }
    
    if $thing_one == "is_true" {
        $hash2 = {
            "option1" => $thing_one,
        }
    }
    else { $hash2 = {} }

    
    if $thing_two == "is_something" {
        $hash3 = {
            "option2" => "something"
        }
    }
    else {
        $hash3 = {
            "option2" => "something else"
    } 
    $hash4 = merge($hash1, $hash2, $hash3, $hash3)

or go the hacky route and go to erb and back to use ruby language to do it.

Am I missing something here ? is there a better way to do it? We have a lot 
of "get a hash, munge it, feed it to either puppet resource or to external 
config" pattern used in the code and immutability so far doesn't seem like 
a very useful property

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-dev/6c3f98aa-24c4-4857-b820-428715d71f01%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to