Jira (PUP-10056) a warn function, to compliment fail, so it will be seen in agent log

15 views
Skip to first unread message

Thomas Kishel (JIRA)

unread,
Sep 30, 2019, 6:46:03 PM9/30/19
to puppe...@googlegroups.com
Thomas Kishel created an issue
 
Puppet / Improvement PUP-10056
a warn function, to compliment fail, so it will be seen in agent log
Issue Type: Improvement Improvement
Assignee: Unassigned
Created: 2019/09/30 3:45 PM
Priority: Normal Normal
Reporter: Thomas Kishel

Oh, darn, there really should be a warn function, to compliment fail, so it will be seen in agent log.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Thomas Kishel (JIRA)

unread,
Sep 30, 2019, 6:47:03 PM9/30/19
to puppe...@googlegroups.com

Josh Cooper (JIRA)

unread,
Oct 1, 2019, 1:01:02 AM10/1/19
to puppe...@googlegroups.com
Josh Cooper commented on Improvement PUP-10056

Puppet creates a function for each log level, should there should already been a warning function. I don't know if this is documented in the list of builtin functions?

$ bx puppet apply -e "notice(warning('whoops'))"
Warning: Scope(Class[main]): whoops
Notice: Scope(Class[main]):

Thomas Kishel (JIRA)

unread,
Oct 1, 2019, 11:23:03 AM10/1/19
to puppe...@googlegroups.com

Works on the command line with puppet apply:

[root@pe-201911-agent ~]# puppet apply -e "warning('TJK')"
Warning: Scope(Class[main]): TJK
Notice: Compiled catalog for pe-201911-agent.puppetdebug.vlan in environment production in 0.01 seconds
Notice: Applied catalog in 0.01 seconds

But not via a service run :

node 'pe-201911-agent.puppetdebug.vlan' {
  notify{"YO!":}
  warning('TJK')
}

Oct  1 15:20:04 pe-201911-agent puppet-agent[28915]: Caught TERM; exiting
Oct  1 15:20:04 pe-201911-agent systemd: Stopping Puppet agent...
Oct  1 15:20:04 pe-201911-agent systemd: Started Puppet agent.
Oct  1 15:20:04 pe-201911-agent systemd: Starting Puppet agent...
Oct  1 15:20:05 pe-201911-agent puppet-agent[28998]: Starting Puppet client version 6.4.3
Oct  1 15:20:08 pe-201911-agent puppet-agent[29001]: YO!
Oct  1 15:20:08 pe-201911-agent puppet-agent[29001]: (/Stage[main]/Main/Node[pe-201911-agent.puppetdebug.vlan]/Notify[YO!]/message) defined 'message' as 'YO!'
Oct  1 15:20:08 pe-201911-agent puppet-agent[29001]: Applied catalog in 0.03 seconds

Are we missing something?

Josh Cooper (JIRA)

unread,
Oct 1, 2019, 12:53:03 PM10/1/19
to puppe...@googlegroups.com
Josh Cooper commented on Improvement PUP-10056

I think there's some confusion about terminology. The term "function" to me means a server-side function which is evaluated during catalog compilation. And there are builtin functions for each log level, e.g. notice, warning, err, etc, and there is also a fail function.

The ticket is asking for the log message to appear in the agent log, which could either be a resource like notify or a client-side function (relying on Deferred). However, the fail function doesn't cause messages to appear in the agent's log, so I'm confused what's being requested.

Thomas Kishel (JIRA)

unread,
Oct 1, 2019, 1:25:04 PM10/1/19
to puppe...@googlegroups.com

I have been relaying for a user with a PE ticket, so I've asked them to reply here to remove me form the middle ...

Vadym Chepkov (JIRA)

unread,
Oct 4, 2019, 1:31:03 PM10/4/19
to puppe...@googlegroups.com

As it was mentioned before, using warning function in a manifest is not particularly useful, since message appears only in server log and gets unnoticed, since it's not visible on the agent.
One can use notify resource instead, but, the side effect would be having a 'changed' catalog each puppet run. Ruby code currently can produce such warnings, for example:

Warning: Puppet::SSL::Host is deprecated and will be removed in a future release of Puppet.
   (location: /opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/ssl/host.rb:235:in `initialize')

It would be nice if it was available in puppet as well.

Josh Cooper (JIRA)

unread,
Oct 4, 2019, 1:44:02 PM10/4/19
to puppe...@googlegroups.com
Josh Cooper commented on Improvement PUP-10056

This sounds similar to what's being requested in PUP-9208. The ability to generate fail/warning/etc messages on the agent, but not have them count as "changed resources"

Vadym Chepkov (JIRA)

unread,
Oct 4, 2019, 2:09:04 PM10/4/19
to puppe...@googlegroups.com

yes, it does. I guess we can close this ticket as a duplicate. Thank you both

Reply all
Reply to author
Forward
0 new messages