Sha256: 11b8965fb9212e6e56205fddc253f55d30f8889e8478a8c9a544c86f56d41cba

Contents?: true

Size: 850 Bytes

Versions: 3

Compression:

Stored size: 850 Bytes

Contents

module Serverspec
  module Commands
    class RedHat < Linux
      def check_access_by_user(file, user, access)
        # Redhat-specific
        "runuser -s /bin/sh -c \"test -#{access} #{file}\" #{user}"
      end

      def check_enabled(service, level=3)
        "chkconfig --list #{escape(service)} | grep #{level}:on"
      end

      def check_yumrepo(repository)
        "yum repolist all -C | grep ^#{escape(repository)}"
      end

      def check_yumrepo_enabled(repository)
        "yum repolist all -C | grep ^#{escape(repository)} | grep enabled"
      end

      def check_installed(package,version=nil)
        cmd = "rpm -q #{escape(package)}"
        if ! version.nil?
          cmd = "#{cmd} | grep -w -- #{escape(version)}"
        end
        cmd
      end

      alias :check_installed_by_rpm :check_installed
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
serverspec-0.7.8 lib/serverspec/commands/redhat.rb
serverspec-0.7.7 lib/serverspec/commands/redhat.rb
serverspec-0.7.6 lib/serverspec/commands/redhat.rb