Ask Your Question
0

how to implement aggregate params through all defined type

asked 2017-03-27 10:33:57 -0500

gra gravatar image

updated 2017-03-27 12:32:03 -0500

puser gravatar image

I'm really have problem as what is appropriate implementation.

i want use some variables at defined resource parameter in separate any classes for non fragment settings .

for example, sudoers securepath when jetty and mysql at same node. i want set securepath, jetty bin path and mysql bin path.

It's better that jetty and mysql don't know each other. I want to do something below

define a_part_of_common(
    $common_key,
    $val,
){
}

class jetty(
){
    a_part_of_common{'jetty sudoers path':
      common_key => 'sudoers',
      val        => 'jetty path'   
    }
}

class mysql(
){
    a_part_of_common{'mysql sudoers path':
        common_key => 'sudoers',
        val        => 'mysql path'   
    }
}

after those declare, i want set the "jetty path:mysqlpath" sudoers secure_path. similar implementation is puppetlabs concat. but this case are not file. for rest api ,augeas etc

i prefer exec some settings at my defined type ,if can like below

define mytype(
  $common_key,
  $val
){
# some settings
}

does anyone have good ideas?

edit retag flag offensive close merge delete

Comments

It is very difficult to understand what you are trying to do with your verbage. Can you try to explain in more detail or reword your question?

puser gravatar imagepuser ( 2017-03-27 12:35:31 -0500 )edit

thank you Eric 1. declare some resources a.param b.param 2. collect all declare resource's attributes by other difine named mytype (i don't know how to realize) 3 concat all declared parameter and use. for example, exec resouce use a.param + b.param

gra gravatar imagegra ( 2017-03-27 13:09:25 -0500 )edit

concat_exec_fragment and concat_exec like concat file module (but in this case, not file)

gra gravatar imagegra ( 2017-03-27 13:10:59 -0500 )edit

have you looked at file_line through stdlib? https://forge.puppet.com/puppetlabs/stdlib/3.2.1/types

puser gravatar imagepuser ( 2017-03-27 13:33:12 -0500 )edit

yes i looked Unfortunately, sudoers secure_parh isn't line-by line sytax is "secure_path=parhA:pathB" so i would like to aggregate parameters

gra gravatar imagegra ( 2017-03-27 13:50:28 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-03-28 08:15:59 -0500

DarylW gravatar image

It has similar limitations (it is combined during catalog evaluation, not catalog compile) but there is the datacat module

https://forge.puppet.com/richardc/dat...

It seems like you would/should be able to implement a resource level evaluation that could possibly take the output from a datacat resource, and treat that as a set of augeas rules, similar to the internals of the https://forge.puppet.com/herculesteam native augeas types... I have seen people do that at the catalog level, by defining a template (usually to parse a config hash) and turn it into a collection of augeas rules, which then get passed into the augeas 'changes' parameter.

A totally different approach is to just have access to all of the parameters that you wish to combine (perhaps in your profile, since that will act as the glue code specific to your configuration) where you simply pull all of the data together either by merging a hash, operating on the structure in the puppet DSL, or producing a custom function in ruby and calling that from your compilation step.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-03-27 10:33:57 -0500

Seen: 69 times

Last updated: Mar 28