Sha256: b3946b5d953f24e22a2d3c0ea95a3e1047c7c366beafbcd1027317b3924d57b0

Contents?: true

Size: 919 Bytes

Versions: 1

Compression:

Stored size: 919 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_process process
        "ps -e | grep -qw #{process}"
      end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
serverspec-0.0.6 lib/serverspec/commands/base.rb