Class: VagrantPlugins::CommandLogs::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-logs/command.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.synopsisObject



7
8
9
# File 'lib/vagrant-logs/command.rb', line 7

def self.synopsis
  'Print some log and information (and upload them to a Gist)'
end

Instance Method Details

#executeObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/vagrant-logs/command.rb', line 11

def execute
  result = {}

  with_target_vms(@argv, single_target: true) do |vm|
    prepare_log_file_names(vm)
    result[:log_files] = fetch_log_files(vm)

    result[:repository_revisions] = fetch_repository_revisions(vm)
    result[:client_versions] = fetch_client_versions(vm)
    result[:dns_resolution] = fetch_dns_resolution_check(vm)
  end

  result_as_string = result_to_string(result)

  print result_as_string

  if ENV['GIST_UPLOAD']
    upload_to_gist(result_as_string, ENV['GITHUB_TOKEN'])
  end

  return 0
end