Uploaded image for project: 'Facter'
  1. Facter
  2. FACT-1115

Treats non-zero responses as failures

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: FACT 3.0.1
    • Fix Version/s: FACT 3.0.2
    • Component/s: None
    • Labels:
      None
    • Template:
    • Story Points:
      1
    • Sprint:
      Client 2015-07-22

      Description

      Command sshd gets sent bad flags to get it to cough out version numbers and fails now, no --version flag.

      Reproduction Case

      • Install the puppet-agent package.
      • Attempt to get output from a command with a non-zero exit code using Facter::Core::Execution.exec and Facter::Util::Resolution.exec.

      Outcome

      A nil is returned instead of an output string:

      # /opt/puppetlabs/bin/facter --version
      3.0.1 (commit 2412728f82590ca642b056e823cadacad50d21da)
       
      # /opt/puppetlabs/puppet/bin/ruby -rfacter -e 'puts Facter::Core::Execution.exec("sshd -V 2>&1").inspect'
      nil
       
      # /opt/puppetlabs/puppet/bin/ruby -rfacter -e 'puts Facter::Util::Resolution.exec("sshd -V 2>&1").inspect'
      nil
      

      Expected Outcome

      An output string is returned, as was the case in Facter 2.x:

      # /opt/puppet/bin/facter --version
      2.4.4
       
      # /opt/puppet/bin/ruby -rfacter -e 'puts Facter::Core::Execution.exec("sshd -V 2>&1").inspect'
      "sshd: illegal option -- V\nOpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013\nusage: sshd [-46DdeiqTt] [-b bits] [-C connection_spec] [-c host_cert_file]\n            [-f config_file] [-g login_grace_time] [-h host_key_file]\n            [-k key_gen_time] [-o option] [-p port] [-u len]"
       
      # # /opt/puppet/bin/ruby -rfacter -e 'puts Facter::Util::Resolution.exec("sshd -V 2>&1").inspect'
      "sshd: illegal option -- V\nOpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013\nusage: sshd [-46DdeiqTt] [-b bits] [-C connection_spec] [-c host_cert_file]\n            [-f config_file] [-g login_grace_time] [-h host_key_file]\n            [-k key_gen_time] [-o option] [-p port] [-u len]"
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                john.duarte John Duarte
                Reporter:
                patricia Patricia Torvalds
                QA Contact:
                John Duarte
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support