Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests - Pool has a string not an array #18

Closed
pjfoley opened this issue Jan 24, 2013 · 2 comments
Closed

Tests - Pool has a string not an array #18

pjfoley opened this issue Jan 24, 2013 · 2 comments

Comments

@pjfoley
Copy link

pjfoley commented Jan 24, 2013

Hi,

When I installed the this module I ran the test script and got the below output:

root@creator ~# puppet apply /etc/puppet/modules/dhcp/tests/init.pp --verbose
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/pe_version.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/root_home.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/puppet_vardir.rb
Info: Loading facts in /etc/puppet/modules/stdlib/lib/facter/facter_dot_d.rb
Info: Loading facts in /etc/puppet/modules/concat/lib/facter/concat_basedir.rb
Warning: Config file /etc/puppet/hiera.yaml not found, using Hiera defaults
Error: Failed to parse template dhcp/dhcpd.pool.erb:
Filepath: /etc/puppet/modules/dhcp/templates/dhcpd.pool.erb
Line: 7
Detail: undefined method each' for "10.1.1.100":String at /etc/puppet/modules/dhcp/manifests/pool.pp:15 on node creator.mgnt.local Error: Failed to parse template dhcp/dhcpd.pool.erb: Filepath: /etc/puppet/modules/dhcp/templates/dhcpd.pool.erb Line: 7 Detail: undefined methodeach' for "10.1.1.100":String
at /etc/puppet/modules/dhcp/manifests/pool.pp:15 on node creator.mgnt.local

While trying to work out what was wrong I realised that in the tests/init.pp file the test for the dhcpd.pool.erb file is passing a string and not an array:

dhcp::pool{ 'example.com':
network => '10.1.1.0',
mask => '255.255.255.0',
range => '10.1.1.100 10.1.1.200',
gateway => '10.1.1.1',
}

(Look at the range line) which means that in the erb template the string does not have an each method.

Also the DHCP module has a dependency on the Bind Module which means that the test fails because it cannot find the Bind module.

@zeysh
Copy link

zeysh commented Aug 25, 2013

Hi,

This solution works for me: https://groups.google.com/forum/#!msg/puppet-users/EI6_xFmKxtg/Pv8LcQm8u9YJ

Try to put your range definition like this

range => ['10.1.1.100 10.1.1.200'],

@alexjfisher
Copy link
Member

It looks like this was fixed in 0bf424a

range now accepts a string or an array of strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants