Class: Vagrant::Smartos::Zones::Util::GlobalZone::SSHInfo
- Inherits:
-
Struct
- Object
- Struct
- Vagrant::Smartos::Zones::Util::GlobalZone::SSHInfo
- Defined in:
- lib/vagrant/smartos/zones/util/global_zone/ssh_info.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#env ⇒ Object
Returns the value of attribute env.
-
#provider ⇒ Object
Returns the value of attribute provider.
Instance Method Summary collapse
- #forward_agent ⇒ Object
- #forward_x11 ⇒ Object
- #host ⇒ Object
- #password ⇒ Object
- #port ⇒ Object
- #private_key_paths ⇒ Object
- #proxy_command ⇒ Object
-
#to_hash ⇒ Object
rubocop:disable Metrics/MethodLength.
- #username ⇒ Object
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config
6 7 8 |
# File 'lib/vagrant/smartos/zones/util/global_zone/ssh_info.rb', line 6 def config @config end |
#env ⇒ Object
Returns the value of attribute env
6 7 8 |
# File 'lib/vagrant/smartos/zones/util/global_zone/ssh_info.rb', line 6 def env @env end |
#provider ⇒ Object
Returns the value of attribute provider
6 7 8 |
# File 'lib/vagrant/smartos/zones/util/global_zone/ssh_info.rb', line 6 def provider @provider end |
Instance Method Details
#forward_agent ⇒ Object
7 8 9 |
# File 'lib/vagrant/smartos/zones/util/global_zone/ssh_info.rb', line 7 def forward_agent config.ssh.forward_agent end |
#forward_x11 ⇒ Object
11 12 13 |
# File 'lib/vagrant/smartos/zones/util/global_zone/ssh_info.rb', line 11 def forward_x11 config.ssh.forward_x11 end |
#host ⇒ Object
15 16 17 18 19 |
# File 'lib/vagrant/smartos/zones/util/global_zone/ssh_info.rb', line 15 def host return config.ssh.host if config.ssh.host return ssh_info[:host] if ssh_info[:host] config.ssh.default.host end |
#password ⇒ Object
21 22 23 |
# File 'lib/vagrant/smartos/zones/util/global_zone/ssh_info.rb', line 21 def password config.ssh.password end |
#port ⇒ Object
25 26 27 |
# File 'lib/vagrant/smartos/zones/util/global_zone/ssh_info.rb', line 25 def port port_forward[2] end |
#private_key_paths ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/vagrant/smartos/zones/util/global_zone/ssh_info.rb', line 29 def private_key_paths return [] if password @paths ||= [].tap do |paths| paths << config.ssh.private_key_path paths << config.ssh.default.private_key_path paths << env.default_private_key_path end.compact.map do |path| File.(path, env.root_path) end end |
#proxy_command ⇒ Object
41 42 43 |
# File 'lib/vagrant/smartos/zones/util/global_zone/ssh_info.rb', line 41 def proxy_command config.ssh.proxy_command if config.ssh.proxy_command end |
#to_hash ⇒ Object
rubocop:disable Metrics/MethodLength
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/vagrant/smartos/zones/util/global_zone/ssh_info.rb', line 52 def to_hash # From machine#ssh_info, if provider ssh_info is nil, # machine is not ready for SSH. return nil if ssh_info.nil? { host: host, port: port, private_key_path: private_key_paths, username: username, password: password, proxy_command: proxy_command, forward_agent: forward_agent, forward_x11: forward_x11 }.delete_if { |_k, v| v.nil? } end |
#username ⇒ Object
45 46 47 48 49 |
# File 'lib/vagrant/smartos/zones/util/global_zone/ssh_info.rb', line 45 def username return config.ssh.password if config.ssh.password return ssh_info[:username] if ssh_info[:username] config.ssh.default.username end |