lmcadm 0.13.0 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/dev_lmcadm +4 -0
- data/lib/lmcadm/account_commands.rb +2 -2
- data/lib/lmcadm/cloud_commands.rb +1 -0
- data/lib/lmcadm/commands/preferences.rb +31 -0
- data/lib/lmcadm/commands/terminal.rb +16 -8
- data/lib/lmcadm/version.rb +1 -1
- data/lmcadm.gemspec +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0925f20d360b3e8e6740c298a99c12b67474ae9d8d0c1ff6a426109cc9810ef7'
|
4
|
+
data.tar.gz: a3be3188b433d777bce80b5807c497ca41d15c9fa65037eaec5421abd2c6490b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1958b20290dcad4adcddfbb87de3e0352f9e6efa8f5ddd8e343bf1bb3ac5b757ec6cffb61081402fdff986a7d454210ad64d1662f4ac8519e3b9c406e53b5a08
|
7
|
+
data.tar.gz: 3398cb285de12bb7a2211a609fea72cd7f421827e45133c751482f072fa370509d860707c94a7ff1042d2a243ebe0553086cb09da316e24b837b4a46e3a80b15
|
data/dev_lmcadm
ADDED
@@ -29,9 +29,9 @@ module LMCAdm
|
|
29
29
|
accounts.sort {|a, b| a["name"] <=> b["name"]}.each do |account|
|
30
30
|
puts account.inspect if global_options[:v]
|
31
31
|
if options[:l]
|
32
|
-
puts account
|
32
|
+
puts account.summary
|
33
33
|
else
|
34
|
-
puts
|
34
|
+
puts "\"#{account}\" (#{account["type"]})"
|
35
35
|
end
|
36
36
|
end
|
37
37
|
puts accounts.length.to_s + " Accounts found"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module LMCAdm #:nodoc:
|
4
|
+
desc 'Manipulate preferences'
|
5
|
+
command :preferences do |preferences|
|
6
|
+
preferences.desc 'Get last account data'
|
7
|
+
preferences.arg_name 'accounts'
|
8
|
+
preferences.command :lastaccounts do |la|
|
9
|
+
la.action do |g, _o, args|
|
10
|
+
cloud = LMC::Cloud.new(g[:cloud_host], g[:user], g[:password])
|
11
|
+
self_ui = cloud.preferences [:principals, :self, :ui]
|
12
|
+
if args.empty?
|
13
|
+
ids = self_ui.get 'lastAccountIds'
|
14
|
+
accounts = ids.map do |id|
|
15
|
+
LMC::Account.get id
|
16
|
+
end
|
17
|
+
accounts.each { |a|
|
18
|
+
puts a.summary
|
19
|
+
}
|
20
|
+
else
|
21
|
+
account_ids = args.map { |arg|
|
22
|
+
LMC::Account.get_by_uuid_or_name(arg).id
|
23
|
+
}
|
24
|
+
puts account_ids
|
25
|
+
puts self_ui.put 'lastAccountIds', account_ids
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
@@ -50,8 +50,8 @@ module LMCAdm
|
|
50
50
|
begin
|
51
51
|
EventMachine.epoll
|
52
52
|
EventMachine.run do
|
53
|
-
trap("TERM") { stop g[:debug]}
|
54
|
-
trap("INT") { stop g[:debug]}
|
53
|
+
trap("TERM") { stop g[:debug] }
|
54
|
+
trap("INT") { stop g[:debug] }
|
55
55
|
IO.console.raw!
|
56
56
|
EventMachine.open_keyboard(LMCAdm::KeyboardHandler)
|
57
57
|
@ws = WebSocket::EventMachine::Client.connect({uri: url, headers: headers_hash})
|
@@ -59,19 +59,27 @@ module LMCAdm
|
|
59
59
|
|
60
60
|
@ws.onopen do
|
61
61
|
print "Connected to #{device.name} (#{device.id}):\r\n"
|
62
|
+
remaining_args = args.drop(1)
|
63
|
+
if remaining_args.length > 0
|
64
|
+
@ws.send '1' + remaining_args.join(' ') + "\r", type: 'binary'
|
65
|
+
end
|
62
66
|
end
|
63
67
|
|
64
68
|
@ws.onmessage do |msg, type|
|
65
69
|
print "##{msg.length}##{msg.inspect}#" if g[:debug]
|
70
|
+
# respond to custom keepalive
|
71
|
+
if msg.start_with? '0'
|
72
|
+
@ws.send '0', type: 'binary'
|
73
|
+
end
|
66
74
|
if msg.start_with? "1"
|
67
|
-
print msg[1..-1].gsub("\n","\r\n")
|
75
|
+
print msg[1..-1].gsub("\n", "\r\n")
|
68
76
|
else
|
69
77
|
print msg if g[:debug]
|
70
78
|
end
|
71
79
|
print DateTime.now.to_s if g[:debug]
|
72
80
|
if msg.include? "\n\nGoodbye\n\n"
|
73
81
|
stop g[:debug]
|
74
|
-
closing =
|
82
|
+
closing = true
|
75
83
|
end
|
76
84
|
end
|
77
85
|
|
@@ -93,7 +101,7 @@ module LMCAdm
|
|
93
101
|
puts "Received pong: #{msg}" if g[:verbose]
|
94
102
|
end
|
95
103
|
|
96
|
-
def stop(debug=false)
|
104
|
+
def stop(debug = false)
|
97
105
|
print DateTime.now.to_s if debug
|
98
106
|
print "Terminating connection\r\n"
|
99
107
|
EventMachine.stop
|
@@ -102,9 +110,9 @@ module LMCAdm
|
|
102
110
|
ensure
|
103
111
|
IO.console.cooked!
|
104
112
|
end
|
105
|
-
|
106
|
-
|
107
|
-
|
113
|
+
# disabled, getting 401 anyways
|
114
|
+
#account.cloud.auth_for_account account
|
115
|
+
#account.cloud.delete ['cloud-service-devicetunnel', 'accounts', account.id, "terminal?ids=#{sessionInfo.body.first['id']}"]
|
108
116
|
end
|
109
117
|
end
|
110
118
|
end
|
data/lib/lmcadm/version.rb
CHANGED
data/lmcadm.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "minitest", "~> 5.0"
|
25
25
|
spec.add_development_dependency "pry-nav", "0.2.4"
|
26
26
|
|
27
|
-
spec.add_runtime_dependency 'lmc', '~> 0.
|
27
|
+
spec.add_runtime_dependency 'lmc', '~> 0.12.0'
|
28
28
|
spec.add_runtime_dependency 'gli', '~> 2.17'
|
29
29
|
spec.add_runtime_dependency 'table_print', '~> 1.5'
|
30
30
|
spec.add_runtime_dependency 'colorize', '~> 0.8'
|
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.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- erpel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.12.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: 0.12.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: gli
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -155,6 +155,7 @@ files:
|
|
155
155
|
- Rakefile
|
156
156
|
- bin/console
|
157
157
|
- bin/setup
|
158
|
+
- dev_lmcadm
|
158
159
|
- exe/lmcadm
|
159
160
|
- lib/lmcadm.rb
|
160
161
|
- lib/lmcadm/ColoredProgressVisualizer.rb
|
@@ -167,6 +168,7 @@ files:
|
|
167
168
|
- lib/lmcadm/commands/completion.rb
|
168
169
|
- lib/lmcadm/commands/maintenance.rb
|
169
170
|
- lib/lmcadm/commands/monitor.rb
|
171
|
+
- lib/lmcadm/commands/preferences.rb
|
170
172
|
- lib/lmcadm/commands/principal.rb
|
171
173
|
- lib/lmcadm/commands/privatecloud.rb
|
172
174
|
- lib/lmcadm/commands/rights.rb
|