Issue #16506 has been updated by Alex Harvey.

Hi Jeff,

I already have a patch with RSpec tests for this one.  Was just waiting for the 
bug to be accepted.

<pre>
diff --git a/lib/facter/hardwareisa.rb b/lib/facter/hardwareisa.rb
index ecd5a19..1529734 100644
--- a/lib/facter/hardwareisa.rb
+++ b/lib/facter/hardwareisa.rb
@@ -4,12 +4,17 @@
 #   Returns hardware processor type.
 #
 # Resolution:
-#   On Solaris, Linux and the BSDs simply uses the output of "uname -p"
+#   On Solaris, AIX, Linux and the BSDs simply uses the output of "uname -p"
+#   On HP-UX, "uname -m" gives us the same information.
 #
 # Caveats:
 #   Some linuxes return unknown to uname -p with relative ease.
 #

 Facter.add(:hardwareisa) do
-  setcode 'uname -p'
+  if Facter.value(:kernel) == 'HP-UX'
+    setcode 'uname -m'
+  else
+    setcode 'uname -p'
+  end
 end
diff --git a/spec/unit/hardwareisa_spec.rb b/spec/unit/hardwareisa_spec.rb
index f76b319..a709e8c 100755
--- a/spec/unit/hardwareisa_spec.rb
+++ b/spec/unit/hardwareisa_spec.rb
@@ -31,4 +31,11 @@ describe "Hardwareisa fact" do

     Facter.fact(:hardwareisa).value.should == "Clyde"
   end
+
+  it "should match uname -m on HP-UX" do
+    Facter.fact(:kernel).stubs(:value).returns("HP-UX")
+    Facter::Util::Resolution.stubs(:exec).with("uname -m").returns("Pac-Man")
+
+    Facter.fact(:hardwareisa).value.should == "Pac-Man"
+  end
 end
</pre>

-Alex
----------------------------------------
Bug #16506: -p option invalid passed to uname in 'hardwareisa' fact on HP-UX
https://projects.puppetlabs.com/issues/16506#change-73621

Author: Alex Harvey
Status: Accepted
Priority: Normal
Assignee: Alex Harvey
Category: hpux
Target version: 1.6.x
Keywords: 
Branch: 
Affected Facter version: 


The following code does not work on HP-UX -

    Facter.add(:hardwareisa) do
      setcode 'uname -p'
    end

And the following results -

    $ facter hardwareisa
    /usr/bin/uname: illegal option -- p
    usage: uname [-amnrsvil] [-S nodename]

This affects all versions of HP-UX.


-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en.

Reply via email to