Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-3828

Nagios integration test is sensitive to locally installed nagios.cfg

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Types and Providers
    • Labels:
      None
    • Template:
    • Story Points:
      1

      Description

      If /etc/nagios/nagios_host.cfg exists but is unreadable, then the nagios_spec integration test will try to prefetch all instances, but receive an exception due to the file being unreadable:

      #<Puppet::Error: Puppet::Util::FileType::FileTypeFlat could not read /etc/nagios/nagios_host.cfg: Permission denied - /etc/nagios/nagios_host.cfg>
      

      Starting in commit be3d1972379cbd45ee6988d6fe6432d0d201d2f6 exceptions that occur in the prefetch phase are fatal, so the following test will fail. The test should be fixed to not be sensitive to local nagios.cfg files.

      ~/work/puppet (master)  $ git checkout be3d197
      ~/work/puppet (master)  $ be rspec spec/integration/type/nagios_spec.rb:49
      Run options:
        include {:locations=>{"./spec/integration/type/nagios_spec.rb"=>[49]}}
        exclude {:broken=>true, :benchmark=>true}
      F
       
      Failures:
       
        1) Nagios file creation when creating a nagios config file which is not managed should choose the file mode if requested
           Failure/Error: expect_file_mode(target_file, "640")
             expected: "100640"
                  got: "100600" (using ==)
           # ./spec/lib/puppet_spec/files.rb:87:in `expect_file_mode'
           # ./spec/integration/type/nagios_spec.rb:49:in `block (4 levels) in <top (required)>'
       
      Finished in 0.1681 seconds
      1 example, 1 failure
       
      Failed examples:
       
      rspec ./spec/integration/type/nagios_spec.rb:40 # Nagios file creation when creating a nagios config file which is not managed should choose the file mode if requested
       
      ~/work/puppet (master)  $ sudo ls -la  /etc/nagios/nagios_host.cfg
      -rw-------  1 root  wheel  435 Feb 19  2014 /etc/nagios/nagios_host.cfg
      ~/work/puppet (master)  $ sudo cat  /etc/nagios/nagios_host.cfg
      # HEADER: This file was autogenerated at 2014-02-19 13:39:25 -0800
      # HEADER: by puppet.  While it can still be managed manually, it
      # HEADER: is definitely not recommended.
      define host {
      	address                        10.3.100.72
      	alias                          proxytest
      	host_name                      gib-proxytest
      	hostgroups                     gib
      	parents
      	use                            linux-server
      }
      ~/work/puppet (master)  $ sudo mv /etc/nagios/nagios_host.cfg /etc/nagios/nagios_host.cfg.backup
      ~/work/puppet (master)  $ be rspec spec/integration/type/nagios_spec.rb:49
      Run options:
        include {:locations=>{"./spec/integration/type/nagios_spec.rb"=>[49]}}
        exclude {:broken=>true, :benchmark=>true}
      .
       
      Finished in 0.17685 seconds
      1 example, 0 failures
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              josh Josh Cooper
              QA Contact:
              Eric Thompson
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Zendesk Support