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

facter doesn't parse gnu uptime output

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: FACT 1.7.6, FACT 2.0.2, FACT 2.1.0
    • Fix Version/s: FACT 2.3.0, FACT 2.4.0
    • Component/s: Community
    • Labels:
      None
    • Environment:

      Solaris x86 or Sparc system where the user has installed the gnu packages and then set there path to use the GNU utilities before /usr/bin
      PATH=/usr/gnu/bin:/usr/sbin:/usr/bin

    • Template:
    • Story Points:
      1
    • Sprint:
      Platform Client 2014-11-26

      Description

      On Solaris if the user has changed there path to use the gnu utilities bin directory before /usr/bin facter will fail to output uptime information

      $ echo $PATH
      /usr/sbin:/usr/bin
      $ facter | grep uptime
      uptime => 1 day
      uptime_days => 1
      uptime_hours => 46
      uptime_seconds => 167460

      $ PATH=/usr/gnu/bin:/usr/sbin:/usr/bin facter | grep uptime
      uptime => 0:00 hours
      uptime_days => 0
      uptime_hours => 0
      uptime_seconds => 0

      To address this issue on Solaris uptime can simply be hardcode to /usr/bin as this is a core utility for both Solaris 10 and Solaris 11

      --- facter-2.1.0/lib/facter/util/uptime.rb.orig	2014-08-15 10:19:59.183717181 -0600
      +++ facter-2.1.0/lib/facter/util/uptime.rb	2014-08-15 10:44:49.611645182 -0600
      @@ -76,6 +76,14 @@
         end
       
         def self.uptime_executable_cmd
      -    "uptime"
      +    if Facter.value(:kernel) == 'SunOS'
      +      # Facter doesn't work with gnu uptime
      +      # force use of /usr/bin/uptime
      +      # in case user PATH has /usr/gnu/bin
      +      # before /usr/bin
      +      "/usr/bin/uptime"
      +    else
      +      "uptime"
      +    end
         end
       end
      

        Attachments

          Issue Links

            Activity

              jsd-sla-details-panel

                People

                • Assignee:
                  Unassigned
                  Reporter:
                  enpointe Kristina Tripp
                  QA Contact:
                  Eric Thompson
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  5 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Zendesk Support