https://www.puppet.com/community logo
Join Slack
Powered by
# puppet
  • s

    smortex

    07/26/2022, 6:31 PM
    Only set OS-specific defaults in Hiera. And never in common.yaml unless the default value should not be documented.
  • s

    smortex

    07/26/2022, 6:31 PM
    All defaults in hierra == crappy reference.md 😞
  • s

    spin

    07/26/2022, 6:32 PM
    thats a very valid point
  • s

    smortex

    07/26/2022, 6:32 PM
    (default values are only shown when set as default in the puppet code)
  • n

    natemccurdy

    07/26/2022, 6:35 PM
    Copy code
    class { 'foo':
      some_param => undef,
    }
    Declaring a class and specifying a parameter’s value as
    undef
    is effectively the same as not declaring that parameter. The consequence of that is that the parameter’s value will then be looked up via APL, then fall back to the parameter’s default value (if one is defined). So if a parameter has a default value of something, you can’t override that by passing in
    undef
    at declaration time. Is this the situation you’re in?
  • n

    natemccurdy

    07/26/2022, 6:37 PM
    Copy code
    class { 'foo':
      some_param => undef,
    }
    Declaring a class and specifying a parameter’s value as
    undef
    is effectively the same as not declaring that parameter. The consequence of that is that the parameter’s value will then be looked up via APL, then fall back to the parameter’s default value (if one is defined). So if a parameter has a default value of something, you can’t override that by passing in
    undef
    at declaration time. Is this the situation you’re in?
  • s

    spin

    07/26/2022, 6:53 PM
    yea im trying to use a pick and have the pick fall back on undef.. but even if i remove the pick and just declare the class where i specify that optional param with value of undef it fails with a 500 eval error
    parameter 'package_url' expects a value of type Undef or String, got Type[Undef]
  • n

    natemccurdy

    07/26/2022, 6:56 PM
    err… that error doesn’t make sense. Can you share the actual code that’s declaring the class and what the parameter’s definition is? Did you pass
    Undef
    or
    undef
    ?
  • s

    spin

    07/26/2022, 7:41 PM
    sorry meeting.. but sure so im using Undef so you can reproduce if you do this using the test case you shared above, instead of include, if you use class declaration:
    Copy code
    puppet apply --modulepath=. -e "class { 'test':  param1 => Undef,}"
    Error: Evaluation Error: Error while evaluating a Resource Statement, Class[Test]: parameter 'param1' expects a value of type Undef or String, got Type[Undef] (line: 1, column: 1) on node
  • n

    natemccurdy

    07/26/2022, 7:41 PM
    Use
    undef
    , not
    Undef
    .
  • n

    natemccurdy

    07/26/2022, 7:43 PM
    (assuming the param’s definition uses
    Optional[String]
    )
  • v

    vchepkov

    07/26/2022, 7:43 PM
    is class
    test
    has default value set for param1 ? because it will be used when you are passing
    undef
    , you can't pass undef to a class
  • n

    natemccurdy

    07/26/2022, 7:43 PM
    (assuming the param’s definition uses
    Optional[String]
    )
  • s

    spin

    07/26/2022, 7:43 PM
    🤯
  • v

    vchepkov

    07/26/2022, 7:44 PM
    undef means - use default value
  • n

    natemccurdy

    07/26/2022, 7:44 PM
    Right, that ☝️ is the real issue here. Passing an explicit
    undef
    is the same as not passing the parameter at all, so its defaults will be used instead (APL -> param default).
  • v

    vchepkov

    07/26/2022, 7:44 PM
    the whole puppet works like that
  • n

    natemccurdy

    07/26/2022, 7:44 PM
    Right, that ☝️ is the real issue here. Passing an explicit
    undef
    is the same as not passing the parameter at all, so its defaults will be used instead (APL -> param default).
  • s

    spin

    07/26/2022, 7:45 PM
    Undef == type undef == value...
  • n

    natemccurdy

    07/26/2022, 7:46 PM
    yup.
    Undef
    is a type.
    undef
    is a value that is of type
    Undef
    .
  • n

    natemccurdy

    07/26/2022, 7:46 PM
    yup.
    Undef
    is a type.
    undef
    is a value that is of type
    Undef
    .
  • s

    spin

    07/26/2022, 7:51 PM
    well thanks so much for clearing that all up for me.. this gives me a better solution to the problem.. just wish pick/pick_default would pass an undef, but ill just define the var as undef conditionally and pass it
  • n

    natemccurdy

    07/26/2022, 7:52 PM
    What version of Puppet are you on? Modern versions pretty much negate the need for
    pick()
  • s

    spin

    07/26/2022, 7:53 PM
    6.23.0
  • n

    natemccurdy

    07/26/2022, 7:53 PM
    for example,
    get()
    will return
    undef
    as a default: https://puppet.com/docs/puppet/6/function.html#get
    clapping 1
  • s

    spin

    07/26/2022, 8:13 PM
    thank you @natemccurdy! I hadnt used that one before, but getvar works nicely for me... getvar('_package_url') passes a undef if the vars is not defined and if it is it passes the url and triggers the appropriate code block 😄
  • d

    Dr Bunsen Honeydew

    07/26/2022, 9:45 PM
    meeting 🧑‍🏫 Bolt is about to start up in #CFD8Z9A4T
  • e

    Esteban Almarales

    07/26/2022, 11:24 PM
    one easy, package { 'Binary Tree Active Directory Pro Agent': ensure => installed, source => '/binaries/cloud/windows/BinaryTree/Active-Directory-Pro-Agent-20.1.0.1-Installer.msi', install_options => [ '/passive', { 'INSTALLDIR' => 'C:\binarytree'}] } this if having issue installing the msi, What if can instead of trying to just install it, try to run this from a local path, but how do in download / copy that msi to a local path? anyone with a basic command?
  • e

    Esteban Almarales

    07/26/2022, 11:24 PM
    Thanks in advance
  • n

    natemccurdy

    07/26/2022, 11:34 PM
    If you can put the MSI on a network share, you can refer to it by its UNC path in the
    source
    attribute.
    Copy code
    source => '//some/path/on/a/network/share/installer.msi',
1...107108109...428Latest