[Puppet Users] Re: Why does rspec puppet that_requires matcher fail?

2015-12-14 Thread Haani Niyaz
Forgot to add the error!

  1) tpp::splunk::service when tpp is installed should contain Exec[splunk-
accept-license] that requires Class[tpp::Splunk::Install]



 Failure/Error: it { should contain_exec('splunk-accept-license').
that_requires('Class[tpp::Splunk::Install]')}

   expected that the catalogue would contain Exec[splunk-accept-license] 
with that requires Class[tpp::Splunk::Install]

 # ./spec/classes/splunk/service_spec.rb:28:in `block (3 levels) in 
'



On Tuesday, 15 December 2015 09:32:53 UTC+11, Haani Niyaz wrote:
>
> Puppet code:
>
> # manifests/splunk/service.pp
> class tpp::splunk::service
>  exec { 'splunk-accept-license':
>   command => '/opt/splunkforwarder/bin/splunk enable boot-start 
> --accept-license --answer-yes --no-prompt',
>   creates => '/etc/init.d/splunk',
>   before  => Service['splunk'],
>   require => Class['splunk::install'],
> }
>
> ...
> }
>
>
>
>
> The following rspec test works with require as shown below:
>
>  it { is_expected.to contain_exec('splunk-accept-license') 
>   .with(
> 'command' => '/opt/splunkforwarder/bin/splunk enable boot-start 
> --accept-license --answer-yes --no-prompt',
> 'creates' => '/etc/init.d/splunk',
> 'require' => 'Class[Tpp::Splunk::Install]',
>   )}
>
> However if I use the that_requires matcher it fails:
>
>   it { should contain_exec('splunk-accept-license')
>   .that_requires('Class[Tpp::Splunk::Install]')
>}
>
>
> Can someone shed some light as to why this might be the case?
>
> Thanks.
>

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/72a6385e-96df-4775-964d-8bb8a15698b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Re: Why does rspec puppet that_requires matcher fail?

2016-01-04 Thread Lowe Schmidt
you depend on Class['splunk::install'] not Class['tpp::splunk::install'].

check your manifest.

--
Lowe Schmidt | +46 723 867 157

On 15 December 2015 at 02:50, Haani Niyaz  wrote:

> Forgot to add the error!
>
>   1) tpp::splunk::service when tpp is installed should contain Exec[splunk
> -accept-license] that requires Class[tpp::Splunk::Install]
>
>
>
>  Failure/Error: it { should contain_exec('splunk-accept-license').
> that_requires('Class[tpp::Splunk::Install]')}
>
>expected that the catalogue would contain Exec[splunk-accept-
> license] with that requires Class[tpp::Splunk::Install]
>
>  # ./spec/classes/splunk/service_spec.rb:28:in `block (3 levels) in
> '
>
>
>
> On Tuesday, 15 December 2015 09:32:53 UTC+11, Haani Niyaz wrote:
>>
>> Puppet code:
>>
>> # manifests/splunk/service.pp
>> class tpp::splunk::service
>>  exec { 'splunk-accept-license':
>>   command => '/opt/splunkforwarder/bin/splunk enable boot-start
>> --accept-license --answer-yes --no-prompt',
>>   creates => '/etc/init.d/splunk',
>>   before  => Service['splunk'],
>>   require => Class['splunk::install'],
>> }
>>
>> ...
>> }
>>
>>
>>
>>
>> The following rspec test works with require as shown below:
>>
>>  it { is_expected.to contain_exec('splunk-accept-license')
>>   .with(
>> 'command' => '/opt/splunkforwarder/bin/splunk enable boot-start
>> --accept-license --answer-yes --no-prompt',
>> 'creates' => '/etc/init.d/splunk',
>> 'require' => 'Class[Tpp::Splunk::Install]',
>>   )}
>>
>> However if I use the that_requires matcher it fails:
>>
>>   it { should contain_exec('splunk-accept-license')
>>   .that_requires('Class[Tpp::Splunk::Install]')
>>}
>>
>>
>> Can someone shed some light as to why this might be the case?
>>
>> Thanks.
>>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/72a6385e-96df-4775-964d-8bb8a15698b2%40googlegroups.com
> 
> .
>
> 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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAC-wWcQc90mvpqv2zVau9tLvBJd_OXD%3DqW15VvmpMJmhTv96qA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Puppet Users] Re: Why does rspec puppet that_requires matcher fail?

2016-01-04 Thread Haani Niyaz
It is not the source of the problem. I discovered the following before 
posting the issue. If I removed Tpp in the require dependency as below:

it { is_expected.to contain_exec('splunk-accept-license') 
  .with(
'command' => '/opt/splunkforwarder/bin/splunk enable boot-start 
--accept-license --answer-yes --no-prompt',
'creates' => '/etc/init.d/splunk',
'require' => 'Class[Splunk::Install]',
  )}

I get the following error:
 expected that the catalogue would contain Exec[splunk-accept-license] with 
require set to "Class[Splunk::Install]" but it is set to Class[Tpp::Splunk::
Install]{:name=>"Tpp::Splunk::Install"}



But works if added as in my original post.



On Monday, 4 January 2016 23:31:40 UTC+11, Lowe Schmidt wrote:
>
> you depend on Class['splunk::install'] not Class['tpp::splunk::install'].
>
> check your manifest.
>
> --
> Lowe Schmidt | +46 723 867 157
>
> On 15 December 2015 at 02:50, Haani Niyaz  > wrote:
>
>> Forgot to add the error!
>>
>>   1) tpp::splunk::service when tpp is installed should contain Exec[
>> splunk-accept-license] that requires Class[tpp::Splunk::Install]
>>
>>
>>
>>  Failure/Error: it { should contain_exec('splunk-accept-license').
>> that_requires('Class[tpp::Splunk::Install]')}
>>
>>expected that the catalogue would contain Exec[splunk-accept-
>> license] with that requires Class[tpp::Splunk::Install]
>>
>>  # ./spec/classes/splunk/service_spec.rb:28:in `block (3 levels) in 
>> '
>>
>>
>>
>> On Tuesday, 15 December 2015 09:32:53 UTC+11, Haani Niyaz wrote:
>>>
>>> Puppet code:
>>>
>>> # manifests/splunk/service.pp
>>> class tpp::splunk::service
>>>  exec { 'splunk-accept-license':
>>>   command => '/opt/splunkforwarder/bin/splunk enable boot-start 
>>> --accept-license --answer-yes --no-prompt',
>>>   creates => '/etc/init.d/splunk',
>>>   before  => Service['splunk'],
>>>   require => Class['splunk::install'],
>>> }
>>>
>>> ...
>>> }
>>>
>>>
>>>
>>>
>>> The following rspec test works with require as shown below:
>>>
>>>  it { is_expected.to contain_exec('splunk-accept-license') 
>>>   .with(
>>> 'command' => '/opt/splunkforwarder/bin/splunk enable boot-start 
>>> --accept-license --answer-yes --no-prompt',
>>> 'creates' => '/etc/init.d/splunk',
>>> 'require' => 'Class[Tpp::Splunk::Install]',
>>>   )}
>>>
>>> However if I use the that_requires matcher it fails:
>>>
>>>   it { should contain_exec('splunk-accept-license')
>>>   .that_requires('Class[Tpp::Splunk::Install]')
>>>}
>>>
>>>
>>> Can someone shed some light as to why this might be the case?
>>>
>>> Thanks.
>>>
>> -- 
>> 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/72a6385e-96df-4775-964d-8bb8a15698b2%40googlegroups.com
>>  
>> 
>> .
>>
>> 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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/a6660b23-2109-47bb-932f-f4b513e7861e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.