Sha256: 58ab218afdee8d0d36542aab08ffd82b7b9222d593c69551c53b8fb0ebee9cbf

Contents?: true

Size: 941 Bytes

Versions: 2

Compression:

Stored size: 941 Bytes

Contents

# frozen_string_literal: true

# tau docker check daemon
module DockerCheckDaemon
  # Backend method for docker check daemon.
  # @return [Boolean] is the docker daemon running?
  # rubocop:disable Metrics/MethodLength
  # rubocop:disable Metrics/AbcSize
  def docker_check_daemon(docker = 'cmd_docker')
    return true if @docker_daemon_running

    return false unless command_available_else_error? config.active['cmd_docker']

    log.debug 'Check if the docker daemon is running'

    cmd_docker_info = format(
      config.active['cmd_docker_check_daemon_docker_version'],
      docker: config.active[docker]
    )
    status = try cmd_docker_info

    unless status.exitstatus.zero?
      log.error 'The docker daemon is not running'
      return false
    end

    log.debug 'The docker daemon is running'
    @docker_daemon_running = true
    true
  end
  # rubocop:enable Metrics/AbcSize
  # rubocop:enable Metrics/MethodLength
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
takeltau-0.43.16 lib/takeltau/docker/check/daemon.rb
takeltau-0.43.15 lib/takeltau/docker/check/daemon.rb