prism-marauder 0.6.6 → 0.7.0
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 +4 -4
- data/lib/marauder/commands.rb +22 -9
- data/lib/marauder/marauder.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b95788c5c1a2d58445a2380506338ee61d6e4020
|
|
4
|
+
data.tar.gz: 379964fcc377ca27aa91b624e792190a2de38e70
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6e6f87f8b3302a46163a9b015b7b8cb7b2c8c61f5601de5219965ca4334a048ae876d7c0b3f19683a6eb9e292290ba7667c60378479cca7971ebab2cd3b26521
|
|
7
|
+
data.tar.gz: 4ac5e4b0b9386a2af899bbdb920f0bef577ad4c4e0ce5dba9091bd6e7551c0b05f42ce90d6bf2aa3a18019760f2437029524556e0a6274f56bc4b520e43d19f7
|
data/lib/marauder/commands.rb
CHANGED
|
@@ -109,9 +109,15 @@ def find_instances(filter)
|
|
|
109
109
|
end
|
|
110
110
|
|
|
111
111
|
def find_hardware(filter)
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
begin
|
|
113
|
+
data = prism_query('/hardware', filter)
|
|
114
|
+
hardware = data["data"]["hardware"]
|
|
115
|
+
token_filter(hardware, filter){ |h| [h["dnsName"], h["stage"], h["stack"]] + h["app"] }
|
|
116
|
+
rescue StandardError => error
|
|
117
|
+
STDERR.puts 'WARNING: The prism server you are using no longer has the hardware endpoint - ignoring request'
|
|
118
|
+
# return an empty list
|
|
119
|
+
[]
|
|
120
|
+
end
|
|
115
121
|
end
|
|
116
122
|
|
|
117
123
|
def user_for_host(hostname)
|
|
@@ -127,6 +133,13 @@ def get_field_rec(object, fieldList)
|
|
|
127
133
|
end
|
|
128
134
|
|
|
129
135
|
def get_field(object, field)
|
|
136
|
+
if field.nil?
|
|
137
|
+
if object['addresses']['public'].nil?
|
|
138
|
+
field = 'ip'
|
|
139
|
+
else
|
|
140
|
+
field = 'dnsName'
|
|
141
|
+
end
|
|
142
|
+
end
|
|
130
143
|
get_field_rec(object, field.split('.'))
|
|
131
144
|
end
|
|
132
145
|
|
|
@@ -135,7 +148,7 @@ def display_results(matching, options, noun)
|
|
|
135
148
|
STDERR.puts "No #{noun} found"
|
|
136
149
|
else
|
|
137
150
|
STDERR.puts "#{matching.length} results"
|
|
138
|
-
field_name = options.field ||
|
|
151
|
+
field_name = options.field || nil
|
|
139
152
|
if options.short
|
|
140
153
|
matching.map { |host| get_field(host, field_name) }.compact.each{ |value| puts value }
|
|
141
154
|
else
|
|
@@ -151,7 +164,7 @@ end
|
|
|
151
164
|
###### COMMANDS ######
|
|
152
165
|
|
|
153
166
|
command :hosts do |c|
|
|
154
|
-
c.description = 'List all hosts (hardware or instances) that match the search filter'
|
|
167
|
+
c.description = 'List all hosts (hardware or instances) that match the search filter'
|
|
155
168
|
c.syntax = 'marauder hosts <filter>'
|
|
156
169
|
c.option '-s', '--short', 'Only return hostnames'
|
|
157
170
|
c.option '-f', '--field STRING', String, 'Use specified field from prism'
|
|
@@ -168,17 +181,17 @@ command :instances do |c|
|
|
|
168
181
|
c.action do |args, options|
|
|
169
182
|
display_results(find_instances(args), options, 'instances')
|
|
170
183
|
end
|
|
171
|
-
end
|
|
184
|
+
end
|
|
172
185
|
|
|
173
186
|
command :hardware do |c|
|
|
174
|
-
c.description = 'List hardware that matches the search filter'
|
|
187
|
+
c.description = 'List hardware that matches the search filter'
|
|
175
188
|
c.syntax = 'marauder hardware <filter>'
|
|
176
189
|
c.option '-s', '--short', 'Only return hostnames'
|
|
177
190
|
c.option '-f', '--field STRING', String, 'Use specified field from prism'
|
|
178
191
|
c.action do |args, options|
|
|
179
192
|
display_results(find_hardware(args), options, 'hardware')
|
|
180
193
|
end
|
|
181
|
-
end
|
|
194
|
+
end
|
|
182
195
|
|
|
183
196
|
command :ssh do |c|
|
|
184
197
|
c.syntax = 'marauder ssh <filter>'
|
|
@@ -221,4 +234,4 @@ command :ssh do |c|
|
|
|
221
234
|
end
|
|
222
235
|
end
|
|
223
236
|
|
|
224
|
-
default_command :
|
|
237
|
+
default_command :instances
|
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.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sébastien Cevey
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2015-
|
|
12
|
+
date: 2015-12-17 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: commander
|