Sha256: 6d73212f5a422c7ee4ebce7ea5c2ed369878c9ee194c99fd1bb14c19f45485c2

Contents?: true

Size: 1003 Bytes

Versions: 4

Compression:

Stored size: 1003 Bytes

Contents

module Serverspec
  module Commands
    class Solaris < Base
      def check_enabled service
        "svcs -l #{service} 2> /dev/null | grep 'enabled      true'"
      end

      def check_installed package
        "pkg list -H #{package} 2> /dev/null"
      end

      def check_listening port
        "netstat -an 2> /dev/null | egrep 'LISTEN|Idle' | grep '\.#{port} '"
      end

      def check_running service
        "svcs -l #{service} status 2> /dev/null |grep 'state        online'"
      end

      def check_cron_entry user, entry
        entry_escaped = entry.gsub(/\*/, '\\*')
        "crontab -l #{user} | grep '#{entry_escaped}'"
      end

      def check_zfs zfs, property=nil
        if property.nil?
          "/sbin/zfs list -H #{zfs}"
        else
          commands = []
          property.sort.each do |key, value|
            commands << "/sbin/zfs list -H -o #{key} #{zfs} | grep ^#{value}$"
          end
          commands.join(' && ')
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
serverspec-0.2.5 lib/serverspec/commands/solaris.rb
serverspec-0.2.4 lib/serverspec/commands/solaris.rb
serverspec-0.2.3 lib/serverspec/commands/solaris.rb
serverspec-0.2.2 lib/serverspec/commands/solaris.rb