Sha256: 81eb9ab6603fcb5cdf043b19b3fe219a40abd7341343b71c3e7179ef26683519

Contents?: true

Size: 1.14 KB

Versions: 21

Compression:

Stored size: 1.14 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_belonging_primary_group(user, group)
        "id -gn #{escape(user)}| grep ^#{escape(group)}$"
      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

21 entries across 21 versions & 1 rubygems

Version Path
specinfra-1.27.5 lib/specinfra/command/redhat.rb
specinfra-1.27.4 lib/specinfra/command/redhat.rb
specinfra-1.27.3 lib/specinfra/command/redhat.rb
specinfra-1.27.2 lib/specinfra/command/redhat.rb
specinfra-1.27.1 lib/specinfra/command/redhat.rb
specinfra-1.27.0 lib/specinfra/command/redhat.rb
specinfra-1.26.0 lib/specinfra/command/redhat.rb
specinfra-1.25.8 lib/specinfra/command/redhat.rb
specinfra-1.25.7 lib/specinfra/command/redhat.rb
specinfra-1.25.6 lib/specinfra/command/redhat.rb
specinfra-1.25.5 lib/specinfra/command/redhat.rb
specinfra-1.25.4 lib/specinfra/command/redhat.rb
specinfra-1.25.3 lib/specinfra/command/redhat.rb
specinfra-1.25.2 lib/specinfra/command/redhat.rb
specinfra-1.25.1 lib/specinfra/command/redhat.rb
specinfra-1.25.0 lib/specinfra/command/redhat.rb
specinfra-1.24.0 lib/specinfra/command/redhat.rb
specinfra-1.23.1 lib/specinfra/command/redhat.rb
specinfra-1.23.0 lib/specinfra/command/redhat.rb
specinfra-1.22.1 lib/specinfra/command/redhat.rb