Sha256: 2e10b1b7f622d8c65c06526d1fa124aa950596f6e32d77594aac2cf86b1e573b

Contents?: true

Size: 922 Bytes

Versions: 8

Compression:

Stored size: 922 Bytes

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

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
specinfra-0.0.13 lib/specinfra/command/redhat.rb
specinfra-0.0.12 lib/specinfra/command/redhat.rb
specinfra-0.0.11 lib/specinfra/command/redhat.rb
specinfra-0.0.10 lib/specinfra/command/redhat.rb
specinfra-0.0.9 lib/specinfra/command/redhat.rb
specinfra-0.0.8 lib/specinfra/command/redhat.rb
specinfra-0.0.7 lib/specinfra/command/redhat.rb
specinfra-0.0.6 lib/specinfra/command/redhat.rb