Is this not just a mixup between $::operatingsystem and $::osfamily?

On Fri, Apr 18, 2014 at 3:41 PM, R. Tyler Croy <ty...@monkeypox.org> wrote:

>
> On 04/18/2014 10:24, Dennis Kirkpatrick wrote:
>
> I have run into a problem in using the puppetlabs/ntp module that I was
> not expecting. In calling on puppetlabs-ntp::init in my rspec tests, I am
> getting a failure of ntp::params to find the correct fact for
> operationingsystem, which happens to be RedHat. I've even issued a test to
> see if I could manually set the operatingsystem fact, but alas.
>
> Here is my client_ntp_spec.rb--
>
> require 'spec_helper'
>
> describe "ntp" do
>   let(:facts) { { :operatingsystem => "RedHat" } }
>   it { should contain_notify("operatingsystem").with_message("RedHat") }
> end
>
> describe 'client_ntp', :type => :class do
>   describe 'client_ntp' do
>     it { should create_class('client_ntp') }
>     it { should contain_class('client_ntp::params') }
>   end
> end
>
>
>
> Does the RSpec tag ":type => :class" do anything special to override
> "facts"? The `ntp` module depends on `stdlib` and the fact that it is not
> loaded might be what is causing you trouble, I use this:
> <https://github.com/jenkinsci/puppet-jenkins/blob/master/spec/spec_helper.rb#L26><https://github.com/jenkinsci/puppet-jenkins/blob/master/spec/spec_helper.rb#L26>to
>  ensure that the per-spec compiled catalog has the `stdlib` class
> compiled in.
>
> This also requires that stdlib is in spec/fixtures.
>
>
>
>
>  Here are my test results--
>
> $ rake spec
> HEAD is now at 564ec4f Merge branch '3.0.x'
> HEAD is now at 6a5dee2 Merge pull request #239 from
> kylog/maint/remove-facter-versions-test
> /usr/bin/ruby -S rspec spec/classes/client_ntp_spec.rb --color
> FFF
>
> Failures:
>
>   1) ntp
>      Failure/Error: it { should
> contain_notify("operatingsystem").with_message("RedHat") }
>      Puppet::Error:
>        The ntp module is not supported on an  based system. at
> /home/user/code/client-appaccelerator/modules/client_ntp/spec/fixtures/modules/ntp/manifests/params.pp:183
> on node denqca3utdev01.client.org
>      # ./spec/classes/client_spec.rb:6
>
>   2) client_ntp client_ntp
>      Failure/Error: it { should create_class('client_ntp') }
>      Puppet::Error:
>        The ntp module is not supported on an  based system. at
> /home/user/code/client-appaccelerator/modules/client_ntp/spec/fixtures/modules/ntp/manifests/params.pp:183
> on node denqca3utdev01.client.org
>      # ./spec/classes/client_ntp_spec.rb:12
>
>   3) client_ntp client_ntp
>      Failure/Error: it { should contain_class('client_ntp::params') }
>      Puppet::Error:
>        The ntp module is not supported on an  based system. at
> /home/user/code/client-appaccelerator/modules/client_ntp/spec/fixtures/modules/ntp/manifests/params.pp:183
> on node denqca3utdev01.client.org
>      # ./spec/classes/client_ntp_spec.rb:13
>
> Finished in 0.46827 seconds
> 3 examples, 3 failures
>
> Failed examples:
>
> rspec ./spec/classes/client_ntp_spec.rb:6 # ntp
> /usr/bin/ruby -S rspec spec/classes/client_ntp_spec.rb --color failed
>
> Based on the error message, I traced the output straight to the
> puppetlabs/ntp::params class, line 183 here--
>
> default: {
>       fail("The ${module_name} module is not supported on an ${::osfamily}
> based system.")
>     }
>
> It seems that the puppetlabs/ntp module is getting a null value for the
> operatingsystem fact.
>
> I can manually test for the fact at the command line--
>
> $ facter operatingsystem
> RedHat
>
> This is RedHat 6.4--
>
> $ lsb_release -a
> LSB Version:
> :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
> Distributor ID: RedHatEnterpriseServer
> Description:    Red Hat Enterprise Linux Server release 6.4 (Santiago)
> Release:        6.4
> Codename:       Santiago
>
> I'm feeling stumped. Any clues?
>
> 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/79b69beb-b06e-40be-8ea9-3c05886acc8c%40googlegroups.com<https://groups.google.com/d/msgid/puppet-users/79b69beb-b06e-40be-8ea9-3c05886acc8c%40googlegroups.com?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 puppet-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/5351AA09.2070906%40monkeypox.org<https://groups.google.com/d/msgid/puppet-users/5351AA09.2070906%40monkeypox.org?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 puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CAB0mK8n%2B%3DdM_G-wWgV-oK%2Bkt%2B8p%3DYUzjj66v8ekv-W1c-xwTMg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to