FAQ
I have a define which

define testing1::instance (
$hostSuffix = "-$environment",
$testingDb = "db1$hostSuffix$dnsDomainInt",
)

In my nodes.pp I explicitly set the $environment variable. However when I
use the property 'testingDb' in a template, it comes out as only 'db1' Is
there something I am doing wrong in this define?

I call my define like this... (no overides)
testing1::instance {'test1':
}


--
_____________________________________________________
This email and any files transmitted with it are confidential and intended
solely for the addressee. If you received this email in error, please do
not disclose the contents to anyone; kindly notify the sender by return
email and delete this email and any attachments from your system.

© 2011 Currensee Inc. is a member of the National Futures Association (NFA)
Member ID 0403251 | Over the counter retail foreign currency (Forex)
trading may involve significant risk of loss. It is not suitable for all
investors and you should make sure you understand the risks involved before
trading and seek independent advice if necessary. Performance, strategies
and charts shown are not necessarily predictive of any particular result
and past performance is no indication of future results. Investor returns
may vary from Trade Leader returns based on slippage, fees, broker spreads,
volatility or other market conditions.

Currensee Inc | 54 Canal St 4th Floor | Boston, MA 02114 | +1.617.624.3824

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Jcbollinger at Mar 12, 2013 at 4:22 pm

    On Tuesday, March 12, 2013 10:53:46 AM UTC-5, phundisk wrote:
    I have a define which

    define testing1::instance (
    $hostSuffix = "-$environment",
    $testingDb = "db1$hostSuffix$dnsDomainInt",
    )

    In my nodes.pp I explicitly set the $environment variable. However when I
    use the property 'testingDb' in a template, it comes out as only 'db1' Is
    there something I am doing wrong in this define?

    Yes. The default values for a definition's (or class's) parameters cannot
    safely draw on the values of other parameters of the same object. It is
    therefore incorrect for the default value of the $testingDb parameter to
    use the $hostSuffix parameter. I would write that definition something
    like this, instead:

    define testing1::instance (
    $hostSuffix = 'NOTSET',
    $testingDb = 'NOTSET'
    ) {

    $realHostSuffix = $hostSuffix ? {
    'NOTSET' => "-${environment}",
    default => $hostSuffix
    }

    $realTestingDb = $testingDb ? {
    'NOTSET' => "db1${realHostSuffix}${dnsDomainInt}",
    default => $testingDb
    }

    # ... use $realHostSuffix and $realTestingDb ...
    }


    John

    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users?hl=en.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedMar 12, '13 at 3:53p
activeMar 12, '13 at 4:22p
posts2
users2
websitepuppetlabs.com

2 users in discussion

Jcbollinger: 1 post Phundisk: 1 post

People

Translate

site design / logo © 2021 Grokbase