Class: CloudstackStats::Cli

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/cloudstack_stats/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

exit with return code 1 in case of a error

Returns:

  • (Boolean)


67
68
69
# File 'lib/cloudstack_stats/cli.rb', line 67

def self.exit_on_failure?
  true
end

Instance Method Details

#accountsObject



95
96
97
98
99
100
101
102
103
# File 'lib/cloudstack_stats/cli.rb', line 95

def accounts
  say "Collect stats...", :yellow
  stats = Collect.new(options).
  say "Write stats to influxdb...", :yellow
  Feed.new(options).write(stats) {|stat, res| print_status(stat, res)}
# rescue => e
#   say "ERROR: ", :red
#   puts e.message
end

#projectsObject



81
82
83
84
85
86
87
88
89
# File 'lib/cloudstack_stats/cli.rb', line 81

def projects
  say "Collect stats...", :yellow
  stats = Collect.new(options).project_stats
  say "Write stats to influxdb...", :yellow
  Feed.new(options).write(stats) {|stat, res| print_status(stat, res)}
rescue => e
  say "ERROR: ", :red
  puts e.message
end

#versionObject



72
73
74
# File 'lib/cloudstack_stats/cli.rb', line 72

def version
  say "cloudstack_stats v#{CloudstackStats::VERSION}"
end