collins-cli 0.2.0 → 0.2.1
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/collins/cli/find.rb +11 -4
- 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: 068a6b925cfcf4b7d3a3d9b637e731186733e88a
|
4
|
+
data.tar.gz: 66ab664be91281098cb1c2aba20d249f2a349aa6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: af1c57c8a001d86e1cb0d2fa0eaf304579785ee29b8f85f46e502b68be644f67bd95cc07b31870ab96339abe2e77bac56d2f248cd97d36ad5f593f13c18d6253
|
7
|
+
data.tar.gz: 1b9b927522b57f77650805a549cc01fa3ed99dfac9f71a79ec2b848645cf951798134dafffca42bf6541ec5b411faaa61814a8ca68fc7a0d2a2eb0e4aef3154a
|
data/lib/collins/cli/find.rb
CHANGED
@@ -11,7 +11,7 @@ module Collins::CLI
|
|
11
11
|
PROG_NAME = 'collins find'
|
12
12
|
QUERY_DEFAULTS = {
|
13
13
|
:operation => 'AND',
|
14
|
-
:size =>
|
14
|
+
:size => 100,
|
15
15
|
}
|
16
16
|
OPTION_DEFAULTS = {
|
17
17
|
:format => :table, # how to display the results
|
@@ -43,7 +43,7 @@ module Collins::CLI
|
|
43
43
|
opts.on('-T','--type TYPE',String, "Only show assets with type TYPE") {|v| search_attrs[:type] = v}
|
44
44
|
opts.on('-n','--nodeclass NODECLASS[,...]',Array, "Assets in nodeclass NODECLASS") {|v| search_attrs[:nodeclass] = v}
|
45
45
|
opts.on('-p','--pool POOL[,...]',Array, "Assets in pool POOL") {|v| search_attrs[:pool] = v}
|
46
|
-
opts.on('-s','--size SIZE',Integer, "Number of assets to return (Default: #{query_opts[:size]})") {|v| query_opts[:size] = v}
|
46
|
+
opts.on('-s','--size SIZE',Integer, "Number of assets to return per page (Default: #{query_opts[:size]})") {|v| query_opts[:size] = v}
|
47
47
|
opts.on('-r','--role ROLE[,...]',Array,"Assets in primary role ROLE") {|v| search_attrs[:primary_role] = v}
|
48
48
|
opts.on('-R','--secondary-role ROLE[,...]',Array,"Assets in secondary role ROLE") {|v| search_attrs[:secondary_role] = v}
|
49
49
|
opts.on('-i','--ip-address IP[,...]',Array,"Assets with IP address[es]") {|v| search_attrs[:ip_address] = v}
|
@@ -90,7 +90,7 @@ module Collins::CLI
|
|
90
90
|
|
91
91
|
opts.separator ""
|
92
92
|
opts.separator "Extra options:"
|
93
|
-
opts.on('--
|
93
|
+
opts.on('--timeout SECONDS',Integer,"Timeout in seconds (0 == forever)") {|v| options[:timeout] = v}
|
94
94
|
opts.on('-C','--config CONFIG',String,'Use specific Collins config yaml for Collins::Client') {|v| options[:config] = v}
|
95
95
|
opts.on('-h','--help',"Help") {options[:mode] = :help}
|
96
96
|
|
@@ -145,8 +145,15 @@ _EXAMPLES_
|
|
145
145
|
if options[:mode] == :help
|
146
146
|
puts parser
|
147
147
|
else
|
148
|
+
page = 0
|
149
|
+
assets, res = [], []
|
148
150
|
begin
|
149
|
-
|
151
|
+
loop do
|
152
|
+
res = collins.find(query_opts.merge({:page => page}))
|
153
|
+
break if res.empty?
|
154
|
+
assets = assets.concat res
|
155
|
+
page += 1
|
156
|
+
end
|
150
157
|
rescue => e
|
151
158
|
raise "Error querying collins: #{e.message}"
|
152
159
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: collins-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gabe Conradi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|