Sha256: 5c3fa977417a1b17488e2210eba24b646119dea33b279659029d5b601b8eac54

Contents?: true

Size: 633 Bytes

Versions: 1

Compression:

Stored size: 633 Bytes

Contents

module Percheron
  module Actions
    class Shell
      include Base

      DEFAULT_SHELL = '/bin/sh'
      DOCKER_CLIENT = 'docker'

      def initialize(container, shell: DEFAULT_SHELL)
        @container = container
        @shell = shell
      end

      def execute!
        Validators::DockerClient.new.validate_docker_client_available!
        $logger.debug "Executing #{shell} on '#{container.name}' container"
        exec!
      end

      private

        attr_reader :container, :shell

        def exec!
          system('%s exec -ti %s %s' % [ DOCKER_CLIENT, container.full_name, shell ])
        end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
percheron-0.7.2 lib/percheron/actions/shell.rb