Thanks, I don't know why I tried to make it hard when it could be simple.

On Wednesday, November 28, 2012 1:19:14 AM UTC+1, joe wrote:
>
> You should set the path based on the value of $myclass::provider:
>
> if $myclass::provider == 'package' {
>   test = '/path/a'
> } 
> else {
>   test = '/path/b'
> }
>
> On Tuesday, November 27, 2012 3:58:05 PM UTC-7, Yanis Guenane wrote:
>>
>> *Specification* : my manifest look more like this
>>
>> class myclass ($provider = 'package') {
>>   case $provider {
>>     'package' : {
>>       package {'mypackage' :
>>         ensure => latest,
>>       }
>>     }
>>     'source' : {
>>       exec {'install procedure' :
>>      }
>>    }
>> }
>>
>> define myclass::mydefine() {
>>   $test = get_test_path()
>>
>>   file {'myconf' :
>>     content => templates('mod/myconf'),
>>   }
>> }
>>
>>
>> On Tuesday, November 27, 2012 11:23:50 PM UTC+1, Yanis Guenane wrote:
>>>
>>> Hi all,
>>>
>>> I have a manifest that look like this 
>>>
>>> case $provider {
>>>   'package' : {
>>>     package {'mypackage' :
>>>       ensure => latest,
>>>     }
>>>   }
>>>   'source' : {
>>>      exec {'install procedure' :
>>>      }
>>>    }
>>>
>>> $test = get_test_path()
>>>
>>> file {'myconf' :
>>>    content => templates('mod/myconf'),
>>> }
>>>
>>> Within mycon template I have a variable 'test' that depending if the 
>>> package was installed from source of from the package will have a different 
>>> path.
>>> Issue is that the function get_test_path() seems to be done at compile 
>>> time, so the first time I run it will always result in an erroneous answer. 
>>> After a second run it will be fine.
>>>
>>> Does any one can provide guidance on how I could make it work at the 
>>> first run ?
>>>
>>> Thank you,
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/puppet-users/-/2GJ3Q90QfKAJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to