Sha256: 2fe897fc49f27392d03d18ce4052bb21e17247a682bb46757b8f305dba290058

Contents?: true

Size: 711 Bytes

Versions: 43

Compression:

Stored size: 711 Bytes

Contents

module Serverspec::Type
  class DockerContainer < DockerBase
    def running?
      inspection['State']['Running'] && !inspection['State']['Restarting']
    end

    def has_volume?(container_path, host_path)
      if (inspection['Mounts'])
        check_volume(container_path, host_path)
      else
        check_volume_pre_1_8(container_path, host_path)
      end
    end

    private
    def check_volume(container_path, host_path)
      inspection['Mounts'].find {|mount|
        mount['Destination'] == container_path &&
        mount['Source'] == host_path
      }
    end

    def check_volume_pre_1_8(container_path, host_path)
      inspection['Volumes'][container_path] == host_path
    end
  end
end

Version data entries

43 entries across 43 versions & 3 rubygems

Version Path
serverspec-2.42.3 lib/serverspec/type/docker_container.rb
serverspec-2.42.2 lib/serverspec/type/docker_container.rb
serverspec-2.42.1 lib/serverspec/type/docker_container.rb
serverspec-cem-acpt-2.42.0 lib/serverspec/type/docker_container.rb
serverspec-2.42.0 lib/serverspec/type/docker_container.rb
serverspec-2.41.8 lib/serverspec/type/docker_container.rb
serverspec-2.41.7 lib/serverspec/type/docker_container.rb
serverspec-2.41.6 lib/serverspec/type/docker_container.rb
serverspec-2.41.5 lib/serverspec/type/docker_container.rb
serverspec-2.41.4 lib/serverspec/type/docker_container.rb
serverspec-ruby19-2.24.3 lib/serverspec/type/docker_container.rb
serverspec-2.41.3 lib/serverspec/type/docker_container.rb
serverspec-2.41.2 lib/serverspec/type/docker_container.rb
serverspec-2.41.1 lib/serverspec/type/docker_container.rb
serverspec-2.41.0 lib/serverspec/type/docker_container.rb
serverspec-2.40.0 lib/serverspec/type/docker_container.rb
serverspec-2.39.2 lib/serverspec/type/docker_container.rb
serverspec-2.39.1 lib/serverspec/type/docker_container.rb
serverspec-2.39.0 lib/serverspec/type/docker_container.rb
serverspec-2.38.1 lib/serverspec/type/docker_container.rb