Sha256: 2585138eb02be98b0bbebc0fa65e1e20131bb22819564b731e3888e935165e4e

Contents?: true

Size: 1.44 KB

Versions: 18

Compression:

Stored size: 1.44 KB

Contents

# frozen_string_literal: true

# tau mutagen socket create
module MutagenSocketCreate
  # Backend method for mutagen socket create.
  # rubocop:disable Metrics/MethodLength
  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
  # rubocop:enable Metrics/MethodLength

  private

  # Get git branch.
  # rubocop:disable Metrics/MethodLength
  def _mutagen_socket_create_socket(socketname, containersock, hostsock)
    cmd_create_socket = format(
      config.active['cmd_mutagen_forward_socket_create'],
      socketname: socketname,
      containersock: containersock,
      hostsock: hostsock,
      username: @username,
      container: @hostname,
      hostlabel: @hostlabel,
      takellabel: @takellabel
    )
    run cmd_create_socket
  end
  # rubocop:enable Metrics/MethodLength
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
takeltau-0.39.11 lib/takeltau/mutagen/socket/create.rb
takeltau-0.39.7 lib/takeltau/mutagen/socket/create.rb
takeltau-0.39.2 lib/takeltau/mutagen/socket/create.rb
takeltau-0.39.0 lib/takeltau/mutagen/socket/create.rb
takeltau-0.38.2 lib/takeltau/mutagen/socket/create.rb
takeltau-0.38.1 lib/takeltau/mutagen/socket/create.rb
takeltau-0.38.0 lib/takeltau/mutagen/socket/create.rb
takeltau-0.37.3 lib/takeltau/mutagen/socket/create.rb
takeltau-0.37.1 lib/takeltau/mutagen/socket/create.rb
takeltau-0.36.5 lib/takeltau/mutagen/socket/create.rb
takeltau-0.36.4 lib/takeltau/mutagen/socket/create.rb
takeltau-0.36.3 lib/takeltau/mutagen/socket/create.rb
takeltau-0.36.1 lib/takeltau/mutagen/socket/create.rb
takeltau-0.35.18 lib/takeltau/mutagen/socket/create.rb
takeltau-0.35.15 lib/takeltau/mutagen/socket/create.rb
takeltau-0.35.14 lib/takeltau/mutagen/socket/create.rb
takeltau-0.35.12 lib/takeltau/mutagen/socket/create.rb
takeltau-0.35.11 lib/takeltau/mutagen/socket/create.rb