Sha256: 25f8a61704f6e8debf5712f6082be926cf7755466dc6cd8e2409e6381ee76f78

Contents?: true

Size: 1.17 KB

Versions: 40

Compression:

Stored size: 1.17 KB

Contents

class Specinfra::Command::Solaris::Base::Inventory < Specinfra::Command::Base::Inventory
  class << self
    def get_memory
      'false'
    end 
    def get_cpu
      'false'
    end 
    def get_hostname
      'uname -n' 
    end

    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

    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

    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
  end
end

Version data entries

40 entries across 40 versions & 2 rubygems

Version Path
specinfra-cisco-2.41.0 lib/specinfra/command/solaris/base/inventory.rb
specinfra-2.43.11 lib/specinfra/command/solaris/base/inventory.rb
specinfra-cisco-2.40.2 lib/specinfra/command/solaris/base/inventory.rb
specinfra-2.43.10 lib/specinfra/command/solaris/base/inventory.rb
specinfra-2.43.9 lib/specinfra/command/solaris/base/inventory.rb
specinfra-2.43.8 lib/specinfra/command/solaris/base/inventory.rb
specinfra-2.43.7 lib/specinfra/command/solaris/base/inventory.rb
specinfra-2.43.6 lib/specinfra/command/solaris/base/inventory.rb
specinfra-2.43.5 lib/specinfra/command/solaris/base/inventory.rb
specinfra-2.43.4 lib/specinfra/command/solaris/base/inventory.rb
specinfra-2.43.3 lib/specinfra/command/solaris/base/inventory.rb
specinfra-2.43.2 lib/specinfra/command/solaris/base/inventory.rb
specinfra-2.43.1 lib/specinfra/command/solaris/base/inventory.rb
specinfra-2.43.0 lib/specinfra/command/solaris/base/inventory.rb
specinfra-2.42.2 lib/specinfra/command/solaris/base/inventory.rb
specinfra-2.42.1 lib/specinfra/command/solaris/base/inventory.rb
specinfra-2.42.0 lib/specinfra/command/solaris/base/inventory.rb
specinfra-2.41.1 lib/specinfra/command/solaris/base/inventory.rb
specinfra-2.41.0 lib/specinfra/command/solaris/base/inventory.rb
specinfra-2.40.2 lib/specinfra/command/solaris/base/inventory.rb