Sha256: ceaf195028387402a48afd5b54608789f2988e0576d32a14e3a20fa1c966b1fd
Contents?: true
Size: 1.02 KB
Versions: 72
Compression:
Stored size: 1.02 KB
Contents
# frozen_string_literal: true module Avm module Instances class Base module AutoValues module Access def auto_access read_entry_optional('ssh.url').present? ? 'ssh' : 'local' end def auto_ssh_hostname inherited_entry_value(:host_id, 'ssh.hostname') end def auto_ssh_port inherited_entry_value(:host_id, 'ssh.port') || 22 end def auto_ssh_username inherited_entry_value(:host_id, 'ssh.username') end def auto_ssh_url inherited_entry_value(:host_id, 'ssh.url') || auto_ssh_url_by_parts end def auto_ssh_url_by_parts read_entry_optional('ssh.hostname').if_present do |a| a = read_entry_optional('ssh.username').if_present(a) { |v| "#{v}@#{a}" } a = read_entry_optional('ssh.port').if_present(a) { |v| "#{a}:#{v}" } "ssh://#{a}" end end end end end end end
Version data entries
72 entries across 72 versions & 1 rubygems