Module: MutagenSocketCreate

Included in:
Takeltau::DockerContainer, Takeltau::MutagenSocket
Defined in:
lib/takeltau/mutagen/socket/create.rb

Overview

tau mutagen socket create

Instance Method Summary collapse

Instance Method Details

#mutagen_socket_create(name, containersock, hostsock) ⇒ Object

Backend method for mutagen socket create.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/takeltau/mutagen/socket/create.rb', line 6

def mutagen_socket_create(name, containersock, hostsock)
  # See DockerContainerLib::_docker_container_lib_hostname
  socketname = "#{@hostname[-11..]}-#{name}"
  log.debug "Create the mutagen socket \"#{socketname}\" in the container " \
            "at \"#{containersock}\" pointing to the host at \"#{hostsock}\""

  return false if mutagen_socket_check socketname

  socket_created = _mutagen_socket_create_socket(socketname, containersock, hostsock)

  unless socket_created.include? 'Created session'
    log.debug "Unable to create mutagen socket \"#{socketname}\""
    return false
  end

  log.debug "Created the mutagen socket \"#{socketname}\""
  true
end