prism-marauder 0.6.3 → 0.6.4
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.
- data/lib/marauder/commands.rb +11 -6
- data/lib/marauder/marauder.rb +1 -1
- metadata +2 -2
data/lib/marauder/commands.rb
CHANGED
@@ -13,9 +13,12 @@ program :description, 'command-line tool to locate infrastructure'
|
|
13
13
|
# Load config file
|
14
14
|
CONFIG_FILE = "#{ENV['HOME']}/.config/marauder/defaults.yaml"
|
15
15
|
|
16
|
-
|
16
|
+
begin
|
17
|
+
raise ArgumentError, "Missing configuration file" unless File.exists?(CONFIG_FILE)
|
17
18
|
config = YAML.load_file(CONFIG_FILE)
|
18
|
-
|
19
|
+
PRISM_URL = config['prism-url'].gsub(/\/$/,'')
|
20
|
+
raise StandardError, "Missing configuration parameter 'prism-url'" unless PRISM_URL && !PRISM_URL.empty?
|
21
|
+
rescue StandardError, ArgumentError => error
|
19
22
|
STDERR.puts "Well that doesn't look right..."
|
20
23
|
STDERR.puts " ... prism-marauder now requires a configuration file which tells it how to connect to Prism"
|
21
24
|
STDERR.puts
|
@@ -24,12 +27,10 @@ else
|
|
24
27
|
STDERR.puts " prism-url: http://<prism-host>"
|
25
28
|
STDERR.puts
|
26
29
|
STDERR.puts "Good luck on your quest"
|
27
|
-
raise
|
30
|
+
raise error
|
28
31
|
end
|
29
32
|
|
30
|
-
|
31
|
-
|
32
|
-
class Api
|
33
|
+
class Api
|
33
34
|
include HTTParty
|
34
35
|
#debug_output $stderr
|
35
36
|
disable_rails_query_string_format
|
@@ -71,6 +72,10 @@ def prism_query(path, filter)
|
|
71
72
|
|
72
73
|
data = Api.get("#{PRISM_URL}#{path}", :query => {:_expand => true}.merge(api_query))
|
73
74
|
|
75
|
+
if data.code != 200
|
76
|
+
raise StandardError, "Prism API returned status code #{data.code} in response to #{data.request.last_uri} - check that your configuration file is correct"
|
77
|
+
end
|
78
|
+
|
74
79
|
if data["stale"]
|
75
80
|
update_time = data["lastUpdated"]
|
76
81
|
STDERR.puts "WARNING: Prism reports that the data returned from #{path} is stale, it was last updated at #{update_time}"
|
data/lib/marauder/marauder.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prism-marauder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-04-
|
13
|
+
date: 2014-04-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: commander
|