onering-client 0.0.4 → 0.0.6
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/bin/onering +47 -17
- data/lib/onering/plugins/devices.rb +4 -0
- metadata +5 -6
data/bin/onering
CHANGED
@@ -6,30 +6,60 @@
|
|
6
6
|
# provision [options] [key:value .. ] [pxe profile | ]
|
7
7
|
|
8
8
|
|
9
|
-
require 'rubygems'
|
10
9
|
require 'json'
|
10
|
+
require 'rubygems'
|
11
11
|
require 'subcommander'
|
12
12
|
require 'onering'
|
13
|
+
require 'yaml'
|
14
|
+
|
15
|
+
include Subcommander
|
16
|
+
|
13
17
|
|
14
|
-
|
18
|
+
def print_format(data)
|
19
|
+
puts YAML.dump(data)
|
20
|
+
end
|
21
|
+
|
22
|
+
subcommander.version = Gem.loaded_specs['onering-client'].version.to_s
|
23
|
+
subcommander.desc = Gem.loaded_specs['onering-client'].description
|
15
24
|
|
16
|
-
|
25
|
+
#subcommander.opt :server, '-s', '--server', 'Specify the Onering server URL'
|
17
26
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
:filter => ARGV
|
22
|
-
}))
|
23
|
-
when :s, :search
|
24
|
-
Onering::API::Device.find(ARGV)
|
27
|
+
subcommand :devices, "Operations related to Onering's assets database" do |devices|
|
28
|
+
api = Onering::API::Devices
|
29
|
+
api.connect
|
25
30
|
|
26
|
-
|
27
|
-
|
31
|
+
# GET
|
32
|
+
devices.subcommand :get, "Get a single node by ID" do |sc|
|
33
|
+
sc.usage = "onering devices get ID"
|
28
34
|
|
29
|
-
|
30
|
-
|
31
|
-
|
35
|
+
sc.exec do
|
36
|
+
print_format api.get(sc[:args].first)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# LIST
|
41
|
+
devices.subcommand :list, "List field values" do |sc|
|
42
|
+
sc.usage = "onering devices list [-f FILTER] FIELD"
|
43
|
+
sc.opt :filter, '-f', '--filter FILTER', "A urlquery filter string"
|
44
|
+
|
45
|
+
sc.exec do
|
46
|
+
field = sc[:args].first
|
47
|
+
filter = sc[:filter]
|
48
|
+
|
49
|
+
print_format api.list(field, filter)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# FIND
|
54
|
+
devices.subcommand :find, "Finds all nodes that match a urlquery filter string" do |sc|
|
55
|
+
sc.arity = 1
|
56
|
+
sc.usage = "onering devices find FILTER"
|
57
|
+
|
58
|
+
sc.exec do
|
59
|
+
print_format api.find(sc[:args].first)
|
60
|
+
end
|
32
61
|
end
|
33
|
-
else
|
34
|
-
STDERR.puts "Usage: onering [subcommand] [options]"
|
35
62
|
end
|
63
|
+
|
64
|
+
|
65
|
+
subcommander.go!
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onering-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Gary Hetzel
|
@@ -20,8 +20,8 @@ dependencies: []
|
|
20
20
|
|
21
21
|
description: A Ruby wrapper for Onering
|
22
22
|
email: ghetzel@outbrain.com
|
23
|
-
executables:
|
24
|
-
|
23
|
+
executables:
|
24
|
+
- onering
|
25
25
|
extensions: []
|
26
26
|
|
27
27
|
extra_rdoc_files: []
|
@@ -66,4 +66,3 @@ specification_version: 3
|
|
66
66
|
summary: Onering client API
|
67
67
|
test_files: []
|
68
68
|
|
69
|
-
has_rdoc:
|