On 19 November 2010 09:37, Dominic Cleal <dcl...@redhat.com> wrote: > Use prtdiag output on Solaris/SPARC to determine manufacturer and productname > as > smbios is unavailable.
I don't have a sparc box to test this against but +1 Paul > > Signed-off-by: Dominic Cleal <dcl...@redhat.com> > --- > Local-branch: ticket/master/5325 > lib/facter/manufacturer.rb | 2 ++ > lib/facter/util/manufacturer.rb | 20 ++++++++++++++++++++ > 2 files changed, 22 insertions(+), 0 deletions(-) > > diff --git a/lib/facter/manufacturer.rb b/lib/facter/manufacturer.rb > index 9d66465..cbbb88b 100644 > --- a/lib/facter/manufacturer.rb > +++ b/lib/facter/manufacturer.rb > @@ -13,6 +13,8 @@ if Facter.value(:kernel) == "OpenBSD" > } > > Facter::Manufacturer.sysctl_find_system_info(mfg_keys) > +elsif Facter.value(:kernel) == "SunOS" and Facter.value(:hardwareisa) == > "sparc" > + Facter::Manufacturer.prtdiag_sparc_find_system_info() > else > query = { > '[Ss]ystem [Ii]nformation' => [ > diff --git a/lib/facter/util/manufacturer.rb b/lib/facter/util/manufacturer.rb > index 112380b..5ac0585 100644 > --- a/lib/facter/util/manufacturer.rb > +++ b/lib/facter/util/manufacturer.rb > @@ -60,4 +60,24 @@ module Facter::Manufacturer > end > end > end > + > + def self.prtdiag_sparc_find_system_info() > + # Parses prtdiag for a SPARC architecture string, won't work with > Solaris x86 > + output = Facter::Util::Resolution.exec('/usr/sbin/prtdiag') > + > + # System Configuration: Sun Microsystems sun4u Sun SPARC > Enterprise M3000 Server > + sysconfig = output.split("\n")[0] > + if sysconfig =~ /^System > Configuration:\s+(.+?)\s+(sun\d+\S+)\s+(.+)/ then > + Facter.add('manufacturer') do > + setcode do > + $1 > + end > + end > + Facter.add('productname') do > + setcode do > + $3 > + end > + end > + end > + end > end > -- > 1.7.3.2 > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Developers" group. > To post to this group, send email to puppet-...@googlegroups.com. > To unsubscribe from this group, send email to > puppet-dev+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-dev?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To post to this group, send email to puppet-...@googlegroups.com. To unsubscribe from this group, send email to puppet-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.