Hi,

I'm trying to write a SSH module to learn Hiera. The module is
including a Firewall config from the Puppetlabs Firewall module.

I've made the port configurable using a variable "ssh_server_port".

  $port = hiera('ssh_server_port')
  firewall { "100 SSHD":
        proto  => 'tcp',
        action => 'accept',
        dport  => $port,
  }

If I do $ssh_server_port = 22 in a Puppet file everything works as expected.

If I'm using a YAML file with this:
ssh_server_port: 2222
I get the following error message: Parameter dport failed: Munging
failed for value 2222 in class dport: can't convert Fixnum into String
It makes sense for the Firewall module to require a String here as it
accepts ranges too.

With
ssh_server_port: '2222'
in the YAML file everything works as expected.

It would be nice for a plain Integer (Fixnum) to work as well when
it's coming from a YAML file.

I guess the question boils down to: Is there a way to cast from Fixnum
to String?

It seems like an inconsistency to me that in Puppet it works quoted
and unquoted but not in YAML so I'd like to provide the same syntax
for both versions. For now i've added a validate_string($port) call.

Thanks,
Lars

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to