Class: Specinfra::Command::Solaris::Base::Inventory
- Inherits:
-
Base::Inventory
- Object
- Base
- Base::Inventory
- Specinfra::Command::Solaris::Base::Inventory
- Defined in:
- lib/specinfra/command/solaris/base/inventory.rb
Class Method Summary collapse
- .get_cpu ⇒ Object
- .get_domain ⇒ Object
- .get_filesystem ⇒ Object
- .get_fqdn ⇒ Object
- .get_hostname ⇒ Object
- .get_memory ⇒ Object
- .get_system_product_name ⇒ Object
Methods inherited from Base::Inventory
Methods inherited from Base
Class Method Details
.get_cpu ⇒ Object
6 7 8 |
# File 'lib/specinfra/command/solaris/base/inventory.rb', line 6 def get_cpu 'false' end |
.get_domain ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/specinfra/command/solaris/base/inventory.rb', line 13 def get_domain # There is no sure way to get the hostname like on linux # This code is somewhat resembiling the functionality # of the dnsdomainname command. # Assumes either /etc/hosts or DNS is properly configured. %Q{getent hosts `uname -n` | } + %Q{nawk -v h=`uname -n` '{sub(h".", "", $2); if ($2 != h){ print $2 } else { exit 1 } }'} end |
.get_filesystem ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/specinfra/command/solaris/base/inventory.rb', line 29 def get_filesystem # emulates df -kP on Linux # Also offers a creative solution for the # multiple swap entries by adding a number suffix. # e.g. swap0, swap1 and so on. %Q{df -k | nawk -v i=0 '$1 == "swap" { $1=$1i; i++ }; NF == 1 { printf($1); next }; { print }'} end |
.get_fqdn ⇒ Object
22 23 24 25 26 27 |
# File 'lib/specinfra/command/solaris/base/inventory.rb', line 22 def get_fqdn # Same as with get_domain assumes that either # /etc/hosts or DNS are configured correctly. %Q{getent hosts `uname -n` | } + %Q{nawk -v h=`unme -n` '{ if ($2 ~ h".") { print $2 } else { exit 1 } }'} end |
.get_hostname ⇒ Object
9 10 11 |
# File 'lib/specinfra/command/solaris/base/inventory.rb', line 9 def get_hostname 'uname -n' end |
.get_memory ⇒ Object
3 4 5 |
# File 'lib/specinfra/command/solaris/base/inventory.rb', line 3 def get_memory 'false' end |
.get_system_product_name ⇒ Object
37 38 39 |
# File 'lib/specinfra/command/solaris/base/inventory.rb', line 37 def get_system_product_name "prtdiag | grep 'System Configuration'" end |