Sha256: ce83773e096a5874b01724c8423297cb2cead51718fa470e43b318a08bfc9966

Contents?: true

Size: 1.02 KB

Versions: 5

Compression:

Stored size: 1.02 KB

Contents

module Specinfra
  module Command
    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
          cmd = "#{cmd} | grep -w -- #{escape(version)}"
        end
        cmd
      end

      alias :check_installed_by_rpm :check_installed

      def install(package)
        cmd = "yum -y install #{package}"
      end

      def get_package_version(package, opts=nil)
        "rpm -qi #{package} | grep Version | awk '{print $3}'"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
specinfra-2.0.0.beta6 lib/specinfra/command/redhat.rb
specinfra-2.0.0.beta5 lib/specinfra/command/redhat.rb
specinfra-2.0.0.beta4 lib/specinfra/command/redhat.rb
specinfra-2.0.0.beta3 lib/specinfra/command/redhat.rb
specinfra-2.0.0.beta2 lib/specinfra/command/redhat.rb