legitimate puppet code?

22 views
Skip to first unread message

Prentice Bisbal

unread,
Feb 10, 2020, 3:38:55 PM2/10/20
to puppet...@googlegroups.com
Is this legitimate puppet code? I'm trying to pass arguments instead of
using global variables (ie, don't keep looking them up in hiera).  This
syntax works elsewhere, but I've yet to use it within a class. When I
run 'puppet parser validate', I get an error.

class cis::iptables (
  Integer $level,
  String $type,
  Array $roles ) {

  include cis::iptables::install
  class {'cis::iptables::configure': 'level' => $level, 'type' =>
$type, 'roles' => $roles}   #This line
  class {'cis::iptables::service': 'level' => $level, 'type' => $type,
'roles' => $roles}       # and this line
}

--
Prentice Bisbal
Lead Software Engineer
Princeton Plasma Physics Laboratory
http://www.pppl.gov

Ramin K

unread,
Feb 10, 2020, 4:54:10 PM2/10/20
to puppet...@googlegroups.com
Looks like single quoting params is causing the problem. This passes
validation

class { 'cis::iptables::configure':
level => $level,
type => $type,
roles => $roles,
}

Ramin

Prentice Bisbal

unread,
Feb 11, 2020, 9:43:29 AM2/11/20
to puppet...@googlegroups.com
Yup, that fixed it. Thanks for the help.

Prentice

John Warburton

unread,
Feb 11, 2020, 8:10:28 PM2/11/20
to puppet...@googlegroups.com
May I highly recommend Visual Studio Code with the puppet plugin - it picks up also sorts of things like this before you even start testing your code

A huge leap in productivity for me!

John

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/bd98ec7d-e541-2759-abd3-f0bbe418c89e%40pppl.gov.


--
John Warburton
Ph: 0417 299 600
Email: jwarb...@gmail.com
Reply all
Reply to author
Forward
0 new messages