Sha256: 5b9d8e483760e972962e1fa2ff00de85ef8fad40be412bdf43736b9b965c2e6f

Contents?: true

Size: 1.04 KB

Versions: 25

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

# tau info status ssh
module InfoStatusSSH
  # Backend method for info status ssh.
  # @return [Boolean] is ssh available?
  # rubocop:disable Metrics/MethodLength
  def info_status_ssh
    log.debug 'Check ssh status'

    ssh_auth_sock = ENV['SSH_AUTH_SOCK']
    gpg_ssh_socket = _info_status_ssh_socket_path.chomp

    unless ssh_auth_sock == gpg_ssh_socket
      log.error 'ssh does not use gpg ssh socket'
      return false
    end

    unless _info_status_ssh_keys
      log.error 'ssh keys are not available'
      return false
    end

    unless _file_exists? gpg_ssh_socket
      log.error 'gpg ssh socket is not available'
      return false
    end

    log.debug 'ssh is available'
    true
  end
  # rubocop:enable Metrics/MethodLength

  private

  # Get ssh socket path
  def _info_status_ssh_socket_path
    run config.active['cmd_info_status_ssh_socket']
  end

  # Check ssh keys
  def _info_status_ssh_keys
    status_keys = try config.active['cmd_info_status_ssh_keys']
    status_keys.exitstatus.zero?
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
takeltau-0.44.14 lib/takeltau/info/status/ssh.rb
takeltau-0.44.12 lib/takeltau/info/status/ssh.rb
takeltau-0.44.11 lib/takeltau/info/status/ssh.rb
takeltau-0.44.8 lib/takeltau/info/status/ssh.rb
takeltau-0.44.2 lib/takeltau/info/status/ssh.rb
takeltau-0.43.23 lib/takeltau/info/status/ssh.rb
takeltau-0.43.21 lib/takeltau/info/status/ssh.rb
takeltau-0.43.19 lib/takeltau/info/status/ssh.rb
takeltau-0.43.16 lib/takeltau/info/status/ssh.rb
takeltau-0.43.15 lib/takeltau/info/status/ssh.rb
takeltau-0.43.14 lib/takeltau/info/status/ssh.rb
takeltau-0.43.10 lib/takeltau/info/status/ssh.rb
takeltau-0.43.6 lib/takeltau/info/status/ssh.rb
takeltau-0.43.4 lib/takeltau/info/status/ssh.rb
takeltau-0.43.2 lib/takeltau/info/status/ssh.rb
takeltau-0.43.1 lib/takeltau/info/status/ssh.rb
takeltau-0.42.7 lib/takeltau/info/status/ssh.rb
takeltau-0.42.5 lib/takeltau/info/status/ssh.rb
takeltau-0.42.4 lib/takeltau/info/status/ssh.rb
takeltau-0.42.3 lib/takeltau/info/status/ssh.rb