Class: SwarmClusterCliOpe::Models::MappedVolume

Inherits:
Base
  • Object
show all
Defined in:
lib/swarm_cluster_cli_ope/models/mapped_volume.rb

Constant Summary

Constants inherited from Base

Base::IDNotFoundOnObject

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#docker_command, #docker_inspect, #mapped_uri_connection

Methods included from LoggerConcern

#logger

Constructor Details

#initialize(obj, container: nil) ⇒ MappedVolume

Returns a new instance of MappedVolume.



17
18
19
20
# File 'lib/swarm_cluster_cli_ope/models/mapped_volume.rb', line 17

def initialize(obj, container: nil)
  super(obj)
  @container = container
end

Instance Attribute Details

#containerContainer

Returns:



6
7
8
# File 'lib/swarm_cluster_cli_ope/models/mapped_volume.rb', line 6

def container
  @container
end

#destinationString

Returns destinazione del bind nel container.

Returns:

  • (String)

    destinazione del bind nel container



15
16
17
# File 'lib/swarm_cluster_cli_ope/models/mapped_volume.rb', line 15

def destination
  @destination
end

#sourceString

Returns sorgente del bind.

Returns:

  • (String)

    sorgente del bind



12
13
14
# File 'lib/swarm_cluster_cli_ope/models/mapped_volume.rb', line 12

def source
  @source
end

#typeString

Returns tipologia di volume mappato [bind,volume].

Returns:

  • (String)

    tipologia di volume mappato [bind,volume]



9
10
11
# File 'lib/swarm_cluster_cli_ope/models/mapped_volume.rb', line 9

def type
  @type
end

Instance Method Details

#is_binded?Boolean

Controllo se il volume è bindato con l’host

Returns:

  • (Boolean)


24
25
26
# File 'lib/swarm_cluster_cli_ope/models/mapped_volume.rb', line 24

def is_binded?
  type == 'bind'
end

#ssh_connection_pathObject

Costruisce tutta la path da utilizzare per connettersi via ssh, se siamo in locale non sarà presente la parte di server e “:”



31
32
33
34
35
36
37
38
39
# File 'lib/swarm_cluster_cli_ope/models/mapped_volume.rb', line 31

def ssh_connection_path
  #costruisco la stringa per la parte di connetività del container
  out = "#{source}"
  if container.node.is_over_ssh_uri?
    out = "#{container.node.hostname}:#{out}"
  end
  out

end