oops, sorry about that.
An undef value in a manifest/class is mapped to 'nil' in the catalog.
But I would not allow to have an undef value for the ensure class
parameter. But that's another discussion.
I will have a look at the code later on.
On 18/04/14 15:16, Remi Ferrand wrote:
... I'm sorry but I don't understand your answer ...
I've created a very simple use case here at
https://github.com/riton/puppetrspec
My question was regarding file
https://github.com/riton/puppetrspec/blob/master/spec/classes/puppetrspec_spec.rb.
With what value should I replace "# WHAT SHOULD WE USE HERE TO PASS
PUPPET undef VALUE ?#" with to make this unit test functional ?
Thanks in advance and sorry to ask you to answer again.
Cheers
Rémi
On Fri, Apr 18, 2014 at 1:39 PM, Johan De Wit <[email protected]
<mailto:[email protected]>> wrote:
it {
should contain_package('foo').with ( {
'provider' => nil,
})
}
On 18/04/14 12:37, Remi Ferrand wrote:
I was also wondering how to do this, If anyone has the answer,
I'll be glad to know it !
Thanks
Rémi
On Saturday, July 20, 2013 12:20:20 AM UTC+2, Andreas Haerter wrote:
Hi all,
is there a way to pass the Puppets undef [1] value as
parameter? I got a
module with a package_provider parameter, allowing the user
two things:
1. specify a specific package provider to use; 2. pass
"undef" to let
Puppet decide which provider to use instead of the module.
Something like:
> class example(
> $package_provider = $example::params::package_provider,
> ) inherits example::params {
>
> [...]
>
> package { 'foobar'
> ensure => 'present',
> provider => $package_provider,
> }
> }
Now I want to test if passing undef works:
> context 'with parameter(s): package_provider => undef' do
> let(:params) {{
> :package_provider => [WAY-TO-PASS-UNDEF-HERE],
> }}
>
> it 'contains a package with parameter(s): provider =>
unset' do
> should contain_package('blueprint').with({
> 'provider' => [WAY-TO-CHECK-FOR-UNDEF-HERE,
> })
> end
> end
But my test doesn't work. What I tried so far is:
1) undef (results in RSpec/Ruby parsing error)
> context 'with parameter(s): foo => undef' do
> let(:params) {{
> :foo => undef,
> }}
>
> [...]
> end
2) :undef (results in Puppet error: "Syntax error at':';
expected '}'" )
> context 'with parameter(s): foo => undef' do
> let(:params) {{
> :foo => :undef,
> }}
>
> [...]
> end
3) nil (does not result in an Puppet or Ruby error, but the
.with_foo(nil) or .without_foo matchers do not seem to work
as the
string "nil" was passed tho puppet
> context 'with parameter(s): foo => undef' do
> let(:params) {{
> :foo => nil,
> }}
>
> [...]
> end
Any hints? Thanks in advance :-)
[1]
<http://docs.puppetlabs.com/puppet/latest/reference/lang_datatypes.html#undef>
--
Andreas <http://blog.andreas-haerter.com>
--
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 [email protected]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/2e2b712e-cf4a-46be-941b-3303efa5d551%40googlegroups.com
<https://groups.google.com/d/msgid/puppet-users/2e2b712e-cf4a-46be-941b-3303efa5d551%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
Johan De Wit
Open Source Consultant
Red Hat Certified Engineer (805008667232363)
Puppet Certified Professional 2013/2014 (PCP0000006)
_________________________________________________________
Open-Future Phone+32 (0)2/255 70 70 <tel:%2B32%20%280%292%2F255%2070%2070>
Zavelstraat 72 Fax+32 (0)2/255 70 71
<tel:%2B32%20%280%292%2F255%2070%2071>
3071 KORTENBERG Mobile+32 (0)474/42 40 73
<tel:%2B32%20%280%29474%2F42%2040%2073>
BELGIUMhttp://www.open-future.be
_________________________________________________________
Upcoming Events:
Linux Training |
https://www.open-future.be/linux-training-5-till-9th-may
Puppet Introduction Course |
https://www.open-future.be/puppet-introduction-course-12th-may
Puppet Fundamentals Training |
https://www.open-future.be/puppet-fundamentals-training-13-till-15th-may
Zabbix Certified Specialist |
https://www.open-future.be/zabbix-certified-specialist-training-19-till-21th-may
Zabbix Certified Professional |
https://www.open-future.be/zabbix-certified-professional-training-22-till-23rd-may
Subscribe to our newsletter: http://eepurl.com/BUG8H
--
You received this message because you are subscribed to a topic in
the Google Groups "Puppet Users" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/puppet-users/6nL2eROH8is/unsubscribe.
To unsubscribe from this group and all its topics, send an email
to [email protected]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/53510EE8.5080401%40open-future.be
<https://groups.google.com/d/msgid/puppet-users/53510EE8.5080401%40open-future.be?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
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 [email protected]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/CAMTZwML76Mp9e9n9HSKfXGA%3DL27piNEPe%2Boft4dob%3DNyaxjseg%40mail.gmail.com
<https://groups.google.com/d/msgid/puppet-users/CAMTZwML76Mp9e9n9HSKfXGA%3DL27piNEPe%2Boft4dob%3DNyaxjseg%40mail.gmail.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
Johan De Wit
Open Source Consultant
Red Hat Certified Engineer (805008667232363)
Puppet Certified Professional 2013/2014 (PCP0000006)
_________________________________________________________
Open-Future Phone +32 (0)2/255 70 70
Zavelstraat 72 Fax +32 (0)2/255 70 71
3071 KORTENBERG Mobile +32 (0)474/42 40 73
BELGIUM http://www.open-future.be
_________________________________________________________
Next Events:
Linux Training | https://www.open-future.be/linux-training-5-till-9th-may
Puppet Introduction Course |
https://www.open-future.be/puppet-introduction-course-12th-may
Puppet Fundamentals Training |
https://www.open-future.be/puppet-fundamentals-training-13-till-15th-may
Zabbix Certified Specialist |
https://www.open-future.be/zabbix-certified-specialist-training-19-till-21th-may
Zabbix Certified Professional |
https://www.open-future.be/zabbix-certified-professional-training-22-till-23rd-may
Subscribe to our newsletter | http://eepurl.com/BUG8H
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/53512E21.3000205%40open-future.be.
For more options, visit https://groups.google.com/d/optout.