Ask Your Question
1

Whats the difference between 'warn' and 'warning'?

asked 2014-08-08 18:06:13 -0500

spuder gravatar image

updated 2014-08-08 18:07:58 -0500

In the documentation, there are many built in functions. for example

warn()
warning()

What is the difference between warn and warning? Only one is listed, yet there are examples for both on this page:

https://docs.puppetlabs.com/puppet/la...

Warning Example

if $is_virtual == 'true' {
  warning('Tried to include class ntp on virtual machine; this node may be misclassified.')
}
elsif $operatingsystem == 'Darwin' {
  warning('This NTP module does not yet work on our Mac laptops.')
}
else {
  include ntp
}

Warn Example

if $is_virtual == 'true' {
  # Our NTP module is not supported on virtual machines:
  warn( 'Tried to include class ntp on virtual machine; this node may be misclassified.' )
}
elsif $operatingsystem == 'Darwin' {
  warn ( 'This NTP module does not yet work on our Mac laptops.' )
}
else {
  # Normal node, include the class.
  include ntp
}

Update

When you try and use the warn() function, puppet throws the following error:

Error: Unknown function warn at /etc/puppet/modules/gitlab/manifests/init.pp:268 on node gitlab.example.com
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2014-08-09 05:15:58 -0500

Stefan gravatar image

I suppose that is a documentation issue. warn is a ruby function to print a message on stderr, so I guess the person writing the example mixed up the puppet function and the ruby function.

edit flag offensive delete link more

Comments

spuder gravatar imagespuder ( 2014-08-11 10:27:36 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2014-08-08 18:06:13 -0500

Seen: 1,753 times

Last updated: Aug 09 '14