Class: VagrantPlugins::Skytap::Command::PublishUrl::Show

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/vagrant-skytap/command/publish_url/show.rb

Instance Method Summary collapse

Methods included from Helpers

#fetch_environment, #machine_names, #target_skytap_vms, #target_vms

Instance Method Details

#executeObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/vagrant-skytap/command/publish_url/show.rb', line 32

def execute
  if publish_sets = fetch_environment.publish_sets.presence
    results = publish_sets.collect do |ps|
      "#{ps.desktops_url || 'n/a'}\n" \
        "  VMs: #{machine_names(ps.vm_ids).join(', ').presence || '(none)'}" \
        "  Password protected? #{ps.password_protected? ? 'yes' : 'no'}"
    end
    @env.ui.info(I18n.t("vagrant_skytap.commands.publish_urls.list", publish_urls: results.join("\n")))
  else
    @env.ui.info(I18n.t("vagrant_skytap.commands.publish_urls.empty_list"))
  end

  # Success, exit status 0
  0
end