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

    rusty

    02/10/2023, 7:17 PM
    thanks @natemccurdy++
  • d

    Dr Bunsen Honeydew

    02/10/2023, 7:18 PM
    natemccurdy leveled up! (Karma: 9)
  • n

    natemccurdy

    02/10/2023, 7:18 PM
    So... I'm not totally sure I agree with your plan of making this dynamic in the Puppet code itself, but to answer your original question directly, one indirect way of determining
    apply
    vs.
    agent
    is to check for the presence of the
    $server_facts['servername']
    variable ref: https://www.puppet.com/docs/puppet/7/lang_facts_builtin_variables.html#lang_facts_builtin_variables-server-facts
  • r

    rusty

    02/10/2023, 7:21 PM
    I used to use a bootstrap script which would apply a bootstrap.pp, but that seems silly to me if puppet a simple puppet conditional can decide if I need this resource or not
  • n

    natemccurdy

    02/10/2023, 7:21 PM
    @Mike Langhorst I recommend the
    get()
    or
    getvar()
    functions when dealing with values that might be
    undef
    . https://www.puppet.com/docs/puppet/7/function.html#get https://www.puppet.com/docs/puppet/7/function.html#getvar They allow for setting a default value if the variable's value is
    undef
    .
  • m

    Mike Langhorst

    02/10/2023, 7:22 PM
    thanks @natemccurdy
  • s

    Slackbot

    02/10/2023, 7:24 PM
    This message was deleted.
    m
    n
    • 3
    • 3
  • m

    Mike Langhorst

    02/10/2023, 7:25 PM
    yea, it's for setting some oracle kernel params, based on $facts['memory']['system']['total_bytes'], and doing some division. But have a few cases where they want that different
  • m

    Mike Langhorst

    02/10/2023, 7:26 PM
    but only a handful of cases
  • n

    natemccurdy

    02/10/2023, 7:26 PM
    This is a contrived example of how to use
    getvar()
    to have a default for a class parameter that might come from Hiera:
    Copy code
    class foo (
      Optional[String] $param1 = undef,
    ) {
    
      $real_value = getvar('param1', $facts['some_fact'])
    }
    Though, in the real world, I'd just put the default in the class parameter, like this:
    Copy code
    class foo (
      String $param1 = $facts['some_fact'],
    ) {
    
    }
  • b

    bastelfreak

    02/10/2023, 7:27 PM
    @rusty @natemccurdy I've this in my controlrepo:
    Copy code
    ## hack pluginsync as file resource. only required for `puppet apply` usage
    # this works by accident with puppet agent, but only on the puppetserver
    # it breaks puppet agent on other systems, so we need to guard it
    if $trusted['authenticated'] == 'local' {
      file { $::settings::libdir: # lint:ignore:top_scope_facts
        ensure  => directory,
        source  => 'puppet:///plugins', # lint:ignore:puppet_url_without_modules
        recurse => true,
        purge   => true,
        backup  => false,
        noop    => false,
      }
    }
    Also I was told that this hack isn't required anymore for
    puppet apply
    , but I had no time yet to verify. Maybe it works out of the box now with a correct
    modulepath
  • s

    Slackbot

    02/10/2023, 7:28 PM
    This message was deleted.
    b
    c
    • 3
    • 3
  • r

    rusty

    02/10/2023, 7:28 PM
    I am guarding, and indeed I have not the facter lib I need without it
  • c

    CVQuesty

    02/10/2023, 7:28 PM
    Man, you got the weirdest configs
  • r

    rusty

    02/10/2023, 7:28 PM
    but, I can poke at it a bit more
  • c

    CVQuesty

    02/10/2023, 7:30 PM
    I actually won’t touch /opt/puppetlabs for pretty much any reason save maybe being led through a procedure by support.
  • s

    Slackbot

    02/10/2023, 7:31 PM
    This message was deleted.
    b
    • 2
    • 1
  • r

    rusty

    02/10/2023, 7:32 PM
    yep.
    2018-01-29
  • s

    Slackbot

    02/10/2023, 7:36 PM
    This message was deleted.
    v
    • 2
    • 2
  • s

    Slackbot

    02/10/2023, 7:49 PM
    This message was deleted.
    m
    j
    • 3
    • 2
  • j

    Jason Grammenos

    02/10/2023, 7:49 PM
    it appears to be a issue with how it parses the pip3 version output
  • k

    Ken

    02/10/2023, 9:19 PM
    message has been deleted
  • k

    Ken

    02/10/2023, 9:19 PM
    message has been deleted
  • m

    Massimiliano (Max)

    02/11/2023, 2:41 PM
    can you upload your pip package on any webserver ? It's fairly easy to setup. 1. the directory in the the webserver must be browsable 2. under the root directory, you have directory names, which have the same name of the package name that they contain 3. inside each directory you place your corresponding pip package. For instance, you'll have something like the following:
    Copy code
    /my_package/my_package-0.5.tar.gz
  • m

    Massimiliano (Max)

    02/11/2023, 2:41 PM
    message has been deleted
  • m

    Massimiliano (Max)

    02/11/2023, 8:05 PM
    can you upload your pip package onto any webserver ? It's fairly easy to setup. 1. the directory in the the webserver must be browsable 2. under the root directory, you have directory names, which have the same name of the package name that they contain 3. inside each directory you place your corresponding pip package. For instance, you'll have something like the following:
    Copy code
    /my_package/my_package-0.5.tar.gz
  • n

    Nathan Ward

    02/12/2023, 2:55 AM
    How are people configuring network interfaces with Puppet?
    example42/network
    is deprecated, and suggests
    puppet/network
    as a replacement, but it will only configure a single IP address per interface, so if you have an interface which is IPv4 and IPv6, you have to configure one of them as an alias interface, which is not how it works these days.
  • d

    Dr Bunsen Honeydew

    02/12/2023, 2:55 AM
    See the
    example42-network
    module at https://forge.puppet.com/example42/network?src=slack&channel=puppet
  • n

    Nathan Ward

    02/12/2023, 3:10 AM
    Yes - it is deprecated as I noted
  • y

    Yury Bushmelev

    02/12/2023, 4:18 AM
    I’d just use systemd-networkd these days
1...304305306...428Latest