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

    Brian Schonecker

    08/04/2022, 6:19 PM
    You may want to look at the docs for include for class modules. Sometimes you can't get around the need to instantiate a class from other different class modules. The include resolves that problem.
  • c

    csharpsteen

    08/04/2022, 6:22 PM
    Yeah, that's a good point.
    class { '...': }
    is mostly for when you need to make sure a specific set of parameters are used.
  • j

    JaredGS

    08/04/2022, 6:27 PM
    I’m trying to use a
    lookup_key
    hieradata function, referencing a function at the top-level of my puppet control repo (environment function not in any specific module), and I’m getting this error when I run `puppet apply`:
    Copy code
    Error: Unable to find 'lookup_key' function named 'host_search' (file: /path/to/control-repo/hiera.yaml) on ...
    the custom function itself it located in
    /path/to/control-repo/function/host_search.pp
    any idea on what I’m doing wrong?
  • j

    JaredGS

    08/04/2022, 6:31 PM
    I’m trying to use a
    lookup_key
    hieradata function, referencing a function at the top-level of my puppet control repo (environment function not in any specific module), and I’m getting this error when I run `puppet apply`:
    Copy code
    Error: Unable to find 'lookup_key' function named 'host_search' (file: /path/to/control-repo/hiera.yaml) on ...
    the custom function itself it located in
    /path/to/control-repo/function/host_search.pp
    any idea on what I’m doing wrong?
  • v

    vchepkov

    08/04/2022, 6:38 PM
    I think it needs to be part of a 'module' to be loaded. control repo is not a module
    gratitude thank you 1
    this 1
  • v

    vchepkov

    08/04/2022, 6:41 PM
    you can define a pseudo module inside say
    site/mylookup
    and adjust environment.conf to include site in modulepath
  • v

    vchepkov

    08/04/2022, 6:42 PM
    Something like that
    Copy code
    $ cat environment.conf 
    modulepath     = modules:site:$basemodulepath
  • s

    Slackbot

    08/04/2022, 6:42 PM
    This message was deleted.
    j
    • 2
    • 1
  • l

    Les Shiner

    08/04/2022, 6:43 PM
    Copy code
    puppet:///modules//test_pilot_groups//files//*
  • l

    Les Shiner

    08/04/2022, 6:43 PM
    this doesn't seem to work to copy all the files in //files. Do i need to switch to directory?
  • v

    vchepkov

    08/04/2022, 6:43 PM
    you need to switch to a package 🙂
  • l

    Les Shiner

    08/04/2022, 6:44 PM
    Copy code
    class test_pilot_groups::pilot_groups {
      package { 'C:/test_pilot_groups/':
        ensure => directory,
        source => 'puppet:///modules//test_pilot_groups//files//',
      }
    }
  • l

    Les Shiner

    08/04/2022, 6:44 PM
    something like that?
  • n

    natemccurdy

    08/04/2022, 6:46 PM
    Copy code
    file { 'C:/test_pilot_groups/':
      ensure  => directory,
      recurse => true,
      purge   => true,  # This is optional, but usually used.
      force   => true,
      source  => 'puppet:///modules/test_pilot_groups',
    }
    Recursive file copies look like this ☝️ But also, it’s a best practice to not recursively copy more than just a few text files. If you’re copying dozens or hundreds of files, or if those files are binary and/or large, you definitely don’t want to use a recurisve copy as it can dramatically affect performance.
    👍 1
  • n

    natemccurdy

    08/04/2022, 6:46 PM
    Copy code
    file { 'C:/test_pilot_groups/':
      ensure  => directory,
      recurse => true,
      purge   => true,
      force   => true,
      source  => 'puppet:///modules/test_pilot_groups',
    }
    Recursive file copies look like this ☝️ But also, it’s a best practice to not recursively copy more than just a few text files. If you’re copying dozens or hundreds of files, or if those files are binary and/or large, you definitely don’t want to use a recurisve copy as it can dramatically affect performance.
  • n

    natemccurdy

    08/04/2022, 6:46 PM
    Copy code
    file { 'C:/test_pilot_groups/':
      ensure  => directory,
      recurse => true,
      purge   => true,  # This is optional, but usually used.
      force   => true,
      source  => 'puppet:///modules/test_pilot_groups',
    }
    Recursive file copies look like this ☝️ But also, it’s a best practice to not recursively copy more than just a few text files. If you’re copying dozens or hundreds of files, or if those files are binary and/or large, you definitely don’t want to use a recurisve copy as it can dramatically affect performance.
  • l

    Les Shiner

    08/04/2022, 6:46 PM
    in this instance it's about 8 files, very small. But if i needed to copy a large amount or larger files then package instead of file?
    💯 1
  • n

    natemccurdy

    08/04/2022, 6:48 PM
    To clarify, you’d want to look at some other way of delivering those files that doesn’t directly involve Puppet copying them. For example, mounting a network share, bundling those files into a zip archive and using the
    puppet/archive
    module, etc…
  • l

    Les Shiner

    08/04/2022, 6:48 PM
    or in my case, using a choco command!
  • n

    natemccurdy

    08/04/2022, 6:48 PM
    Yeah, that too
  • l

    Les Shiner

    08/04/2022, 6:48 PM
    perfect, that creates a wonderful line that I don't need to cross
  • b

    bastelfreak

    08/04/2022, 6:48 PM
    packaging them
  • s

    Slackbot

    08/04/2022, 8:48 PM
    This message was deleted.
    j
    k
    b
    • 4
    • 6
  • k

    kenyon

    08/04/2022, 9:01 PM
    probably should be documented in the readme here https://github.com/puppetlabs/r10k
  • j

    Joost

    08/04/2022, 9:02 PM
    Probably https://github.com/puppetlabs/r10k/blob/main/docker/README.md if we want to have it on the Docker Hub page
  • p

    Patrick Rynhart

    08/04/2022, 9:45 PM
    Is there any way to get Puppet to tell you what type of variable/data structure you have ?
  • p

    Patrick Rynhart

    08/04/2022, 9:46 PM
    If I just dump out the variable using notify like this:
  • p

    Patrick Rynhart

    08/04/2022, 9:46 PM
    Copy code
    $muc = $config['muc']
      notify{ "The dumped variable is $muc": }
  • p

    Patrick Rynhart

    08/04/2022, 9:46 PM
    Then I get:
  • p

    Patrick Rynhart

    08/04/2022, 9:46 PM
    Copy code
    Notice: /Stage[main]/Profile::Stream_web/Notify[The dumped variable is {developmentb => {someattribute => here, anotherattribute => here}, developmentc => {someattribute => here, anotherattribute => here}}]/message: defined 'message' as 'The dumped variable is {developmentb => {someattribute => here, anotherattribute => here}, developmentc => {someattribute => here, anotherattribute => here}}'
1...120121122...428Latest