joyent-cloud-pricing 1.0.7 → 1.0.8

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: 6830b1d71aec26c98b251688edacd2a40448eac1
4
- data.tar.gz: bfdeb0a822f1f8f6b15122402c4dbc491a061349
3
+ metadata.gz: aac73146144562c99dbb072fc766712d3793029d
4
+ data.tar.gz: ff9efc1f136467be58322a9ce8335ae1b5c81f88
5
5
  SHA512:
6
- metadata.gz: 8c8bf089f0fe1f5e7361061ab4dcad2bc10845f64b2bdd92c40a20391910b59bdb8cc47540a5318eb9b656a0aef4552230c04bab1a6c8af5db9a3b40da0be958
7
- data.tar.gz: cca584aaaecb758178cf1212a04400e1e8856a1c7c81b04a6b4e7ee6d6910ee137b2cc28da2f9d6e4f638e89fc6fc3f9242d67a4bb7e08a01f841236776267a8
6
+ metadata.gz: 0835ae276c4a763e3534662c5adfafc79ad3139fe5b77606e095eb87e28029fef851d5e5a852707ca450dd3838cd9722ed448fcedc100d551c03a07143f10205
7
+ data.tar.gz: 3fbb855a0a63c05a872320e557e944b48c2f55c3c035a008b2ce2abcde463607d19473c0100b13c9a3f7365ba136906c6568d560c29b86e35e7f36d215ed3e8a
@@ -35,6 +35,10 @@ module Joyent::Cloud::Pricing
35
35
  unknown_zone_counts.size > 0
36
36
  end
37
37
 
38
+ def have_over_reserved_zones?
39
+ over_reserved_zone_counts.size > 0
40
+ end
41
+
38
42
  # Non-discounted full price
39
43
  def monthly_full_price
40
44
  monthly_full_price_for(zone_counts)
@@ -65,6 +65,18 @@ module Joyent::Cloud::Pricing
65
65
  end
66
66
  end
67
67
 
68
+ def unknown_flavor_zone_list
69
+ analyzer.unknown_zone_counts.keys
70
+ end
71
+
72
+ def over_reserved_zone_list
73
+ analyzer.over_reserved_zone_counts.keys
74
+ end
75
+
76
+ def zone_list_for_print(list, format = ' %-40s')
77
+ list.map{|k| sprintf(format, k) }.join("\n")
78
+ end
79
+
68
80
  SEPARATOR = ('.' * 65).cyan
69
81
  PROPS_FORMAT= '%20d %20d %20d'
70
82
  REPORT_ASCII = <<ASCII
@@ -74,7 +86,8 @@ module Joyent::Cloud::Pricing
74
86
  were excluded from calculations. Add them to legacy_prices.yml.
75
87
 
76
88
  List of flavors with unknown properties:
77
- <%= @r.analyzer.unknown_zone_counts.keys.map{|k| sprintf(" %20s", k) }.join("\n").red %>
89
+ Total # of unrecognized flavor zones <%= sprintf("%20d", @r.analyzer.unknown_zone_counts.keys.size).red %>
90
+ <%= @r.zone_list_for_print(@r.unknown_flavor_zone_list).red %>
78
91
  <%= SEPARATOR %>
79
92
 
80
93
  <%- end -%>
@@ -82,8 +95,12 @@ ZONE COUNTS:
82
95
  Total # of zones <%= sprintf("%20d", @r.zones).cyan %>
83
96
  <%- if @r.reserve? -%>
84
97
  Total # of reserved zones <%= sprintf("%20d", @r.commit.total_zones).green %>
98
+ <%- if @r.analyzer.have_over_reserved_zones? -%>
85
99
  Total # of reserved but absent zones <%= value = sprintf("%20d", @r.analyzer.over_reserved_zone_counts.size || 0); value == "0" ? value.blue : value.red %>
100
+ <%= @r.zone_list_for_print(@r.over_reserved_zone_list).red %>
86
101
  <%- end -%>
102
+ <%- end -%>
103
+ <%= SEPARATOR %>
87
104
 
88
105
  Resources in use:<%= sprintf('%14s %15s %15s', 'Reserved', 'On-Demand', 'Total') %>
89
106
  CPUs <%= props = @r.zone_props_to_string(:cpus, 16); props[0].green + props[1].yellow + props[2].cyan %>
@@ -1,7 +1,7 @@
1
1
  module Joyent
2
2
  module Cloud
3
3
  module Pricing
4
- VERSION = '1.0.7'
4
+ VERSION = '1.0.8'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: joyent-cloud-pricing
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Gredeskoul