Sha256: 796b53030ba35178cead498e8545010c68f3493aa1cd57c05252677eb391dc44

Contents?: true

Size: 838 Bytes

Versions: 3

Compression:

Stored size: 838 Bytes

Contents

module Serverspec
  module Commands
    class Base
      class NotImplementedError < Exception; end

      def check_enabled service
        raise NotImplementedError.new
      end

      def check_file file
        "test -f #{file}"
      end

      def check_directory directory
        "test -d #{directory}"
      end

      def check_user user
        "id #{user}"
      end

      def check_group group
        "getent group | grep -wq #{group}"
      end

      def check_installed package
        raise NotImplementedError.new
      end

      def check_listening port
        "netstat -tnl | grep ':#{port} '"
      end

      def check_running service
        "service #{service} status"
      end

      def check_file_contain file, expected_pattern
        "grep -q '#{expected_pattern}' #{file} "
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
serverspec-0.0.5 lib/serverspec/commands/base.rb
serverspec-0.0.4 lib/serverspec/commands/base.rb
serverspec-0.0.3 lib/serverspec/commands/base.rb