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

    Ross Morrison

    07/26/2023, 11:36 AM
    Hi folks, apologies if this is the wrong channel but just wanted to let you all know that Puppet Belfast are hosting a Coffee Morning on the 28th September for Macmillan Cancer Support. It really is such an important charity, so if you're unable to make it physically in person, please consider donating at the link below. Thanks a million! https://coffeefundraising.macmillan.org.uk/fundraising/cm23025759
    🙏🏻 1
    🙏 1
  • s

    Slackbot

    07/26/2023, 2:11 PM
    This message was deleted.
    r
    • 2
    • 2
  • n

    nate

    07/26/2023, 2:44 PM
    with a custom fact, can you confine to a fact value that’s not nil? i have a thing that might be constrained to a role, but there are multiple roles that apply. if you can’t confine to a non-null fact value, will confining to each of the possible fact values work? maybe something like this? it feels like it won’t work.
    Copy code
    confine: :role::foo
    confine: :role::bar
  • v

    vchepkov

    07/26/2023, 2:47 PM
    yes, look at the example here https://github.com/puppetlabs/puppetlabs-lvm/blob/v2.0.2/lib/facter/lvm_support.rb
  • v

    vchepkov

    07/26/2023, 2:47 PM
    v2.0.3 is broken there, but v2.0.2 is using this technique
  • n

    nate

    07/26/2023, 2:50 PM
    thanks
    👍 1
  • c

    cruelsmith

    07/26/2023, 3:46 PM
    @nate When you really just need to check if not
    nil
    then you can use this
    Copy code
    confine :networking do |f|
        !f.nil?
      end
    The other examples will else always expect a fixed value. For structured facts you can use this construct:
    Copy code
    confine :os do |os|
        os['name'] == 'CentOS'
      end
    👍 2
    👍 1
  • n

    nate

    07/26/2023, 3:47 PM
    nice, nice
  • s

    Slackbot

    07/26/2023, 5:01 PM
    This message was deleted.
    y
    v
    n
    • 4
    • 3
  • s

    Slackbot

    07/26/2023, 5:22 PM
    This message was deleted.
    y
    b
    n
    • 4
    • 59
  • b

    bastelfreak

    07/26/2023, 7:01 PM
    are there any docs available for writing a puppet face or adding an action to a face?
  • j

    jms1

    07/26/2023, 7:08 PM
    i guess i've been gone for a while ... what is the term "puppet face" referring to? ☝️
  • n

    natemccurdy

    07/26/2023, 7:12 PM
    Essentially subcommands to the
    puppet
    command that you could create yourself. However, the Face API's are private and deprecated for public use: https://www.puppet.com/docs/puppet/5.5/deprecated_api.html#puppet-faces-is-a-private-api
  • j

    jms1

    07/26/2023, 7:14 PM
    ah ... i vaguely remember hearing the word being tossed about at one point, maybe i looked into it at the time and figured it wasn't something i needed, so i didn't allocate any storage to remember anything about it ... thanks
  • j

    jms1

    07/26/2023, 7:15 PM
    anyway, real question ... i'm going back and re-factoring some old code, and came across an
    exec
    with
    refreshonly => true
    ... is there any way for puppet code to "send a notification" to this resource, other than declaring some other resource with
    notify => Exec['xxx']
    ?
  • j

    jms1

    07/26/2023, 7:16 PM
    if not, is there any kind of "no-op" resource that i can declare in the catalog, that would not actually do anything on the target server? i remember there being an
    anchor
    type at one point, not sure if that's what i'm thinking of
  • n

    natemccurdy

    07/26/2023, 7:16 PM
    From: https://www.puppet.com/docs/puppet/8/lang_relationships.html#lang_relationships-refreshing-and-notification
    To specify that a resource must refresh when a related resource changes, create a notifying relationship with the
    subscribe
    or
    notify
    metaparameters or the notification chaining arrow (
    ~>
    ).
  • j

    jms1

    07/26/2023, 7:17 PM
    yup ... but that means there needs to be some other resource to the left of the
    ~>
    operator
  • n

    natemccurdy

    07/26/2023, 7:17 PM
    So the
    exec
    could have
    subscribe => Something[foo]
    .
  • j

    jms1

    07/26/2023, 7:17 PM
    hence my question about a no-op resource that i could use
  • j

    jms1

    07/26/2023, 7:18 PM
    that's just it, there isn't an existing resource ... the decision in this case would be within an
    if
    block
  • j

    jms1

    07/26/2023, 7:18 PM
    like, if there were a "no-op" resource, i could do
    Noop['x'] ~> Exec['x']
  • n

    natemccurdy

    07/26/2023, 7:18 PM
    Sorry, backing up... what's your goal here? You want to run the exec even though its configured as
    refreshonly => true
    ?
  • j

    jms1

    07/26/2023, 7:19 PM
    in some cases, yes. the decision is not whether some other resource was updated or not, the decision is an explicit
    if
    statement in the code
  • j

    jms1

    07/26/2023, 7:20 PM
    something like
    Copy code
    if ( $condition ) {
        noop { 'x' :
          notify => Exec['x'] ,
        }
      }
  • j

    jms1

    07/26/2023, 7:21 PM
    i just need something to use as the
    noop
    resource which, when declared, doesn't have any real effect on the target server, other than triggering the exec.
  • v

    vchepkov

    07/26/2023, 7:21 PM
    you can use notify, but I prefer echo from ipcrm/echo
  • d

    Dr Bunsen Honeydew

    07/26/2023, 7:21 PM
    See the
    ipcrm-echo
    module at https://forge.puppet.com/ipcrm/echo?src=slack&channel=puppet
  • v

    vchepkov

    07/26/2023, 7:22 PM
    notify will always be 'modified'
  • n

    natemccurdy

    07/26/2023, 7:24 PM
    The
    anchor
    resource is maybe more appropriate here... but also... I feel like there's a misunderstanding of compile-time vs. enforcement-time logic here.
1...396397398...428Latest