Module: MutagenSocketCreate

Included in:
Takelage::DockerContainer, Takelage::MutagenSocket
Defined in:
lib/takelage/mutagen/socket/create.rb

Overview

takelage mutagen socket create

Instance Method Summary collapse

Instance Method Details

#mutagen_socket_create(name, containersock, hostsock) ⇒ Object

Backend method for mutagen socket create. rubocop:disable Metrics/MethodLength



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

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

  return false unless mutagen_check_daemon

  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