wavefront-cli 7.2.0 → 8.3.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
  SHA256:
3
- metadata.gz: 65a2455065fbd4b69b42718f7789e4c01cb5245a0015ea7d2977b96581ad0b83
4
- data.tar.gz: 2c01e8464589c804271a97dba24a19a62b3f4a1dba9af588216f1d0b911c9ec9
3
+ metadata.gz: 9644fb069398c411a71981a9c8953090b235729dbb8d36c707132f852c07b36b
4
+ data.tar.gz: 59c0be42ac3e36bf966297488fae255ea290633098d8f38f67cc5282c4adea64
5
5
  SHA512:
6
- metadata.gz: 392ea65a15b94665c5255da837abcaf3a8b69d38db9b675652c5c824627b3436b4b802174283bcdda6d2f95150cb3fce0a21de2dfcb449c64a0a73259d16357b
7
- data.tar.gz: f55ffa3998170ee1a3d98f55cdefa9cd27d2f84e39f3c2fcbe3ffb649bcb34eeb96e93e1a486f4edfa030244e4640e3777865eef6f6119380dec7ff273637041
6
+ metadata.gz: 39e7fd3766761b4b3ce4358fc7355d0b916b55da77db9e06955d5d988cd0cd5e3792b853c8c3726f39840cf5ab6020a26afc29b31561642fe90f4c9795cdca6e
7
+ data.tar.gz: b3d7989e22c02c88593c6ba2630f335978d8a4506cb535eec54ac08776081ddfeab273fe3ae760d77e77b3c82291a943a207a5deb46f3d1f81ed5fea8e36329a
@@ -1,49 +1,18 @@
1
1
  ---
2
2
 
3
3
  AllCops:
4
- TargetRubyVersion: 2.4
4
+ TargetRubyVersion: 2.5
5
+ NewCops: enable
5
6
 
6
7
  Metrics/ClassLength:
7
8
  Max: 400
8
9
 
9
10
  Style/IfUnlessModifier:
10
11
  Enabled: false # because it wants to make lines >80 chars
11
- Style/HashEachMethods:
12
- Enabled: true
13
- Style/HashTransformKeys:
14
- Enabled: true
15
- Style/HashTransformValues:
16
- Enabled: true
17
-
18
- # New compatabilities
19
- Layout/EmptyLinesAroundAttributeAccessor:
20
- Enabled: true
21
- Layout/SpaceAroundMethodCallOperator:
22
- Enabled: true
23
- Lint/RaiseException:
24
- Enabled: true
25
- Lint/StructNewOverride:
26
- Enabled: true
27
- Style/ExponentialNotation:
28
- Enabled: true
29
- Style/SlicingWithRange:
30
- Enabled: true
31
- Lint/DeprecatedOpenSSLConstant:
32
- Enabled: true
33
- Lint/MixedRegexpCaptureTypes:
34
- Enabled: true
35
- Style/RedundantRegexpCharacterClass:
36
- Enabled: true
37
- Style/RedundantRegexpEscape:
38
- Enabled: true
39
- Style/AccessorGrouping:
40
- Enabled: true
41
- Style/BisectedAttrAccessor:
42
- Enabled: true
43
- Style/RedundantAssignment:
44
- Enabled: true
45
- Style/RedundantFetchBlock:
46
- Enabled: true
12
+ Style/StringConcatenation:
13
+ Enabled: false
14
+ Style/OptionalBooleanParameter:
15
+ Enabled: false
47
16
 
48
17
  # Is nothing sacred?
49
18
  Layout/LineLength:
@@ -1,10 +1,9 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
  rvm:
4
- - 2.4.9
5
- - 2.5.7
6
- - 2.6.5
7
- - 2.7.0
4
+ - 2.5.8
5
+ - 2.6.6
6
+ - 2.7.1
8
7
  before_install: gem install bundler --no-document
9
8
  deploy:
10
9
  provider: rubygems
@@ -14,7 +13,7 @@ deploy:
14
13
  on:
15
14
  tags: true
16
15
  repo: snltd/wavefront-cli
17
- ruby: 2.6.5
16
+ ruby: 2.6.6
18
17
  notifications:
19
18
  email: false
20
19
  slack:
data/HISTORY.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 8.3.0 (2020-10-31)
4
+ * Add `wf proxy shutdown` command.
5
+
6
+ ## 8.2.0 (2020-10-06)
7
+ * Display spans in human-readable query output.
8
+
9
+ ## 8.1.0 (2020-10-04)
10
+ * Display traces in human-readable query output.
11
+
12
+ ## 8.0.1 (2020-09-28)
13
+ * If the user specifies a config stanza and it is not found, exit with an
14
+ error rather than silently falling back to env vars.
15
+
16
+ ## 8.0.0 (2020-09-20
17
+ * Drop Ruby 2.4.0 support. (Breaking change.)
18
+ >>>>>>> master
19
+
3
20
  ## 7.2.0 (2020-08-12)
4
21
  * Add `cloudintegration awsid generate` command.
5
22
  * Add `cloudintegration awsid delete <external_id>` command.
data/README.md CHANGED
@@ -15,7 +15,7 @@ $ gem install wavefront-cli
15
15
 
16
16
  It is built on [our Wavefront Ruby
17
17
  SDK](https://github.com/snltd/wavefront-sdk) and requires Ruby >=
18
- 2.4. It has no "native extension" dependencies.
18
+ 2.5. It has no "native extension" dependencies.
19
19
 
20
20
  For a far more comprehensive overview/tutorial, please read [this
21
21
  article](https://sysdef.xyz/article/wavefront-cli).
@@ -102,12 +102,10 @@ module WavefrontCli
102
102
 
103
103
  def validate_tags(key = :'<tag>')
104
104
  Array(options[key]).each do |t|
105
- begin
106
- send(:wf_tag?, t)
107
- rescue Wavefront::Exception::InvalidTag
108
- raise(WavefrontCli::Exception::InvalidInput,
109
- "'#{t}' is not a valid tag.")
110
- end
105
+ send(:wf_tag?, t)
106
+ rescue Wavefront::Exception::InvalidTag
107
+ raise(WavefrontCli::Exception::InvalidInput,
108
+ "'#{t}' is not a valid tag.")
111
109
  end
112
110
  end
113
111
 
@@ -371,9 +369,10 @@ module WavefrontCli
371
369
  def do_dump
372
370
  cannot_noop!
373
371
 
374
- if options[:format] == 'yaml'
372
+ case options[:format]
373
+ when 'yaml'
375
374
  ok_exit dump_yaml
376
- elsif options[:format] == 'json'
375
+ when 'json'
377
376
  ok_exit dump_json
378
377
  else
379
378
  abort format("Dump format must be 'json' or 'yaml'. " \
@@ -539,7 +538,8 @@ module WavefrontCli
539
538
  #
540
539
  # rubocop:disable Metrics/MethodLength
541
540
  def extract_values(obj, key, aggr = [])
542
- if obj.is_a?(Hash)
541
+ case obj.class
542
+ when Hash
543
543
  obj.each_pair do |k, v|
544
544
  if k == key && !v.to_s.empty?
545
545
  aggr.<< v
@@ -547,7 +547,7 @@ module WavefrontCli
547
547
  extract_values(v, key, aggr)
548
548
  end
549
549
  end
550
- elsif obj.is_a?(Array)
550
+ when Array
551
551
  obj.each { |e| extract_values(e, key, aggr) }
552
552
  end
553
553
 
@@ -1,47 +1,19 @@
1
1
  ---
2
+ AllCops:
3
+ NewCops: enable
2
4
 
3
5
  # There are long things in here, but they're fine
4
6
  #
5
7
  Metrics/MethodLength:
6
8
  Max: 25
7
9
 
8
- Style/HashEachMethods:
9
- Enabled: true
10
- Style/HashTransformKeys:
11
- Enabled: true
12
- Style/HashTransformValues:
13
- Enabled: true
14
-
15
- # new compatabilities
16
- Layout/EmptyLinesAroundAttributeAccessor:
17
- Enabled: true
18
- Layout/SpaceAroundMethodCallOperator:
19
- Enabled: true
20
- Lint/RaiseException:
21
- Enabled: true
22
- Lint/StructNewOverride:
23
- Enabled: true
24
- Style/ExponentialNotation:
25
- Enabled: true
26
- Style/SlicingWithRange:
27
- Enabled: true
28
- Lint/DeprecatedOpenSSLConstant:
29
- Enabled: true
30
- Lint/MixedRegexpCaptureTypes:
31
- Enabled: true
32
- Style/RedundantRegexpCharacterClass:
33
- Enabled: true
34
- Style/RedundantRegexpEscape:
35
- Enabled: true
36
- Style/AccessorGrouping:
37
- Enabled: true
38
- Style/BisectedAttrAccessor:
39
- Enabled: true
40
- Style/RedundantAssignment:
41
- Enabled: true
42
- Style/RedundantFetchBlock:
43
- Enabled: true
44
-
45
10
  # Is nothing sacred?
46
11
  Layout/LineLength:
47
12
  Max: 80
13
+
14
+ Style/IfUnlessModifier:
15
+ Enabled: false # because it wants to make lines >80 chars
16
+ Style/StringConcatenation:
17
+ Enabled: false
18
+ Style/OptionalBooleanParameter:
19
+ Enabled: false
@@ -16,6 +16,7 @@ class WavefrontCommandProxy < WavefrontCommandBase
16
16
  "undelete #{CMN} <id>",
17
17
  "rename #{CMN} <id> <name>",
18
18
  "search #{CMN} [-al] [-o offset] [-L limit] [-O fields] <condition>...",
19
+ "shutdown #{CMN} <id>",
19
20
  "versions #{CMN}"]
20
21
  end
21
22
 
@@ -36,11 +36,13 @@ module WavefrontCli
36
36
 
37
37
  RX = /^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/.freeze
38
38
 
39
+ # rubocop:disable Lint/MissingSuper
39
40
  def initialize(options)
40
41
  @options = options
41
42
  @config_file = _config_file
42
43
  @profile = options[:'<profile>'] || 'default'
43
44
  end
45
+ # rubocop:enable Lint/MissingSuper
44
46
 
45
47
  def do_location
46
48
  puts config_file
@@ -144,7 +146,7 @@ module WavefrontCli
144
146
  # catch a ctrl-d
145
147
  #
146
148
  def read_input
147
- STDIN.gets.strip
149
+ $stdin.gets.strip
148
150
  rescue NoMethodError
149
151
  abort "\nInput aborted at user request."
150
152
  end
@@ -177,8 +177,6 @@ class WavefrontCliController
177
177
  # return [Hash] h with modified keys
178
178
  #
179
179
  def sanitize_keys(options)
180
- options.each_with_object({}) do |(k, v), r|
181
- r[k.to_s.delete('-').to_sym] = v
182
- end
180
+ options.transform_keys { |k| k.to_s.delete('-').to_sym }
183
181
  end
184
182
  end
@@ -33,6 +33,7 @@ module WavefrontDisplay
33
33
 
34
34
  @data = prioritize_keys(data, priority_keys)
35
35
  @options = options
36
+ @printer_opts = {}
36
37
  end
37
38
 
38
39
  # find the correct method to deal with the output of the user's
@@ -152,7 +153,8 @@ module WavefrontDisplay
152
153
  puts 'No data.'
153
154
  else
154
155
  require_relative 'printer/long'
155
- puts WavefrontDisplayPrinter::Long.new(data, fields, modified_data)
156
+ puts WavefrontDisplayPrinter::Long.new(data, fields, modified_data,
157
+ @printer_opts)
156
158
  pagination_line
157
159
  end
158
160
  end
@@ -29,11 +29,13 @@ module WavefrontDisplayPrinter
29
29
 
30
30
  # Default options. Can all be overridden by passing them in the
31
31
  # initializer options hash.
32
+ # After sep_depth indentations we do not print separator lines
32
33
  #
33
34
  def default_opts
34
35
  { indent: 2,
35
36
  padding: 2,
36
37
  separator: true,
38
+ sep_depth: 3,
37
39
  none: true }
38
40
  end
39
41
 
@@ -75,6 +77,7 @@ module WavefrontDisplayPrinter
75
77
  #
76
78
  # Make an array of hashes: { key, value, depth }
77
79
  #
80
+ # rubocop:disable Style/CaseLikeIf
78
81
  def make_list(data, aggr = [], depth = 0, last_key = nil)
79
82
  if data.is_a?(Hash)
80
83
  append_hash(data, aggr, depth)
@@ -84,6 +87,7 @@ module WavefrontDisplayPrinter
84
87
  aggr.<< ['', preened_value(data), depth]
85
88
  end
86
89
  end
90
+ # rubocop:enable Style/CaseLikeIf
87
91
 
88
92
  def smart_value(val)
89
93
  val.to_s.empty? && opts[:none] ? '<none>' : preened_value(val)
@@ -150,6 +154,7 @@ module WavefrontDisplayPrinter
150
154
  # @param depth [Integer]
151
155
  # @return [Array[Array]]
152
156
  #
157
+ # rubocop:disable Style/CaseLikeIf
153
158
  def append_hash(data, aggr, depth)
154
159
  data.each_pair do |k, v|
155
160
  if v.is_a?(Hash)
@@ -163,6 +168,7 @@ module WavefrontDisplayPrinter
163
168
 
164
169
  aggr
165
170
  end
171
+ # rubocop:enable Style/CaseLikeIf
166
172
 
167
173
  # Part of the #make_list recursion. Deals with arrays.
168
174
  #
@@ -175,7 +181,8 @@ module WavefrontDisplayPrinter
175
181
  data.each.with_index(1) do |element, i|
176
182
  aggr = make_list(element, aggr, depth, last_key)
177
183
 
178
- if opts[:separator] && element.is_a?(Hash) && i < data.size
184
+ if opts[:separator] && element.is_a?(Hash) && i < data.size &&
185
+ depth < opts[:sep_depth]
179
186
  aggr.<< ['', :separator, depth]
180
187
  end
181
188
  end
@@ -26,6 +26,10 @@ module WavefrontDisplay
26
26
  multicolumn(:id, :version, :name)
27
27
  end
28
28
 
29
+ def do_shutdown
30
+ puts "Requested shutdown of proxy '#{options[:'<id>']}'."
31
+ end
32
+
29
33
  private
30
34
 
31
35
  def filter_inactive_proxies!
@@ -16,14 +16,18 @@ module WavefrontDisplay
16
16
  data[:errorMessage].split("\n").first)
17
17
  end
18
18
 
19
+ # rubocop:disable Metrics/AbcSize
19
20
  def default_data_object
20
21
  { name: data.name,
21
22
  query: data.query,
22
23
  timeseries: mk_timeseries(data),
24
+ traces: mk_traces(data),
25
+ spans: mk_spans(data),
23
26
  events: mk_events(data) }.tap do |d|
24
27
  d[:warnings] = data[:warnings] if show_warnings?
25
28
  end
26
29
  end
30
+ # rubocop:enable Metrics/AbcSize
27
31
 
28
32
  def show_warnings?
29
33
  data.key?(:warnings) && !options[:nowarn]
@@ -54,6 +58,18 @@ module WavefrontDisplay
54
58
  data[:events].map { |s| humanize_event(s) }
55
59
  end
56
60
 
61
+ def mk_traces(data)
62
+ return [] unless data.key?(:traces)
63
+
64
+ data[:traces].map { |t| humanize_trace(t) }
65
+ end
66
+
67
+ def mk_spans(data)
68
+ return [] unless data.key?(:spans)
69
+
70
+ data[:spans].map { |t| humanize_span(t) }
71
+ end
72
+
57
73
  def do_run
58
74
  do_default
59
75
  end
@@ -99,6 +115,30 @@ module WavefrontDisplay
99
115
  end
100
116
  end
101
117
 
118
+ def humanize_trace(data)
119
+ @printer_opts[:sep_depth] = 3
120
+
121
+ data.tap do |t|
122
+ t[:start] = human_time(t[:start_ms])
123
+ t[:end] = human_time(t[:end_ms])
124
+ t.delete(:start_ms)
125
+ t.delete(:end_ms)
126
+ t.delete(:startMs)
127
+ t.spans = t.spans.map { |s| humanize_trace_span(s) }
128
+ end
129
+ end
130
+
131
+ def humanize_span(data)
132
+ @printer_opts[:sep_depth] = 2
133
+ data
134
+ end
135
+
136
+ def humanize_trace_span(span)
137
+ span.tap do |s|
138
+ s[:startMs] = human_time(s[:startMs])
139
+ end
140
+ end
141
+
102
142
  def row_time_and_val(row)
103
143
  if row.is_a?(Hash)
104
144
  [human_time(row[:timestamp]), row[:value]]
@@ -97,6 +97,7 @@ module WavefrontCli
97
97
  # return [Hash] body for #create() method
98
98
  #
99
99
  # rubocop:disable Metrics/MethodLength
100
+ # rubocop:disable Metrics/AbcSize
100
101
  def create_body(opts, t_start)
101
102
  { name: opts[:'<event>'],
102
103
  startTime: t_start,
@@ -111,6 +112,7 @@ module WavefrontCli
111
112
  end
112
113
  end
113
114
  end
115
+ # rubocop:enable Metrics/AbcSize
114
116
  # rubocop:enable Metrics/MethodLength
115
117
 
116
118
  def annotations(opts)
@@ -8,7 +8,6 @@ module WavefrontCli
8
8
  # rubocop:disable Metrics/MethodLength
9
9
  # rubocop:disable Metrics/AbcSize
10
10
  # rubocop:disable Metrics/CyclomaticComplexity
11
- # rubocop:disable Metrics/PerceivedComplexity
12
11
  def exception_handler(exception)
13
12
  case exception
14
13
  when WavefrontCli::Exception::UnhandledCommand
@@ -83,7 +82,6 @@ module WavefrontCli
83
82
  end
84
83
  # rubocop:enable Metrics/MethodLength
85
84
  # rubocop:enable Metrics/AbcSize
86
- # rubocop:enable Metrics/PerceivedComplexity
87
85
  # rubocop:enable Metrics/CyclomaticComplexity
88
86
  end
89
87
  end
@@ -38,12 +38,10 @@ module WavefrontCli
38
38
 
39
39
  def point_filter_regexes
40
40
  ret = options[:pointregex].each_with_object({}) do |r, a|
41
- begin
42
- k, v = r.split('=', 2)
43
- a[k.to_sym] = v
44
- rescue StandardError
45
- puts "cannot parse point regex '#{r}'. Skipping."
46
- end
41
+ k, v = r.split('=', 2)
42
+ a[k.to_sym] = v
43
+ rescue StandardError
44
+ puts "cannot parse point regex '#{r}'. Skipping."
47
45
  end
48
46
 
49
47
  ret.empty? ? nil : ret
@@ -57,7 +57,7 @@ module WavefrontCli
57
57
  # does not parse
58
58
  #
59
59
  def load_from_stdin
60
- raw = STDIN.read
60
+ raw = $stdin.read
61
61
 
62
62
  if raw.start_with?('---')
63
63
  read_yaml(raw)
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'pathname'
4
4
  require 'wavefront-sdk/credentials'
5
- require_relative 'constants.rb'
5
+ require_relative 'constants'
6
6
 
7
7
  module WavefrontCli
8
8
  #
@@ -35,6 +35,8 @@ module WavefrontCli
35
35
  abort "Configuration file '#{e}' not found."
36
36
  rescue Wavefront::Exception::InvalidConfigFile => e
37
37
  abort "Could not load configuration file '#{e.message}'."
38
+ rescue Wavefront::Exception::MissingConfigProfile => e
39
+ abort "Cannot find profile '#{e}'."
38
40
  end
39
41
 
40
42
  # Create an options hash to pass to the Wavefront::Credentials
@@ -45,7 +47,7 @@ module WavefrontCli
45
47
  # :profile
46
48
  #
47
49
  def setup_cred_opts(cli_opts)
48
- cred_opts = {}
50
+ cred_opts = { raise_on_no_profile: true }
49
51
 
50
52
  if cli_opts[:config]
51
53
  cred_opts[:file] = Pathname.new(cli_opts[:config])
@@ -69,7 +71,7 @@ module WavefrontCli
69
71
  #
70
72
  def load_profile(cred_opts)
71
73
  creds = Wavefront::Credentials.new(cred_opts).config
72
- Hash[creds.map { |k, v| [k.to_sym, v] }]
74
+ creds.transform_keys(&:to_sym)
73
75
  end
74
76
  end
75
77
  end
@@ -32,6 +32,10 @@ module WavefrontCli
32
32
  version_info(raw).sort_by { |p| Gem::Version.new(p[:version]) }.reverse
33
33
  end
34
34
 
35
+ def do_shutdown
36
+ wf.shutdown(options[:'<id>'])
37
+ end
38
+
35
39
  def version_info(raw)
36
40
  raw.response.items.map do |i|
37
41
  { id: i.id, version: i.version, name: i.name }
@@ -1,3 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- WF_CLI_VERSION = '7.2.0'
3
+ WF_CLI_VERSION = '8.3.0'
@@ -167,12 +167,10 @@ module WavefrontCli
167
167
  #
168
168
  def process_input_file(data)
169
169
  data.each_with_object([]) do |l, a|
170
- begin
171
- a.<< process_line(l)
172
- rescue WavefrontCli::Exception::UnparseableInput => e
173
- puts "Bad input. #{e.message}."
174
- next
175
- end
170
+ a.<< process_line(l)
171
+ rescue WavefrontCli::Exception::UnparseableInput => e
172
+ puts "Bad input. #{e.message}."
173
+ next
176
174
  end
177
175
  end
178
176
 
@@ -193,7 +191,7 @@ module WavefrontCli
193
191
  #
194
192
  def read_stdin
195
193
  open_connection
196
- STDIN.each_line { |l| call_write(process_line(l.strip), false) }
194
+ $stdin.each_line { |l| call_write(process_line(l.strip), false) }
197
195
  close_connection
198
196
  rescue SystemExit, Interrupt
199
197
  puts 'ctrl-c. Exiting.'
@@ -1,4 +1,7 @@
1
1
  ---
2
+ AllCops:
3
+ NewCops: enable
4
+
2
5
  Metrics/MethodLength:
3
6
  Max: 30
4
7
 
@@ -8,43 +11,13 @@ Metrics/AbcSize:
8
11
  Metrics/ClassLength:
9
12
  Max: 300
10
13
 
11
- Style/HashEachMethods:
12
- Enabled: true
13
- Style/HashTransformKeys:
14
- Enabled: true
15
- Style/HashTransformValues:
16
- Enabled: true
17
-
18
- # new compatabilities
19
- Layout/EmptyLinesAroundAttributeAccessor:
20
- Enabled: true
21
- Layout/SpaceAroundMethodCallOperator:
22
- Enabled: true
23
- Lint/RaiseException:
24
- Enabled: true
25
- Lint/StructNewOverride:
26
- Enabled: true
27
- Style/ExponentialNotation:
28
- Enabled: true
29
- Style/SlicingWithRange:
30
- Enabled: true
31
- Lint/DeprecatedOpenSSLConstant:
32
- Enabled: true
33
- Lint/MixedRegexpCaptureTypes:
34
- Enabled: true
35
- Style/RedundantRegexpCharacterClass:
36
- Enabled: true
37
- Style/RedundantRegexpEscape:
38
- Enabled: true
39
- Style/AccessorGrouping:
40
- Enabled: true
41
- Style/BisectedAttrAccessor:
42
- Enabled: true
43
- Style/RedundantAssignment:
44
- Enabled: true
45
- Style/RedundantFetchBlock:
46
- Enabled: true
47
-
48
14
  # Is nothing sacred?
49
15
  Layout/LineLength:
50
16
  Max: 80
17
+
18
+ Style/IfUnlessModifier:
19
+ Enabled: false # because it wants to make lines >80 chars
20
+ Style/StringConcatenation:
21
+ Enabled: false
22
+ Style/OptionalBooleanParameter:
23
+ Enabled: false
@@ -105,11 +105,9 @@ module Minitest
105
105
  "performed as no-ops.\n", err)
106
106
  end
107
107
 
108
- def assert_repeated_output(msg)
108
+ def assert_repeated_output(msg, &block)
109
109
  begin
110
- out, err = capture_io do
111
- yield
112
- end
110
+ out, err = capture_io(&block)
113
111
  rescue SystemExit => e
114
112
  puts e.backtrace
115
113
  p e
@@ -48,7 +48,7 @@ class WavefrontCliConfigTest < MiniTest::Test
48
48
 
49
49
  def test_read_input
50
50
  ["value \n", " value\n", " value \t\n", "value\n"].each do |v|
51
- STDIN.stub(:gets, v) { assert_equal('value', wf.read_input) }
51
+ $stdin.stub(:gets, v) { assert_equal('value', wf.read_input) }
52
52
  end
53
53
  end
54
54
 
@@ -79,9 +79,11 @@ end
79
79
  # so we can get at the methods without triggering one of the things
80
80
  # tested above.
81
81
  #
82
+ # rubocop:disable Lint/MissingSuper
82
83
  class Giblets < WavefrontCliController
83
84
  def initialize; end
84
85
  end
86
+ # rubocop:enable Lint/MissingSuper
85
87
 
86
88
  # Here's the subclass
87
89
  #
@@ -52,12 +52,14 @@ class TestWavefrontDisplayPrinterLong < MiniTest::Test
52
52
  assert_equal({ indent: 4,
53
53
  padding: 3,
54
54
  separator: true,
55
+ sep_depth: 3,
55
56
  none: true }, pr.opts)
56
57
 
57
58
  pr = WavefrontDisplayPrinter::Long.new({}, nil, nil, none: false)
58
59
  assert_equal({ indent: 2,
59
60
  padding: 2,
60
61
  separator: true,
62
+ sep_depth: 3,
61
63
  none: false }, pr.opts)
62
64
  end
63
65
 
@@ -36,6 +36,19 @@ class ProxyEndToEndTest < EndToEndTest
36
36
  assert_abort_on_missing_creds("rename #{id} newname")
37
37
  end
38
38
 
39
+ def test_shutdown
40
+ assert_output("Requested shutdown of proxy '#{id}'.\n") do
41
+ assert_cmd_puts("shutdown #{id}", "/api/v2/proxy/#{id}",
42
+ { shutdown: true }.to_json)
43
+ end
44
+
45
+ assert_noop("shutdown #{id}",
46
+ "uri: PUT https://default.wavefront.com/api/v2/proxy/#{id}",
47
+ 'body: {"shutdown":true}')
48
+ assert_invalid_id("shutdown #{invalid_id}")
49
+ assert_abort_on_missing_creds("shutdown #{id}")
50
+ end
51
+
39
52
  private
40
53
 
41
54
  def id
@@ -26,14 +26,14 @@ Gem::Specification.new do |gem|
26
26
 
27
27
  gem.add_runtime_dependency 'docopt', '~> 0.6.0'
28
28
  gem.add_runtime_dependency 'inifile', '~> 3.0'
29
- gem.add_runtime_dependency 'wavefront-sdk', '~> 5.1'
29
+ gem.add_runtime_dependency 'wavefront-sdk', '~> 5.3'
30
30
 
31
- gem.add_development_dependency 'minitest', '~> 5.11', '>= 5.11.0'
31
+ gem.add_development_dependency 'minitest', '~> 5.14'
32
32
  gem.add_development_dependency 'rake', '~> 13.0'
33
- gem.add_development_dependency 'rubocop', '0.87.1'
33
+ gem.add_development_dependency 'rubocop', '0.91.0'
34
34
  gem.add_development_dependency 'spy', '~> 1.0.0'
35
- gem.add_development_dependency 'webmock', '~> 3.7'
35
+ gem.add_development_dependency 'webmock', '~> 3.8'
36
36
  gem.add_development_dependency 'yard', '~> 0.9.5'
37
37
 
38
- gem.required_ruby_version = Gem::Requirement.new('>= 2.4.0')
38
+ gem.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
39
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wavefront-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.2.0
4
+ version: 8.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Fisher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-12 00:00:00.000000000 Z
11
+ date: 2020-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt
@@ -44,34 +44,28 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '5.1'
47
+ version: '5.3'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '5.1'
54
+ version: '5.3'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: 5.11.0
62
59
  - - "~>"
63
60
  - !ruby/object:Gem::Version
64
- version: '5.11'
61
+ version: '5.14'
65
62
  type: :development
66
63
  prerelease: false
67
64
  version_requirements: !ruby/object:Gem::Requirement
68
65
  requirements:
69
- - - ">="
70
- - !ruby/object:Gem::Version
71
- version: 5.11.0
72
66
  - - "~>"
73
67
  - !ruby/object:Gem::Version
74
- version: '5.11'
68
+ version: '5.14'
75
69
  - !ruby/object:Gem::Dependency
76
70
  name: rake
77
71
  requirement: !ruby/object:Gem::Requirement
@@ -92,14 +86,14 @@ dependencies:
92
86
  requirements:
93
87
  - - '='
94
88
  - !ruby/object:Gem::Version
95
- version: 0.87.1
89
+ version: 0.91.0
96
90
  type: :development
97
91
  prerelease: false
98
92
  version_requirements: !ruby/object:Gem::Requirement
99
93
  requirements:
100
94
  - - '='
101
95
  - !ruby/object:Gem::Version
102
- version: 0.87.1
96
+ version: 0.91.0
103
97
  - !ruby/object:Gem::Dependency
104
98
  name: spy
105
99
  requirement: !ruby/object:Gem::Requirement
@@ -120,14 +114,14 @@ dependencies:
120
114
  requirements:
121
115
  - - "~>"
122
116
  - !ruby/object:Gem::Version
123
- version: '3.7'
117
+ version: '3.8'
124
118
  type: :development
125
119
  prerelease: false
126
120
  version_requirements: !ruby/object:Gem::Requirement
127
121
  requirements:
128
122
  - - "~>"
129
123
  - !ruby/object:Gem::Version
130
- version: '3.7'
124
+ version: '3.8'
131
125
  - !ruby/object:Gem::Dependency
132
126
  name: yard
133
127
  requirement: !ruby/object:Gem::Requirement
@@ -402,7 +396,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
402
396
  requirements:
403
397
  - - ">="
404
398
  - !ruby/object:Gem::Version
405
- version: 2.4.0
399
+ version: 2.5.0
406
400
  required_rubygems_version: !ruby/object:Gem::Requirement
407
401
  requirements:
408
402
  - - ">="