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

    Slackbot

    01/15/2023, 4:22 PM
    This message was deleted.
    a
    • 2
    • 4
  • s

    Slackbot

    01/16/2023, 3:19 AM
    This message was deleted.
    y
    h
    +2
    • 5
    • 8
  • s

    Slackbot

    01/16/2023, 1:24 PM
    This message was deleted.
    h
    • 2
    • 1
  • a

    Animesh Sahu

    01/16/2023, 7:41 PM
    Hey, how to create a (json) file if not present with initial content
    {}
    ? And donot overwrite if already exists. I think
    content => '{}'
    overwrites.
  • l

    Lumiere

    01/16/2023, 7:51 PM
    generate a empty hash and use
    to_json_pretty
    from stdlib to convert it to
    {}
    . once it gets content, to_json_pretty would just write the content
  • c

    csharpsteen

    01/16/2023, 8:30 PM
    content => "{}"
    should be fine. I don't think
    to_json_pretty
    adds any functionality over that. To avoid overwriting, use `replace => false`: https://www.puppet.com/docs/puppet/7/types/file.html#file-attribute-replace
    ✅ 1
  • s

    Slackbot

    01/16/2023, 8:58 PM
    This message was deleted.
    d
    g
    • 3
    • 7
  • d

    David Sandilands

    01/16/2023, 11:19 PM
    @gary we should have an answer from legal next week
  • s

    Slackbot

    01/16/2023, 11:42 PM
    This message was deleted.
    h
    d
    • 3
    • 16
  • d

    David Sandilands

    01/16/2023, 11:42 PM
    does anyone know a good practicle example of using the
    with
    function with a lambda https://www.puppet.com/docs/puppet/7/function.html#with the example given here is not great, ive struggled to find code using it anywhere
  • h

    helindbe

    01/17/2023, 9:21 AM
    Look at this for example: https://github.com/puppetlabs/community/discussions/28#discussioncomment-4299628
  • s

    Slackbot

    01/17/2023, 9:26 AM
    This message was deleted.
    y
    n
    • 3
    • 9
  • n

    Neeloj

    01/17/2023, 9:30 AM
    hi all , its possible to run a resource type before
    include
    key? I use here
    ->
    (doesnt work) can I also use
    before attribute
    in package ? thank you all
    Copy code
    class myclass {
            $osfamily = $::facts["os"]["family"]
            case $osfamily {
                'RedHat':  {
                    package { 'install xinetd':
    						ensure => installed,
    						name => 'xinetd',
                    } -> include myclass::testclass
                }
            }
    }
  • y

    Yury Bushmelev

    01/17/2023, 10:53 AM
    If I understood you right this is what you want
    Copy code
    package { ...
      ...
      before => Class['Myclass::Testclass'],
    }
  • n

    Neeloj

    01/17/2023, 10:56 AM
    thank you so much @Yury Bushmelev, that mean I should include it before the package or after ? or its doesnt matter ? e.g
    Copy code
    package { ...
      ...
      before => Class['Myclass::Testclass'],
    }
    
    include myclass::testclass
  • n

    Neeloj

    01/17/2023, 10:57 AM
    this was very helpfull trick, @Yury Bushmelev: you still should include the testclass (anywhere) but package will be ordered before the testclass resources
  • s

    Slackbot

    01/17/2023, 12:22 PM
    This message was deleted.
    a
    y
    • 3
    • 5
  • y

    Yury Bushmelev

    01/17/2023, 1:01 PM
    though it’s not really required.. sometimes you should include things just in the block (if-else or unless e.g.)
  • s

    Slackbot

    01/17/2023, 2:00 PM
    This message was deleted.
    a
    y
    +2
    • 5
    • 6
  • y

    Yury Bushmelev

    01/17/2023, 2:30 PM
    “echo ‘${settings_json}’ | …”
  • d

    Dr Bunsen Honeydew

    01/17/2023, 5:45 PM
    businessparrot 🧑‍🏫Puppet Core Team is about to start up in #CFD8Z9A4T
  • w

    wil.rodriguez

    01/17/2023, 6:32 PM
    You could probably have puppet write your input to a file and feed that file to your command, that might be a bit more reliable.
    g
    • 2
    • 1
  • s

    Slackbot

    01/17/2023, 6:35 PM
    This message was deleted.
    n
    b
    +3
    • 6
    • 11
  • j

    Joe Abbate

    01/17/2023, 8:08 PM
    https://puppetcommunity.slack.com/archives/C0W1Z7213/p1673983304527279
  • a

    Andy Fry

    01/18/2023, 3:56 AM
    Hi all, I'm having trouble with an onlyif/unless clause on an exec. The basic aim is to add a node to an AWX inventory, but only if it isn't already there. Current code runs every time: exec { 'add_to_inventory': command => "curl blah", unless => "curl (host url from awx) 2>/dev/null | grep -c $hostname", } Command seems to run every puppet run. Any clues?
  • n

    n3snah

    01/18/2023, 3:57 AM
    what is the return code of your
    unless
    ?
    curl (host url from awx) 2>/dev/null | grep -c $hostname
  • n

    n3snah

    01/18/2023, 3:57 AM
    Puppet will run the exec unless that
    unless
    statement returns 0
  • a

    Andy Fry

    01/18/2023, 3:57 AM
    1 if the host exists, 0 if not
  • a

    Andy Fry

    01/18/2023, 3:57 AM
    I've tried onlyif and unless though
  • n

    n3snah

    01/18/2023, 3:58 AM
    its certainly a logic issue on both sides
1...275276277...428Latest