wavefront-cli 2.15.1 → 2.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a7bcdc77460e6ee7549d1eb6dae32e5319f7ea74a47a820f27ab99312f50b963
4
- data.tar.gz: bfcac8895c3005bf7f516403391b4eab7aef4905fe3e86e186832e031cf6a88f
3
+ metadata.gz: d23d72573c71a3c0fdfc1277b6a8f1544fe38536dfa6c72199d47a15833613db
4
+ data.tar.gz: d212aa09f8bbe2bb3377f00be4a5fa6e4f6f64870e92d4e8130905cf190848b4
5
5
  SHA512:
6
- metadata.gz: a670d0670679e424cedf12545d4fcc4f5aae9e79d4e89ea644b7f7633de0efda9a7426472c9eb2c0054f090849774af5cdfe4f3acb1cce5ec1459137fa2aa53e
7
- data.tar.gz: ec6445ab10a7510ceb30386e9542aedc0d795dadc3cdbc22be93a759d6309bff728c52b9c914d60a98e33594559bfdfe74aca81145a2583453e145987ee766a3
6
+ metadata.gz: 2df4d1cc0fd0ff924fd4d1f4271e00600b5448d332db1b65213e31944499c4aaece08944c719c0fcc5bd2603f1bdc5ddedeeb02aeb96ff054d33b227f46097ba
7
+ data.tar.gz: 41f5a4aae62c21c9729b73f8581fcb0a1da3538d83278b55baee5321b2ba5732fbaa9f63ebe68f3bf90821958dabdb75c65a1595e131534cc0ba970b809db295
data/HISTORY.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.15.2 (21/12/2018)
4
+ * Fix bug which caused an unhandled exception if CSV or Wavefront
5
+ query outputs tried to process an empty data set.
6
+
7
+ ## 2.15.1 (20/12/2018)
8
+
9
+ * Fix bug where `alert snoozed` and `alert firing` did the same
10
+ thing.
11
+
3
12
  ## 2.15.0 (18/12/2018)
4
13
  * Gracefully handle ctrl-c.
5
14
  * Add `install` and `uninstall` subcommands to `wf alert`.
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2017, Sysdef Ltd
1
+ Copyright (c) 2017-2018, Sysdef Ltd
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
@@ -114,6 +114,8 @@ class WavefrontCliController
114
114
  abort 'Unsupported file format.'
115
115
  rescue WavefrontCli::Exception::UnparseableInput => e
116
116
  abort "Cannot parse input. #{e.message}"
117
+ rescue WavefrontCli::Exception::UnparseableResponse => e
118
+ abort "Bad response from Wavefront. #{e.message}"
117
119
  rescue WavefrontCli::Exception::FileNotFound
118
120
  abort 'File not found.'
119
121
  rescue WavefrontCli::Exception::UnparseableInput
@@ -7,6 +7,7 @@ module WavefrontCli
7
7
  class SystemError < RuntimeError; end
8
8
  class UnhandledCommand < RuntimeError; end
9
9
  class UnparseableInput < RuntimeError; end
10
+ class UnparseableResponse < RuntimeError; end
10
11
  class UnsupportedFileFormat < RuntimeError; end
11
12
  class UnsupportedOperation < RuntimeError; end
12
13
  class UnsupportedOutput < RuntimeError; end
@@ -14,5 +14,14 @@ module WavefrontCsvOutput
14
14
  def run
15
15
  puts _run
16
16
  end
17
+
18
+ def check_query_response
19
+ return true unless resp[:timeseries].nil?
20
+
21
+ puts 'No points match query.'
22
+ exit 0
23
+ rescue StandardError
24
+ raise WavefrontCli::Exception::UnparseableResponse
25
+ end
17
26
  end
18
27
  end
@@ -42,6 +42,8 @@ module WavefrontCsvOutput
42
42
  # @return [Array[Hash]] which goes in the @data_map
43
43
  #
44
44
  def query_output
45
+ check_query_response
46
+
45
47
  resp[:timeseries].each_with_object([]) do |ts, a|
46
48
  ts[:data].each do |point|
47
49
  a.<< csv_format(ts[:label],
@@ -1,12 +1,12 @@
1
1
  require 'wavefront-sdk/stdlib/hash'
2
- require_relative 'base'
2
+ require_relative '../csv/base'
3
3
 
4
4
  module WavefrontWavefrontOutput
5
5
  #
6
6
  # Display query results in Wavefront wire format. We have to
7
7
  # handle raw and normal output in different ways.
8
8
  #
9
- class Query < Base
9
+ class Query < WavefrontCsvOutput::Base
10
10
  def _run
11
11
  if options[:raw]
12
12
  raw_output
@@ -28,6 +28,8 @@ module WavefrontWavefrontOutput
28
28
  end
29
29
 
30
30
  def query_output
31
+ check_query_response
32
+
31
33
  resp[:timeseries].each_with_object('') do |ts, a|
32
34
  ts[:data].each do |point|
33
35
  a.<< wavefront_format(ts[:label],
@@ -1 +1 @@
1
- WF_CLI_VERSION = '2.15.1'.freeze
1
+ WF_CLI_VERSION = '2.15.2'.freeze
@@ -35,7 +35,7 @@ describe "#{word} command" do
35
35
 
36
36
  cmd_to_call(word, 'installed', path: "/api/v2/#{word}/installed")
37
37
 
38
- cmd_to_call(word, 'manifests', path: "/api/v2/#{word}/manifests")
38
+ cmd_to_call(word, 'manifests -f json', path: "/api/v2/#{word}/manifests")
39
39
 
40
40
  invalid_ids(word, ["describe #{bad_id}", "install #{bad_id}",
41
41
  "alert install #{bad_id}",
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require_relative '../spec_helper'
3
4
  require_relative '../../lib/wavefront-cli/write'
4
5
 
5
6
  # Test base writer
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: 2.15.1
4
+ version: 2.15.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Fisher
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-20 00:00:00.000000000 Z
11
+ date: 2018-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt
@@ -243,7 +243,6 @@ files:
243
243
  - lib/wavefront-cli/output/json.rb
244
244
  - lib/wavefront-cli/output/ruby.rb
245
245
  - lib/wavefront-cli/output/wavefront.rb
246
- - lib/wavefront-cli/output/wavefront/base.rb
247
246
  - lib/wavefront-cli/output/wavefront/query.rb
248
247
  - lib/wavefront-cli/output/yaml.rb
249
248
  - lib/wavefront-cli/proxy.rb
@@ -1,17 +0,0 @@
1
- module WavefrontWavefrontOutput
2
- #
3
- # Standard output template
4
- #
5
- class Base
6
- attr_reader :resp, :options
7
-
8
- def initialize(resp, options)
9
- @resp = resp
10
- @options = options
11
- end
12
-
13
- def run
14
- puts _run
15
- end
16
- end
17
- end