cloudstack_stats 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 79b0167d9ff79e2411a694d656ccd81de2a37477
4
- data.tar.gz: ea10cbbd9fa853cf09cb1e71aa536033b6a38ba0
3
+ metadata.gz: 7380aa220221f5e9a48daf2cea757561481f372c
4
+ data.tar.gz: 67786231341e6bff18d840abe738f664f8c132de
5
5
  SHA512:
6
- metadata.gz: d349cff75e1884868ef1774109086639434744927fa40421f4ac3ff7c8e54f9b79ffea51d364aac13ef11efee3e42b9c19ad4039a7da38143043fc4e9a7a9fcb
7
- data.tar.gz: d8211dc532a5adaa6fe1a9e9666c07b589fefbf7ac9326b6e522e5049aa0dd3f81104a9834e0d165f2d96d18763844208a30db6bfdff4b095583e6ee3f402762
6
+ metadata.gz: b4afdda6535f18a6ca74ddc0dd3360ca21bba27a7337f009db019fef8f459cebb44bcd2a54216c43e6474fd8e974b3c9a550cfbb0a64fef3595593aff7ae0bc4
7
+ data.tar.gz: 50211c52ca720920542433c8922f6309b44c2002dbda3b98fa99c8e790ed1c733cb3ddf134aea688d6726f5b98bfb743a744d4122802d7a4e6ac3082199b53ae
@@ -9,7 +9,20 @@ module CloudstackStats
9
9
 
10
10
  package_name "cloudstack_stats"
11
11
 
12
- class_option :config_file,
12
+ class_option :cloudstack_url,
13
+ default: "http://localhost:8080/client",
14
+ aliases: '-A',
15
+ desc: 'CloudStack API URL'
16
+
17
+ class_option :cloudstack_api_key,
18
+ aliases: '-k',
19
+ desc: 'CloudStack API Key'
20
+
21
+ class_option :cloudstack_api_secret,
22
+ aliases: '-s',
23
+ desc: 'CloudStack API Secret'
24
+
25
+ class_option :cloudstack_config,
13
26
  default: File.join(Dir.home, '.cloudstack-cli.yml'),
14
27
  aliases: '-C',
15
28
  desc: 'Location of your cloudstack-cli configuration file'
@@ -84,9 +97,9 @@ module CloudstackStats
84
97
  stats = Collect.new(options).account_stats
85
98
  say "Write stats to influxdb...", :yellow
86
99
  Feed.new(options).write(stats) {|stat, res| print_status(stat, res)}
87
- rescue => e
88
- say "ERROR: ", :red
89
- puts e.message
100
+ # rescue => e
101
+ # say "ERROR: ", :red
102
+ # puts e.message
90
103
  end
91
104
 
92
105
  no_commands do
@@ -7,7 +7,18 @@ module CloudstackStats
7
7
 
8
8
  def initialize(settings)
9
9
  @settings = settings.dup
10
- @config ||= CloudstackClient::Configuration.load(@settings)
10
+ @config = if @settings[:cloudstack_url] &&
11
+ @settings[:cloudstack_api_key] &&
12
+ @settings[:cloudstack_secret_key]
13
+ {
14
+ url: @settings[:cloudstack_url],
15
+ api_key: @settings[:cloudstack_api_key],
16
+ secret_key: @settings[:cloudstack_secret_key]
17
+ }
18
+ else
19
+ @settings[:config_file] = @settings[:cloudstack_config]
20
+ CloudstackClient::Configuration.load(@settings)
21
+ end
11
22
  @cs ||= CloudstackClient::Client.new(
12
23
  @config[:url],
13
24
  @config[:api_key],
@@ -1,3 +1,3 @@
1
1
  module CloudstackStats
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudstack_stats
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - niwo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-09 00:00:00.000000000 Z
11
+ date: 2017-05-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler