Uploaded image for project: 'Puppet Development Kit'
  1. Puppet Development Kit
  2. PDK-1207

rspec-puppet-facts: fails on operatingsystemreleases with regular expression meta characters

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PDK 1.14.1
    • Component/s: None
    • Template:
    • Team:
      Puppet Developer Experience
    • Method Found:
      Needs Assessment
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      "operatingsystemrelease" values in metadata.json that contain special regular expression characters like parentheses will no longer cause unit tests to fail.
    • QA Risk Assessment:
      Needs Assessment

      Description

      Found in cisco_ios tests:

      An error occurred while loading ./spec/classes/agent_spec.rb.
      Failure/Error:
          on_supported_os.each do |os, os_facts|
            context "on #{os}" do
              let(:facts) { os_facts }
        
              it { is_expected.to compile }
            end
          end
      RuntimeError:
        Error. Missing parentheses '('.
      # ./vendor/bundle/ruby/2.4.0/gems/jgrep-1.5.0/lib/parser/parser.rb:113:in `parse'
      # ./vendor/bundle/ruby/2.4.0/gems/jgrep-1.5.0/lib/parser/parser.rb:9:in `initialize'
      # ./vendor/bundle/ruby/2.4.0/gems/jgrep-1.5.0/lib/jgrep.rb:37:in `new'
      # ./vendor/bundle/ruby/2.4.0/gems/jgrep-1.5.0/lib/jgrep.rb:37:in `jgrep'
      # ./vendor/bundle/ruby/2.4.0/gems/facterdb-0.5.2/lib/facterdb.rb:107:in `get_facts'
      # ./vendor/bundle/ruby/2.4.0/gems/rspec-puppet-facts-1.9.0/lib/rspec-puppet-facts.rb:95:in `on_supported_os'
      # ./spec/classes/agent_spec.rb:4:in `block in <top (required)>'
      # ./spec/classes/agent_spec.rb:3:in `<top (required)>'
      

      probably caused by https://github.com/puppetlabs/cisco_ios/blob/cb824852188bcb0f86dfb186efac9c0f65a6f20f/metadata.json#L22-L23 through https://github.com/mcanevet/rspec-puppet-facts/blob/9c2e13229b452b27b1ad8e3c21925facb8fa1416/lib/rspec-puppet-facts.rb#L58

        Attachments

          Activity

            People

            Assignee:
            tim.sharpe Tim Sharpe
            Reporter:
            david.schmitt David Schmitt
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support