Sha256: b166974791a806566941e275b943ebc72342037960511a4fdf257c9224ab2a93

Contents?: true

Size: 952 Bytes

Versions: 10

Compression:

Stored size: 952 Bytes

Contents

# frozen_string_literal: true

# takelage 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 = _socket_get_agent_ssh_socket_path

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

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

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

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

  private

  # 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

10 entries across 10 versions & 1 rubygems

Version Path
takelage-0.28.26 lib/takelage/info/status/ssh.rb
takelage-0.28.24 lib/takelage/info/status/ssh.rb
takelage-0.28.14 lib/takelage/info/status/ssh.rb
takelage-0.28.11 lib/takelage/info/status/ssh.rb
takelage-0.28.8 lib/takelage/info/status/ssh.rb
takelage-0.28.7 lib/takelage/info/status/ssh.rb
takelage-0.28.5 lib/takelage/info/status/ssh.rb
takelage-0.27.1 lib/takelage/info/status/ssh.rb
takelage-0.27.0 lib/takelage/info/status/ssh.rb
takelage-0.26.7 lib/takelage/info/status/ssh.rb