rspec-puppet-facts 1.9.5 → 1.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
 - data/CHANGELOG.md +8 -0
 - data/lib/rspec-puppet-facts.rb +7 -7
 - data/lib/rspec-puppet-facts/version.rb +1 -1
 - data/spec/rspec_puppet_facts_spec.rb +50 -4
 - metadata +3 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: a64115f0d16cfdcdc93bae297977afe14d8cc710
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: ae69075f4678a762b2f9974144ba275f095aac9f
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 98b7d46da60565cec886e89b78bf15dee26691d9f7060d6ad48852f19ea0fa0799a50412e16e4ee089689aa71dd7e831eff420f8e3ebd811fbe13ecca3631402
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 812d53e7265c0f97af809625ca4d8f2b2a0c963d70e2aad0ae35aa6c8f2ac882138e7d6257f03b8251baf5bde0e04795af396da0bdad234359f7e8e7b05f43d6
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,3 +1,11 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ## 2019-07-31 - Release 1.9.6
         
     | 
| 
      
 2 
     | 
    
         
            +
            - Suppress the warning message generated when the Augeas gem is not available.
         
     | 
| 
      
 3 
     | 
    
         
            +
            - Searching through older Facter releases for a fact set that does not exist no
         
     | 
| 
      
 4 
     | 
    
         
            +
              longer causes it to hang indefinitely.
         
     | 
| 
      
 5 
     | 
    
         
            +
            - The `operatingsystemrelease` values are now correctly escaped when building
         
     | 
| 
      
 6 
     | 
    
         
            +
              the FacterDB filters, allowing the use of `operatingsystemrelease` values
         
     | 
| 
      
 7 
     | 
    
         
            +
              that contain special regular expression characters like parentheses.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
       1 
9 
     | 
    
         
             
            ## 2019-07-29 - Release 1.9.5
         
     | 
| 
       2 
10 
     | 
    
         
             
            - The default version of Facter to search for is now configurable with
         
     | 
| 
       3 
11 
     | 
    
         
             
              `RSpec.configuration.default_facter_version`.
         
     | 
    
        data/lib/rspec-puppet-facts.rb
    CHANGED
    
    | 
         @@ -59,7 +59,7 @@ module RspecPuppetFacts 
     | 
|
| 
       59 
59 
     | 
    
         
             
                    Array(os_sup['operatingsystemrelease']).map do |operatingsystemmajrelease|
         
     | 
| 
       60 
60 
     | 
    
         
             
                      opts[:hardwaremodels].each do |hardwaremodel|
         
     | 
| 
       61 
61 
     | 
    
         | 
| 
       62 
     | 
    
         
            -
                        os_release_filter = "/^#{operatingsystemmajrelease.split(' ')[0]}/"
         
     | 
| 
      
 62 
     | 
    
         
            +
                        os_release_filter = "/^#{Regexp.escape(operatingsystemmajrelease.split(' ')[0])}/"
         
     | 
| 
       63 
63 
     | 
    
         
             
                        if os_sup['operatingsystem'] =~ /BSD/i
         
     | 
| 
       64 
64 
     | 
    
         
             
                          hardwaremodel = 'amd64'
         
     | 
| 
       65 
65 
     | 
    
         
             
                        elsif os_sup['operatingsystem'] =~ /Solaris/i
         
     | 
| 
         @@ -109,7 +109,7 @@ module RspecPuppetFacts 
     | 
|
| 
       109 
109 
     | 
    
         
             
                  db = FacterDB.get_facts(filter_spec.merge({ :facterversion =>  facter_version_filter }))
         
     | 
| 
       110 
110 
     | 
    
         | 
| 
       111 
111 
     | 
    
         
             
                  version = facterversion
         
     | 
| 
       112 
     | 
    
         
            -
                  while db.empty? && version !~ /\d+\.0($|\.\d+)/
         
     | 
| 
      
 112 
     | 
    
         
            +
                  while db.empty? && version !~ /\A\d+\.0($|\.\d+)/
         
     | 
| 
       113 
113 
     | 
    
         
             
                    version = RspecPuppetFacts.down_facter_version(version)
         
     | 
| 
       114 
114 
     | 
    
         
             
                    facter_version_filter = RspecPuppetFacts.facter_version_to_filter(version)
         
     | 
| 
       115 
115 
     | 
    
         
             
                    db = FacterDB.get_facts(filter_spec.merge({ :facterversion =>  facter_version_filter }))
         
     | 
| 
         @@ -260,8 +260,7 @@ module RspecPuppetFacts 
     | 
|
| 
       260 
260 
     | 
    
         
             
              def self.augeas?
         
     | 
| 
       261 
261 
     | 
    
         
             
                require 'augeas'
         
     | 
| 
       262 
262 
     | 
    
         
             
                true
         
     | 
| 
       263 
     | 
    
         
            -
              rescue LoadError 
     | 
| 
       264 
     | 
    
         
            -
                RspecPuppetFacts.warning "Failed to retrieve Augeas version: #{e}"
         
     | 
| 
      
 263 
     | 
    
         
            +
              rescue LoadError
         
     | 
| 
       265 
264 
     | 
    
         
             
                false
         
     | 
| 
       266 
265 
     | 
    
         
             
              end
         
     | 
| 
       267 
266 
     | 
    
         
             
              # :nocov:
         
     | 
| 
         @@ -344,8 +343,9 @@ module RspecPuppetFacts 
     | 
|
| 
       344 
343 
     | 
    
         
             
              # @param minor_subtractor [int] the value which to subtract by
         
     | 
| 
       345 
344 
     | 
    
         
             
              # @api private
         
     | 
| 
       346 
345 
     | 
    
         
             
              def self.down_facter_version(version, minor_subtractor = 1)
         
     | 
| 
       347 
     | 
    
         
            -
             
     | 
| 
       348 
     | 
    
         
            -
             
     | 
| 
       349 
     | 
    
         
            -
             
     | 
| 
      
 346 
     | 
    
         
            +
                major, minor, z = version.split('.')
         
     | 
| 
      
 347 
     | 
    
         
            +
                z = '0' if z.nil?
         
     | 
| 
      
 348 
     | 
    
         
            +
                minor = (minor.to_i - minor_subtractor).to_s
         
     | 
| 
      
 349 
     | 
    
         
            +
                "#{major}.#{minor}.#{z}"
         
     | 
| 
       350 
350 
     | 
    
         
             
              end
         
     | 
| 
       351 
351 
     | 
    
         
             
            end
         
     | 
| 
         @@ -486,6 +486,43 @@ describe RspecPuppetFacts do 
     | 
|
| 
       486 
486 
     | 
    
         
             
                  end
         
     | 
| 
       487 
487 
     | 
    
         
             
                end
         
     | 
| 
       488 
488 
     | 
    
         | 
| 
      
 489 
     | 
    
         
            +
                context 'When the operatingsystemrelease contains parens' do
         
     | 
| 
      
 490 
     | 
    
         
            +
                  subject do
         
     | 
| 
      
 491 
     | 
    
         
            +
                    on_supported_os(
         
     | 
| 
      
 492 
     | 
    
         
            +
                      {
         
     | 
| 
      
 493 
     | 
    
         
            +
                        :supported_os => [
         
     | 
| 
      
 494 
     | 
    
         
            +
                          {
         
     | 
| 
      
 495 
     | 
    
         
            +
                            'operatingsystem'        => 'IOS',
         
     | 
| 
      
 496 
     | 
    
         
            +
                            'operatingsystemrelease' => ['12.2(25)EWA9'],
         
     | 
| 
      
 497 
     | 
    
         
            +
                          }
         
     | 
| 
      
 498 
     | 
    
         
            +
                        ],
         
     | 
| 
      
 499 
     | 
    
         
            +
                      }
         
     | 
| 
      
 500 
     | 
    
         
            +
                    )
         
     | 
| 
      
 501 
     | 
    
         
            +
                  end
         
     | 
| 
      
 502 
     | 
    
         
            +
             
     | 
| 
      
 503 
     | 
    
         
            +
                  before(:each) do
         
     | 
| 
      
 504 
     | 
    
         
            +
                    allow(RspecPuppetFacts).to receive(:warning).with(a_string_matching(/no facts were found/i))
         
     | 
| 
      
 505 
     | 
    
         
            +
                    allow(FacterDB).to receive(:get_facts).and_call_original
         
     | 
| 
      
 506 
     | 
    
         
            +
                  end
         
     | 
| 
      
 507 
     | 
    
         
            +
             
     | 
| 
      
 508 
     | 
    
         
            +
                  it 'escapes the parens in the filter' do
         
     | 
| 
      
 509 
     | 
    
         
            +
                    filter = [
         
     | 
| 
      
 510 
     | 
    
         
            +
                      include(
         
     | 
| 
      
 511 
     | 
    
         
            +
                        :operatingsystem        => "IOS",
         
     | 
| 
      
 512 
     | 
    
         
            +
                        :operatingsystemrelease => "/^12\\.2\\(25\\)EWA9/",
         
     | 
| 
      
 513 
     | 
    
         
            +
                        :hardwaremodel          => "x86_64",
         
     | 
| 
      
 514 
     | 
    
         
            +
                      ),
         
     | 
| 
      
 515 
     | 
    
         
            +
                    ]
         
     | 
| 
      
 516 
     | 
    
         
            +
             
     | 
| 
      
 517 
     | 
    
         
            +
                    expect(FacterDB).to receive(:get_facts).with(filter)
         
     | 
| 
      
 518 
     | 
    
         
            +
                    subject
         
     | 
| 
      
 519 
     | 
    
         
            +
                  end
         
     | 
| 
      
 520 
     | 
    
         
            +
             
     | 
| 
      
 521 
     | 
    
         
            +
                  it 'does not raise an error' do
         
     | 
| 
      
 522 
     | 
    
         
            +
                    expect { subject }.not_to raise_error
         
     | 
| 
      
 523 
     | 
    
         
            +
                  end
         
     | 
| 
      
 524 
     | 
    
         
            +
                end
         
     | 
| 
      
 525 
     | 
    
         
            +
             
     | 
| 
       489 
526 
     | 
    
         
             
                context 'Without a custom facterversion in the options hash' do
         
     | 
| 
       490 
527 
     | 
    
         
             
                  subject do
         
     | 
| 
       491 
528 
     | 
    
         
             
                    on_supported_os(
         
     | 
| 
         @@ -753,10 +790,6 @@ describe RspecPuppetFacts do 
     | 
|
| 
       753 
790 
     | 
    
         
             
                  expect(subject.common_facts[:augeasversion]).to eq 'my_version'
         
     | 
| 
       754 
791 
     | 
    
         
             
                end
         
     | 
| 
       755 
792 
     | 
    
         | 
| 
       756 
     | 
    
         
            -
                it 'can output a warning message' do
         
     | 
| 
       757 
     | 
    
         
            -
                  expect { RspecPuppetFacts.warning('test') }.to output(/test/).to_stderr_from_any_process
         
     | 
| 
       758 
     | 
    
         
            -
                end
         
     | 
| 
       759 
     | 
    
         
            -
             
     | 
| 
       760 
793 
     | 
    
         
             
                context 'when mcollective is available' do
         
     | 
| 
       761 
794 
     | 
    
         
             
                  module MCollective_stub
         
     | 
| 
       762 
795 
     | 
    
         
             
                    VERSION = 'my_version'
         
     | 
| 
         @@ -850,4 +883,17 @@ describe RspecPuppetFacts do 
     | 
|
| 
       850 
883 
     | 
    
         
             
                  end
         
     | 
| 
       851 
884 
     | 
    
         
             
                end
         
     | 
| 
       852 
885 
     | 
    
         
             
              end
         
     | 
| 
      
 886 
     | 
    
         
            +
             
     | 
| 
      
 887 
     | 
    
         
            +
              describe '.down_facter_version' do
         
     | 
| 
      
 888 
     | 
    
         
            +
                context 'with MAJOR.MINOR.PATCH version' do
         
     | 
| 
      
 889 
     | 
    
         
            +
                  it 'decrements MINOR version' do
         
     | 
| 
      
 890 
     | 
    
         
            +
                    expect(RspecPuppetFacts.down_facter_version('3.5.5')).to eq '3.4.5'
         
     | 
| 
      
 891 
     | 
    
         
            +
                  end
         
     | 
| 
      
 892 
     | 
    
         
            +
                end
         
     | 
| 
      
 893 
     | 
    
         
            +
                context 'with MAJOR.MINOR version' do
         
     | 
| 
      
 894 
     | 
    
         
            +
                  it 'decrements MINOR version and sets PATCH to \'0\'' do
         
     | 
| 
      
 895 
     | 
    
         
            +
                    expect(RspecPuppetFacts.down_facter_version('3.5')).to eq '3.4.0'
         
     | 
| 
      
 896 
     | 
    
         
            +
                  end
         
     | 
| 
      
 897 
     | 
    
         
            +
                end
         
     | 
| 
      
 898 
     | 
    
         
            +
              end
         
     | 
| 
       853 
899 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: rspec-puppet-facts
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.9. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.9.6
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Mickaël Canévet
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2019- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2019-10-31 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: mime-types
         
     | 
| 
         @@ -178,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       178 
178 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       179 
179 
     | 
    
         
             
            requirements: []
         
     | 
| 
       180 
180 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       181 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 181 
     | 
    
         
            +
            rubygems_version: 2.6.14.1
         
     | 
| 
       182 
182 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       183 
183 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       184 
184 
     | 
    
         
             
            summary: Standard facts fixtures for Puppet
         
     |