Ask Your Question
0

How to access the the parameters within same type?

asked 2017-03-04 23:15:20 -0500

Hyder gravatar image

updated 2017-03-08 09:37:31 -0500

for example

         newparam(:foo) do
             newvalues(:abc, :xyz)
         end
         newparam(:bar) do
             if foo == :xyz
                bar = 123
            else
                bar = 789         #This whole block gives me eroor. How can I access the above parameter in custom type?
            end
         end
edit retag flag offensive close merge delete

Comments

The above is my custom type. please help me!

Hyder gravatar imageHyder ( 2017-03-04 23:16:48 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-03-06 05:53:11 -0500

puser gravatar image

updated 2017-03-08 09:04:58 -0500

I am a little confused why you want two parameters that are named differently with the same name. In your provider just use the same param in different spots? A little enlightenment might help us solve this.

Edit

global.yaml

---
apache::vhosts:
  example.com:
    priority: '00'
apache::vhosts:
  api.example.com:
    priority: '99'

module.pp

class myclass (
  $vhosts
){
  #declare your custom type and pass $vhosts to it
}
edit flag offensive delete link more

Comments

Based upon previous parameter value I wanted to assign values for next parameter

Hyder gravatar imageHyder ( 2017-03-06 09:04:55 -0500 )edit
1

it sounds like it would be better to create hash set in hiera and pass the hash to your custom type, that way the relationships are known based on the hash keys and values.

puser gravatar imagepuser ( 2017-03-07 06:17:16 -0500 )edit

can you please tell me how to create hash set in hiera and pass the hash to my custom type?

Hyder gravatar imageHyder ( 2017-03-08 07:36:40 -0500 )edit

Thanks Eric I have edited the question can you please now check and help me.

Hyder gravatar imageHyder ( 2017-03-08 09:36:37 -0500 )edit

The above is wrong. You are not processing any data in the custom type! you are defining the inputs for the provider to interpret. For example the type can say if param(:bar) is a number, then proceed, else error out.

puser gravatar imagepuser ( 2017-03-08 13:40:11 -0500 )edit

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-04 23:15:20 -0500

Seen: 70 times

Last updated: Mar 08