lmcadm 0.6.2 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +28 -0
- data/lib/lmcadm/cloud_commands.rb +9 -9
- data/lib/lmcadm/device_commands.rb +32 -7
- data/lib/lmcadm/version.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: cf0e5d4106b7ecc7b9628804ecc09eb9be0bf435
|
4
|
+
data.tar.gz: eab602890adc55b823c4880a3f01ee7b48b57ec8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec4dd8ef6a3357a3650362e971dd2f5f6988ddefd86cc184357c71fcf6a3d5f766cca882a1d0860b67c4e47a9ec506417e33e5d455473ec5716e21d93fa36b20
|
7
|
+
data.tar.gz: aa0c85d4ebe7ddd33859cac5950e265e3779816ea3d5c745b6de6265ab1435c5b690c00eaf25d5a6abe7393f6e5db62b270efb77549b4e11e3b4dfce930ee6d5
|
data/LICENSE.txt
CHANGED
@@ -1 +1,29 @@
|
|
1
|
+
BSD 3-Clause License
|
1
2
|
|
3
|
+
Copyright (c) 2018, Philipp Erbelding
|
4
|
+
All rights reserved.
|
5
|
+
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
8
|
+
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
10
|
+
list of conditions and the following disclaimer.
|
11
|
+
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
14
|
+
and/or other materials provided with the distribution.
|
15
|
+
|
16
|
+
3. Neither the name of the copyright holder nor the names of its
|
17
|
+
contributors may be used to endorse or promote products derived from
|
18
|
+
this software without specific prior written permission.
|
19
|
+
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@@ -45,15 +45,15 @@ module LMCAdm
|
|
45
45
|
tos.desc 'Accept terms of use by name'
|
46
46
|
tos.command :accept do |accept|
|
47
47
|
accept.action do |global_options, options, args|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
48
|
+
begin
|
49
|
+
cloud = LMC::Cloud.instance
|
50
|
+
rescue LMC::OutdatedTermsOfUseException => e
|
51
|
+
matched_tos = e.missing.select do |missingtos|
|
52
|
+
args.include? missingtos['name']
|
53
|
+
end
|
54
|
+
cloud = LMC::Cloud.instance authorize: false
|
55
|
+
puts "Accepting TOS #{matched_tos.to_s}"
|
56
|
+
cloud.accept_tos matched_tos
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
@@ -16,7 +16,7 @@ module LMCAdm
|
|
16
16
|
|
17
17
|
device_list.action do |global_options, options|
|
18
18
|
account = LMC::Account.get_by_uuid_or_name options[:account]
|
19
|
-
t=ProgressVisualizer.new "Getting devices"
|
19
|
+
t = ProgressVisualizer.new "Getting devices"
|
20
20
|
devices = LMC::Device.get_for_account(account)
|
21
21
|
t.done
|
22
22
|
cols = [{:id => {width: 36}}, :name, :model, :serial, :heartbeatstate]
|
@@ -66,7 +66,7 @@ module LMCAdm
|
|
66
66
|
puts "result_config class: " + result_config.body_object.class.to_s if global_options[:debug]
|
67
67
|
pretty = JSON.pretty_generate(result_config)
|
68
68
|
if options[:w]
|
69
|
-
IO.write(options[:prefix] + "-" + device.name + '-' + device.id + ".json",pretty)
|
69
|
+
IO.write(options[:prefix] + "-" + device.name + '-' + device.id + ".json", pretty)
|
70
70
|
else
|
71
71
|
puts pretty
|
72
72
|
end
|
@@ -106,11 +106,11 @@ module LMCAdm
|
|
106
106
|
raise "Device not found"
|
107
107
|
end
|
108
108
|
|
109
|
-
t=ProgressVisualizer.new "Getting current config..."
|
109
|
+
t = ProgressVisualizer.new "Getting current config..."
|
110
110
|
config = device.get_config_for_account(account)
|
111
111
|
t.finished " Done".green
|
112
112
|
|
113
|
-
t=ProgressVisualizer.new "Applying changes..."
|
113
|
+
t = ProgressVisualizer.new "Applying changes..."
|
114
114
|
if options[:jsonfile]
|
115
115
|
jsoncontent = IO.read(options[:jsonfile])
|
116
116
|
configchange = JSON.parse jsoncontent
|
@@ -123,13 +123,38 @@ module LMCAdm
|
|
123
123
|
t.finished " Done".green
|
124
124
|
|
125
125
|
puts JSON.pretty_generate(config) if global_options[:debug]
|
126
|
-
t=ProgressVisualizer.new "Submitting new config..."
|
126
|
+
t = ProgressVisualizer.new "Submitting new config..."
|
127
127
|
result = device.set_config_for_account(config, account)
|
128
128
|
if result.code == 200
|
129
|
-
print
|
129
|
+
print " " + result["id"].to_s + "..."
|
130
130
|
end
|
131
131
|
t.finished " " + LMCADMResultInterpreter.interpret_with_color(result)
|
132
132
|
end
|
133
133
|
end
|
134
|
+
|
135
|
+
c.arg_name '"search string"'
|
136
|
+
c.desc 'Display device registration data'
|
137
|
+
c.long_desc 'Search for device registration data. Currently supports serial numbers as search strings.'
|
138
|
+
c.command :registration do |cmd|
|
139
|
+
cmd.action do |_global_options, _options, args|
|
140
|
+
root_account = LMC::Account.get LMC::Account::ROOT_ACCOUNT_UUID
|
141
|
+
cloud = LMC::Cloud.instance
|
142
|
+
cloud.auth_for_account root_account
|
143
|
+
result = cloud.get ['cloud-service-devices', 'registrations'], {'updatePairing' => false, "status.serial" => args.first}
|
144
|
+
result.body.each do |registration|
|
145
|
+
|
146
|
+
registration.status.keys.each {|key|
|
147
|
+
puts "#{key}: #{registration.status[key]}"
|
148
|
+
}
|
149
|
+
if registration.accountId
|
150
|
+
#TODO Check if account info can be displayed via another endpoint
|
151
|
+
#account = LMC::Account.get registration.accountId
|
152
|
+
#puts account
|
153
|
+
puts "accountID: #{registration.accountId}"
|
154
|
+
end
|
155
|
+
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
134
159
|
end
|
135
|
-
end
|
160
|
+
end
|
data/lib/lmcadm/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lmcadm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- erpel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|