console-launcher 0.0.6 → 0.0.8
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 +15 -0
- data/bin/console-launcher +68 -161
- data/lib/console-launcher.rb +139 -0
- data/lib/console-launcher_version.rb +4 -0
- data/lib/rhev-manager/virtual-machine.rb +15 -0
- data/man/console-launcher.1 +60 -0
- data/man/console-launcher.1.html +123 -0
- metadata +38 -13
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NzdlYmU5NTgzZmI5NTlmYzdhYmZiYmQ2OGMwNzQ3MmRmNDA2YjkzNg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MDU4Y2JlNmIxODI1OGE4ODE3Njg2NzJiNzg3OGFmZjFjODA3ZDU5Yw==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YmE0YTFkMWRjZGQ4NjUwZTkzYzcxOWYyYWQ3NTE1ZDY0MTVjMWUyNTJmNjFk
|
10
|
+
ZmM5MmM1MTZkN2M5NWE3MDVhZTg2NzIyZDZmZWM3OTZiMjZkNzlkNTc0YWZm
|
11
|
+
ZTUyN2M0NTU2N2ZiMTEyZmFlNjFkZWJiZDk4YWU2Yjg2YjhmNWM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZGUzYmM3NTRhNTVlYmJlYWI4NjQwZDMxY2Q5YmQ1YzZlYzMzNGQwZGYyYzY3
|
14
|
+
ZDgyYjIyNjBiMTUzZTZkMThjODg5YzVmZDdjN2FjMjQ3NWRlYTlkMTE2ZTli
|
15
|
+
ZDJmNGFlMTc3NTNjMDdlZmM3ZGY1MTI3YjY1MTFhZDI0NmVkMDk=
|
data/bin/console-launcher
CHANGED
@@ -29,57 +29,56 @@
|
|
29
29
|
# - Made sure to strip http and https from the host definition
|
30
30
|
|
31
31
|
require 'rubygems'
|
32
|
-
require '
|
33
|
-
require '
|
32
|
+
require 'console-launcher'
|
33
|
+
require 'console-launcher_version'
|
34
34
|
require 'optparse'
|
35
|
-
require '
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
35
|
+
require 'yaml'
|
36
|
+
include Helper
|
37
|
+
|
38
|
+
options = {
|
39
|
+
print: false,
|
40
|
+
dryrun: false,
|
41
|
+
host: nil,
|
42
|
+
user: "admin@internal",
|
43
|
+
pass: nil
|
44
|
+
}
|
45
|
+
|
46
|
+
CONFIG_FILE = File.join(ENV['HOME'], '.config-launcher.rc.yaml')
|
47
|
+
if File.exists? CONFIG_FILE
|
48
|
+
config_options = YAML.load_file(CONFIG_FILE)
|
49
|
+
options.merge!(config_options)
|
50
|
+
else
|
51
|
+
File.open(CONFIG_FILE, 'w') { |file| YAML::dump(options, file) }
|
52
|
+
STDERR.puts "Initialized configuration file in #{CONFIG_FILE}"
|
48
53
|
end
|
49
54
|
|
50
|
-
@options = {}
|
51
|
-
|
52
55
|
optparse = OptionParser.new do |opts|
|
53
56
|
opts.banner = "Usage: #{$PROGRAM_NAME} [options]"
|
54
57
|
|
55
|
-
|
56
|
-
opts.on(
|
57
|
-
|
58
|
+
|
59
|
+
opts.on('--print', 'Print the command that is called to launch the Console Session') do
|
60
|
+
options[:print] = true
|
58
61
|
end
|
59
62
|
|
60
|
-
|
61
|
-
|
62
|
-
@options[:dryrun] = true
|
63
|
+
opts.on('-d', '--dry-run', 'Do not execute the Remote Viewer Application') do
|
64
|
+
options[:dryrun] = true
|
63
65
|
end
|
64
66
|
|
65
|
-
|
66
|
-
|
67
|
-
@options[:host] = strip_url(host)
|
67
|
+
opts.on('-h', '--host HOSTNAME', 'The Hostname of your RHEV-M Installation') do |host|
|
68
|
+
options[:host] = strip_url(host)
|
68
69
|
end
|
69
70
|
|
70
|
-
|
71
|
-
|
72
|
-
@options[:user] = u
|
71
|
+
opts.on('-u', '--username USERNAME', 'The Username used to establish the connection to --host (defaults to admin@internal)') do |u|
|
72
|
+
options[:user] = u
|
73
73
|
end
|
74
74
|
|
75
|
-
|
76
|
-
|
77
|
-
@options[:pass] = pass
|
75
|
+
opts.on('-p', '--password PASSWORD', 'The Password used to establish the connection to --host') do |pass|
|
76
|
+
options[:pass] = pass
|
78
77
|
end
|
79
78
|
|
80
79
|
# This displays the help screen, all programs are
|
81
80
|
# assumed to have this option.
|
82
|
-
opts.on(
|
81
|
+
opts.on('', '--help', 'Display this Help Message') do
|
83
82
|
puts ""
|
84
83
|
puts "This script connects to a RHEV-M Instance and lists all running VMs. You can choose which VM you want to"
|
85
84
|
puts "connect to via SPICE Protocol."
|
@@ -89,6 +88,8 @@ optparse = OptionParser.new do |opts|
|
|
89
88
|
puts " - Linux: TBD"
|
90
89
|
puts " - Windows: TBD"
|
91
90
|
puts ""
|
91
|
+
puts "Version: " + ConsoleLauncher::VERSION
|
92
|
+
puts ""
|
92
93
|
puts opts
|
93
94
|
exit
|
94
95
|
end
|
@@ -101,166 +102,72 @@ end
|
|
101
102
|
# the @options. What's left is the list of files to resize.
|
102
103
|
optparse.parse!
|
103
104
|
|
104
|
-
if
|
105
|
+
if options[:host] == nil
|
105
106
|
puts "ERROR: You have to configure RHEV-M Hostname to connect to"
|
106
107
|
puts optparse.help
|
107
108
|
exit 1
|
108
109
|
end
|
109
110
|
|
110
|
-
|
111
|
+
options[:pass] = get_password() if options[:pass] == nil
|
111
112
|
|
112
|
-
|
113
|
-
attr_accessor :id, :name, :description, :host_uuid, :state, :port, :secure_port, :address
|
114
|
-
|
115
|
-
def initialize(vm)
|
116
|
-
@id = vm['id']
|
117
|
-
@name = vm['name']
|
118
|
-
@description = vm['description']
|
119
|
-
@address = vm['display']['address'] unless vm['display'].nil?
|
120
|
-
@port = vm['display']['port'] unless vm['display'].nil?
|
121
|
-
@secure_port = vm['display']['secure_port'] unless vm['display'].nil?
|
122
|
-
@state = vm['status']['state'] unless vm['status'].nil?
|
123
|
-
@host_uuid = vm['host']['id'] unless vm['host'].nil?
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
|
128
|
-
# download the certificate file on the fly
|
129
|
-
begin
|
130
|
-
cert = Tempfile.new(@options[:host] + ".crt")
|
131
|
-
Net::HTTP.start(@options[:host]) do |http|
|
132
|
-
begin
|
133
|
-
http.request_get('/ca.crt') do |resp|
|
134
|
-
resp.read_body do |segment|
|
135
|
-
cert.write(segment)
|
136
|
-
end
|
137
|
-
end
|
138
|
-
ensure
|
139
|
-
cert.close()
|
140
|
-
end
|
141
|
-
end
|
142
|
-
@cert = cert.path
|
143
|
-
rescue => e
|
144
|
-
puts "There has been an error downloading the certificate file from #{@options[:host]}"
|
145
|
-
e.message
|
146
|
-
exit 1
|
147
|
-
end
|
148
|
-
|
149
|
-
# Create a little helper object that we will use to
|
150
|
-
# make connections to the REST API
|
151
|
-
@rhevm = RestClient::Resource.new(
|
152
|
-
"https://" + @options[:host],
|
153
|
-
:user => @options[:user],
|
154
|
-
:password => @options[:pass],
|
155
|
-
:ssl_ca_cert => @cert,
|
156
|
-
:ssl_version => "SSLv3",
|
157
|
-
:verify_ssl => OpenSSL::SSL::VERIFY_NONE)
|
158
|
-
|
159
|
-
def get_vms(vms_data)
|
160
|
-
# Iterate through the VM's and get all the
|
161
|
-
# required information
|
162
|
-
@vms = Array.new # Clear out array
|
163
|
-
vms_data['vm'].each do |vm|
|
164
|
-
# Making sure we only consider VM's that are in state up (so they do have a console to connect to)
|
165
|
-
# and that have the spice protocol enabled as the connection mode
|
166
|
-
if vm['status']['state'] == "up" && vm['display']['type'] == "spice"
|
167
|
-
@vms.push(VM.new(vm))
|
168
|
-
end
|
169
|
-
end
|
170
|
-
return @vms
|
171
|
-
end
|
172
|
-
|
173
|
-
def launch_viewer(index)
|
174
|
-
vm = @vms[index-1]
|
175
|
-
|
176
|
-
# let us no gather the host subject
|
177
|
-
hosts_data = XmlSimple.xml_in(@rhevm["/api/hosts/"+vm.host_uuid].get.body, { 'ForceArray' => false })
|
178
|
-
host_subject = hosts_data['certificate']['subject']
|
179
|
-
|
180
|
-
ticket_data = XmlSimple.xml_in(@rhevm["/api/vms/" + vm.id + "/ticket"].post("<action><ticket><expiry>300</expiry></ticket></action>", :content_type => 'application/xml').body, { 'ForceArray' => false })
|
181
|
-
password = ticket_data['ticket']['value']
|
182
|
-
|
183
|
-
# Creating the .vv File for the connection
|
184
|
-
# download the certificate file on the fly
|
185
|
-
vv = Tempfile.new("#{vm.name}.vv")
|
186
|
-
begin
|
187
|
-
vv.puts("[virt-viewer]")
|
188
|
-
vv.puts("type=spice")
|
189
|
-
vv.puts("host=#{vm.address}")
|
190
|
-
vv.puts("port=#{vm.port}")
|
191
|
-
vv.puts("password=#{password}")
|
192
|
-
vv.puts("tls-port=#{vm.secure_port}")
|
193
|
-
vv.puts("fullscreen=0")
|
194
|
-
vv.puts("title=vm:#{vm.name} - %d - Press SHIFT+F12 to Release Cursor")
|
195
|
-
vv.puts("enable-smartcard=0")
|
196
|
-
vv.puts("enable-usb-autoshare=1")
|
197
|
-
vv.puts("usb-filter=-1,-1,-1,-1,0")
|
198
|
-
vv.puts("host-subject=#{host_subject}")
|
199
|
-
vv.puts("toggle-fullscreen=shift+f11")
|
200
|
-
vv.puts("release-cursor=shift+f12")
|
201
|
-
ensure
|
202
|
-
vv.close()
|
203
|
-
end
|
204
|
-
|
205
|
-
# Now that we have all the information we can print the cmd line
|
206
|
-
puts "Console to VM: #{vm.name} state: #{vm.state} is started"
|
207
|
-
command = "/Applications/RemoteViewer.app/Contents/MacOS/RemoteViewer --spice-ca-file #{@cert} #{vv.path}"
|
208
|
-
puts command if @options[:print]
|
209
|
-
unless @options[:dryrun]
|
210
|
-
pid = Process.fork
|
211
|
-
if pid.nil? then
|
212
|
-
# In child
|
213
|
-
$stdout.reopen(Tempfile.new("RV-stdout").path, 'w')
|
214
|
-
$stderr.reopen(Tempfile.new("RV-stderr").path, 'w')
|
215
|
-
exec(command)
|
216
|
-
else
|
217
|
-
# In parent
|
218
|
-
Process.detach(pid)
|
219
|
-
end
|
220
|
-
end
|
221
|
-
puts "Reloading Virtual Machines Selection Menu ..."
|
222
|
-
sleep(5)
|
223
|
-
end
|
113
|
+
rhevm = RhevManager.new(options[:host], options[:user], options[:pass])
|
224
114
|
|
225
115
|
while true do
|
226
116
|
begin
|
227
|
-
|
228
|
-
|
229
|
-
vms_data = XmlSimple.xml_in(@rhevm["/api/vms"].get.body, { 'ForceArray' => false })
|
230
|
-
@vms = get_vms(vms_data)
|
117
|
+
vms = rhevm.get_vms()
|
118
|
+
|
231
119
|
# Print the selection to the User
|
232
120
|
puts
|
233
|
-
puts "Running Virtual Machines found for #{
|
234
|
-
|
121
|
+
puts "Running Virtual Machines found for #{options[:host]}:"
|
122
|
+
vms.each_with_index do |v, index|
|
235
123
|
puts "#{index+1}. Name: #{v.name} Description: #{v.description} State: #{v.state}"
|
236
124
|
end
|
237
125
|
puts
|
238
126
|
puts "r. Refresh"
|
239
127
|
puts "q. Quit"
|
240
128
|
puts
|
241
|
-
|
129
|
+
|
242
130
|
puts "Please select the VM you wish to open: "
|
243
|
-
|
244
|
-
STDOUT.flush
|
245
|
-
index = gets.chomp
|
131
|
+
|
132
|
+
STDOUT.flush
|
133
|
+
index = gets.chomp # Hackish, just wanting to add quit
|
246
134
|
if index.to_s == "q"
|
247
135
|
exit 0
|
248
136
|
elsif index.to_s == "r"
|
249
137
|
next
|
250
138
|
end
|
251
139
|
index = index.to_i
|
252
|
-
|
253
|
-
|
140
|
+
|
141
|
+
if (1..vms.size).member?(index)
|
142
|
+
command = rhevm.launch_viewer(index)
|
143
|
+
puts command if options[:print]
|
144
|
+
unless options[:dryrun]
|
145
|
+
pid = Process.fork
|
146
|
+
|
147
|
+
if pid.nil?
|
148
|
+
# In child
|
149
|
+
$stdout.reopen(Tempfile.new("RV-stdout").path, 'w')
|
150
|
+
$stderr.reopen(Tempfile.new("RV-stderr").path, 'w')
|
151
|
+
exec(command)
|
152
|
+
else
|
153
|
+
# In parent
|
154
|
+
Process.detach(pid)
|
155
|
+
end
|
156
|
+
|
157
|
+
end
|
158
|
+
|
159
|
+
puts "Reloading Virtual Machines Selection Menu ..."
|
160
|
+
sleep(2)
|
254
161
|
else
|
255
162
|
puts "ERROR: Your selection #{index} is out of range."
|
256
163
|
end
|
257
164
|
rescue => e
|
258
|
-
puts "There was an error retrieving the Virtual Machines from #{
|
165
|
+
puts "There was an error retrieving the Virtual Machines from #{options[:host]}: #{e.message}"
|
259
166
|
puts e.backtrace
|
260
167
|
exit 1
|
261
168
|
end
|
262
169
|
end
|
263
|
-
|
170
|
+
|
264
171
|
exit 0
|
265
172
|
|
266
173
|
|
@@ -0,0 +1,139 @@
|
|
1
|
+
# Copyright 2013 Red Hat Inc.
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
require 'rubygems'
|
16
|
+
require 'rest_client'
|
17
|
+
require 'xmlsimple'
|
18
|
+
require 'tmpdir' # required to download the certificate files on they fly
|
19
|
+
require 'net/http'
|
20
|
+
require 'highline/import' # Secure Password Prompting if a user does not provide it when the script is called
|
21
|
+
require 'rhev-manager/virtual-machine'
|
22
|
+
|
23
|
+
class RhevManager
|
24
|
+
|
25
|
+
TMP_DIR = Dir.tmpdir
|
26
|
+
|
27
|
+
def initialize(host, user, password)
|
28
|
+
@host = host
|
29
|
+
@user = user
|
30
|
+
@pass = password
|
31
|
+
|
32
|
+
# Create a little helper object that we will use to
|
33
|
+
# make connections to the REST API
|
34
|
+
@rhevm = RestClient::Resource.new(
|
35
|
+
"https://" + @host,
|
36
|
+
:user => @user,
|
37
|
+
:password => @pass,
|
38
|
+
:ssl_ca_cert => @cert,
|
39
|
+
:ssl_version => "SSLv3",
|
40
|
+
:verify_ssl => OpenSSL::SSL::VERIFY_NONE)
|
41
|
+
get_cert
|
42
|
+
end
|
43
|
+
|
44
|
+
def get_cert()
|
45
|
+
# download the certificate file on the fly
|
46
|
+
begin
|
47
|
+
cert = File.new(TMP_DIR + "/" + @host + ".crt", "w+")
|
48
|
+
Net::HTTP.start(@host) do |http|
|
49
|
+
begin
|
50
|
+
http.request_get('/ca.crt') do |resp|
|
51
|
+
resp.read_body do |segment|
|
52
|
+
cert.write(segment)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
ensure
|
56
|
+
cert.close()
|
57
|
+
end
|
58
|
+
end
|
59
|
+
@cert = cert.path
|
60
|
+
rescue => e
|
61
|
+
raise "There has been an error downloading the certificate file from #{@host}: #{e.message}"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def get_vms()
|
66
|
+
@vms = Array.new # Clear out array
|
67
|
+
# get the vms api and get the list of vms
|
68
|
+
vms_data = XmlSimple.xml_in(@rhevm["/api/vms"].get.body, {'ForceArray' => false})
|
69
|
+
|
70
|
+
# Iterate through the VM's and get all the
|
71
|
+
# required information
|
72
|
+
vms_data['vm'].each do |vm|
|
73
|
+
# Making sure we only consider VM's that are in state up (so they do have a console to connect to)
|
74
|
+
# and that have the spice protocol enabled as the connection mode
|
75
|
+
if vm['status']['state'] == "up" && vm['display']['type'] == "spice"
|
76
|
+
@vms.push(VirtualMachine.new(vm))
|
77
|
+
end
|
78
|
+
end
|
79
|
+
return @vms
|
80
|
+
end
|
81
|
+
|
82
|
+
def launch_viewer(index)
|
83
|
+
vm = @vms[index-1]
|
84
|
+
|
85
|
+
# let us no gather the host subject
|
86
|
+
hosts_data = XmlSimple.xml_in(@rhevm["/api/hosts/"+vm.host_uuid].get.body, {'ForceArray' => false})
|
87
|
+
host_subject = hosts_data['certificate']['subject']
|
88
|
+
|
89
|
+
ticket_data = XmlSimple.xml_in(@rhevm["/api/vms/" + vm.id + "/ticket"].post("<action><ticket><expiry>30</expiry></ticket></action>", :content_type => 'application/xml').body, {'ForceArray' => false})
|
90
|
+
password = ticket_data['ticket']['value']
|
91
|
+
|
92
|
+
# Creating the .vv File for the connection
|
93
|
+
# download the certificate file on the fly
|
94
|
+
@vv = File.new(TMP_DIR + "/" + vm.name + ".vv", "w+")
|
95
|
+
begin
|
96
|
+
@vv.puts("[virt-viewer]")
|
97
|
+
@vv.puts("type=spice")
|
98
|
+
@vv.puts("host=#{vm.address}")
|
99
|
+
@vv.puts("port=#{vm.port}")
|
100
|
+
@vv.puts("password=#{password}")
|
101
|
+
@vv.puts("tls-port=#{vm.secure_port}")
|
102
|
+
@vv.puts("fullscreen=0")
|
103
|
+
@vv.puts("title=vm:#{vm.name} - %d - Press SHIFT+F12 to Release Cursor")
|
104
|
+
@vv.puts("enable-smartcard=0")
|
105
|
+
@vv.puts("enable-usb-autoshare=1")
|
106
|
+
@vv.puts("usb-filter=-1,-1,-1,-1,0")
|
107
|
+
@vv.puts("host-subject=#{host_subject}")
|
108
|
+
@vv.puts("toggle-fullscreen=shift+f11")
|
109
|
+
@vv.puts("release-cursor=shift+f12")
|
110
|
+
ensure
|
111
|
+
@vv.close()
|
112
|
+
end
|
113
|
+
|
114
|
+
# Now that we have all the information we can print the cmd line
|
115
|
+
puts "Console to VM: #{vm.name} state: #{vm.state} is started"
|
116
|
+
|
117
|
+
command = "/Applications/RemoteViewer.app/Contents/MacOS/RemoteViewer --spice-ca-file #{@cert} #{@vv.path}"
|
118
|
+
end
|
119
|
+
|
120
|
+
|
121
|
+
end
|
122
|
+
|
123
|
+
module Helper
|
124
|
+
|
125
|
+
# queries the User for a password
|
126
|
+
def get_password(prompt="RHEV-M Password: ")
|
127
|
+
ask(prompt) { |q| q.echo = "*" }
|
128
|
+
end
|
129
|
+
|
130
|
+
def strip_url(url)
|
131
|
+
# Remove any leading http or https from the host
|
132
|
+
url = url.split("://")[1] if url.include? "://"
|
133
|
+
return url
|
134
|
+
end
|
135
|
+
|
136
|
+
def initialize
|
137
|
+
|
138
|
+
end
|
139
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class VirtualMachine
|
2
|
+
attr_accessor :id, :name, :description, :host_uuid, :state, :port, :secure_port, :address
|
3
|
+
|
4
|
+
def initialize(vm)
|
5
|
+
@id = vm['id']
|
6
|
+
@name = vm['name']
|
7
|
+
@description = vm['description']
|
8
|
+
@address = vm['display']['address'] unless vm['display'].nil?
|
9
|
+
@port = vm['display']['port'] unless vm['display'].nil?
|
10
|
+
@secure_port = vm['display']['secure_port'] unless vm['display'].nil?
|
11
|
+
@state = vm['status']['state'] unless vm['status'].nil?
|
12
|
+
@host_uuid = vm['host']['id'] unless vm['host'].nil?
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
@@ -0,0 +1,60 @@
|
|
1
|
+
.\" generated with Ronn/v0.7.3
|
2
|
+
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
|
+
.
|
4
|
+
.TH "CONSOLE\-LAUNCHER" "1" "May 2013" "" ""
|
5
|
+
.
|
6
|
+
.SH "NAME"
|
7
|
+
\fBconsole\-launcher\fR \- Launch consoles for VM\'s hosted on your RHEV Manager
|
8
|
+
.
|
9
|
+
.SH "SYNOPSIS"
|
10
|
+
\fBconsole\-launcher\fR \-\-host \fIrhevm_hostname\fR \-\-user \fIrhevm_username\fR
|
11
|
+
.
|
12
|
+
.br
|
13
|
+
.
|
14
|
+
.SH "DESCRIPTION"
|
15
|
+
\fBconsole\-launcher\fR is a simple command\-line tool for launching console sessions to your Virtual Machines running in your RHEV Environment\. It utilizes the RHEV\-M REST API to query for the list of VM\'s running\.
|
16
|
+
.
|
17
|
+
.P
|
18
|
+
It will only display Virtual Machines that have the \fBSPICE\fR Protocol selected and that are actually in state \fBup\fR\. After you select a Virtual Machine to connect to it automatically creates a Session Ticket and stores it inside a \.vv File\.
|
19
|
+
.
|
20
|
+
.P
|
21
|
+
All the files necessary to start the console session are created fully automatically for you\. The Ticket that is generated is valid for 30 seconds\. So although the files are stored inside of the temp directory of the system, the credentials in there should not be valid after the script is ended\.
|
22
|
+
.
|
23
|
+
.P
|
24
|
+
The script creates a configuration file \fBUSER_HOME/\.console\-launcher\.rc\.yaml\fR which can be adapted to your environment, to speed up your workflow to start console sessions\.
|
25
|
+
.
|
26
|
+
.SH "OPTIONS"
|
27
|
+
.
|
28
|
+
.TP
|
29
|
+
\fB\-\-print\fR
|
30
|
+
Print the command that is called to launch the Console Session
|
31
|
+
.
|
32
|
+
.TP
|
33
|
+
\fB\-d\fR, \fB\-\-dry\-run\fR
|
34
|
+
Do not execute the command to launch the Console Session\. This can be used for testing purposes\.
|
35
|
+
.
|
36
|
+
.TP
|
37
|
+
\fB\-h\fR, \fB\-\-host HOSTNAME\fR
|
38
|
+
The Hostname of your RHEV\-M Server\. This is the FQDN or IP Address not the URL\.
|
39
|
+
.
|
40
|
+
.TP
|
41
|
+
\fB\-u\fR, \fB\-\-username USERNAME\fR
|
42
|
+
The Username used to establish the connection to \-\-host (defaults to admin@internal)
|
43
|
+
.
|
44
|
+
.TP
|
45
|
+
\fB\-p\fR, \fB\-\-password PASSWORD\fR
|
46
|
+
The Password used to establish the connection to \-\-host
|
47
|
+
.
|
48
|
+
.SH "EXAMPLES"
|
49
|
+
Connect to your RHEV Manager running on rhev\.example\.com\. The username is the default admin@internal\. The password will be asked from the user\.
|
50
|
+
.
|
51
|
+
.IP "" 4
|
52
|
+
.
|
53
|
+
.nf
|
54
|
+
|
55
|
+
$ console\-launcher \-\-host rhev\.example\.com
|
56
|
+
.
|
57
|
+
.fi
|
58
|
+
.
|
59
|
+
.IP "" 0
|
60
|
+
|
@@ -0,0 +1,123 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv='content-type' value='text/html;charset=utf8'>
|
5
|
+
<meta name='generator' value='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'>
|
6
|
+
<title>console-launcher(1) - Launch consoles for VM's hosted on your RHEV Manager</title>
|
7
|
+
<style type='text/css' media='all'>
|
8
|
+
/* style: man */
|
9
|
+
body#manpage {margin:0}
|
10
|
+
.mp {max-width:100ex;padding:0 9ex 1ex 4ex}
|
11
|
+
.mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
|
12
|
+
.mp h2 {margin:10px 0 0 0}
|
13
|
+
.mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
|
14
|
+
.mp h3 {margin:0 0 0 4ex}
|
15
|
+
.mp dt {margin:0;clear:left}
|
16
|
+
.mp dt.flush {float:left;width:8ex}
|
17
|
+
.mp dd {margin:0 0 0 9ex}
|
18
|
+
.mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
|
19
|
+
.mp pre {margin-bottom:20px}
|
20
|
+
.mp pre+h2,.mp pre+h3 {margin-top:22px}
|
21
|
+
.mp h2+pre,.mp h3+pre {margin-top:5px}
|
22
|
+
.mp img {display:block;margin:auto}
|
23
|
+
.mp h1.man-title {display:none}
|
24
|
+
.mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143}
|
25
|
+
.mp h2 {font-size:16px;line-height:1.25}
|
26
|
+
.mp h1 {font-size:20px;line-height:2}
|
27
|
+
.mp {text-align:justify;background:#fff}
|
28
|
+
.mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
|
29
|
+
.mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
|
30
|
+
.mp u {text-decoration:underline}
|
31
|
+
.mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
|
32
|
+
.mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
|
33
|
+
.mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff}
|
34
|
+
.mp b.man-ref {font-weight:normal;color:#434241}
|
35
|
+
.mp pre {padding:0 4ex}
|
36
|
+
.mp pre code {font-weight:normal;color:#434241}
|
37
|
+
.mp h2+pre,h3+pre {padding-left:0}
|
38
|
+
ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
|
39
|
+
ol.man-decor {width:100%}
|
40
|
+
ol.man-decor li.tl {text-align:left}
|
41
|
+
ol.man-decor li.tc {text-align:center;letter-spacing:4px}
|
42
|
+
ol.man-decor li.tr {text-align:right;float:right}
|
43
|
+
</style>
|
44
|
+
</head>
|
45
|
+
<!--
|
46
|
+
The following styles are deprecated and will be removed at some point:
|
47
|
+
div#man, div#man ol.man, div#man ol.head, div#man ol.man.
|
48
|
+
|
49
|
+
The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
|
50
|
+
.man-navigation should be used instead.
|
51
|
+
-->
|
52
|
+
<body id='manpage'>
|
53
|
+
<div class='mp' id='man'>
|
54
|
+
|
55
|
+
<div class='man-navigation' style='display:none'>
|
56
|
+
<a href="#NAME">NAME</a>
|
57
|
+
<a href="#SYNOPSIS">SYNOPSIS</a>
|
58
|
+
<a href="#DESCRIPTION">DESCRIPTION</a>
|
59
|
+
<a href="#OPTIONS">OPTIONS</a>
|
60
|
+
<a href="#EXAMPLES">EXAMPLES</a>
|
61
|
+
</div>
|
62
|
+
|
63
|
+
<ol class='man-decor man-head man head'>
|
64
|
+
<li class='tl'>console-launcher(1)</li>
|
65
|
+
<li class='tc'></li>
|
66
|
+
<li class='tr'>console-launcher(1)</li>
|
67
|
+
</ol>
|
68
|
+
|
69
|
+
<h2 id="NAME">NAME</h2>
|
70
|
+
<p class="man-name">
|
71
|
+
<code>console-launcher</code> - <span class="man-whatis">Launch consoles for VM's hosted on your RHEV Manager</span>
|
72
|
+
</p>
|
73
|
+
|
74
|
+
<h2 id="SYNOPSIS">SYNOPSIS</h2>
|
75
|
+
|
76
|
+
<p><code>console-launcher</code> --host <var>rhevm_hostname</var> --user <var>rhevm_username</var><br /></p>
|
77
|
+
|
78
|
+
<h2 id="DESCRIPTION">DESCRIPTION</h2>
|
79
|
+
|
80
|
+
<p> <strong>console-launcher</strong> is a simple command-line tool for launching console sessions
|
81
|
+
to your Virtual Machines running in your RHEV Environment. It utilizes the RHEV-M REST
|
82
|
+
API to query for the list of VM's running.</p>
|
83
|
+
|
84
|
+
<p> It will only display Virtual Machines that have the <strong>SPICE</strong> Protocol selected and that are
|
85
|
+
actually in state <strong>up</strong>. After you select a Virtual Machine to connect to it automatically creates
|
86
|
+
a Session Ticket and stores it inside a .vv File.</p>
|
87
|
+
|
88
|
+
<p> All the files necessary to start the console session are created fully automatically for you. The
|
89
|
+
Ticket that is generated is valid for 30 seconds. So although the files are stored inside of the temp
|
90
|
+
directory of the system, the credentials in there should not be valid after the script is ended.</p>
|
91
|
+
|
92
|
+
<p> The script creates a configuration file <strong>USER_HOME/.console-launcher.rc.yaml</strong> which can be adapted
|
93
|
+
to your environment, to speed up your workflow to start console sessions.</p>
|
94
|
+
|
95
|
+
<h2 id="OPTIONS">OPTIONS</h2>
|
96
|
+
|
97
|
+
<dl>
|
98
|
+
<dt class="flush"><code>--print</code></dt><dd><p>Print the command that is called to launch the Console Session</p></dd>
|
99
|
+
<dt><code>-d</code>, <code>--dry-run</code></dt><dd><p>Do not execute the command to launch the Console Session. This can be used for testing purposes.</p></dd>
|
100
|
+
<dt><code>-h</code>, <code>--host HOSTNAME</code></dt><dd><p>The Hostname of your RHEV-M Server. This is the FQDN or IP Address not the URL.</p></dd>
|
101
|
+
<dt><code>-u</code>, <code>--username USERNAME</code></dt><dd><p>The Username used to establish the connection to --host (defaults to admin@internal)</p></dd>
|
102
|
+
<dt><code>-p</code>, <code>--password PASSWORD</code></dt><dd><p>The Password used to establish the connection to --host</p></dd>
|
103
|
+
</dl>
|
104
|
+
|
105
|
+
|
106
|
+
<h2 id="EXAMPLES">EXAMPLES</h2>
|
107
|
+
|
108
|
+
<p> Connect to your RHEV Manager running on rhev.example.com. The username is the default admin@internal.
|
109
|
+
The password will be asked from the user.</p>
|
110
|
+
|
111
|
+
<pre><code>$ console-launcher --host rhev.example.com
|
112
|
+
</code></pre>
|
113
|
+
|
114
|
+
|
115
|
+
<ol class='man-decor man-foot man foot'>
|
116
|
+
<li class='tl'></li>
|
117
|
+
<li class='tc'>May 2013</li>
|
118
|
+
<li class='tr'>console-launcher(1)</li>
|
119
|
+
</ol>
|
120
|
+
|
121
|
+
</div>
|
122
|
+
</body>
|
123
|
+
</html>
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: console-launcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.8
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Juergen Hoffmann
|
@@ -11,12 +10,11 @@ authors:
|
|
11
10
|
autorequire:
|
12
11
|
bindir: bin
|
13
12
|
cert_chain: []
|
14
|
-
date: 2013-05-
|
13
|
+
date: 2013-05-25 00:00:00.000000000 Z
|
15
14
|
dependencies:
|
16
15
|
- !ruby/object:Gem::Dependency
|
17
16
|
name: rest-client
|
18
17
|
requirement: !ruby/object:Gem::Requirement
|
19
|
-
none: false
|
20
18
|
requirements:
|
21
19
|
- - ~>
|
22
20
|
- !ruby/object:Gem::Version
|
@@ -24,7 +22,6 @@ dependencies:
|
|
24
22
|
type: :runtime
|
25
23
|
prerelease: false
|
26
24
|
version_requirements: !ruby/object:Gem::Requirement
|
27
|
-
none: false
|
28
25
|
requirements:
|
29
26
|
- - ~>
|
30
27
|
- !ruby/object:Gem::Version
|
@@ -32,7 +29,6 @@ dependencies:
|
|
32
29
|
- !ruby/object:Gem::Dependency
|
33
30
|
name: xml-simple
|
34
31
|
requirement: !ruby/object:Gem::Requirement
|
35
|
-
none: false
|
36
32
|
requirements:
|
37
33
|
- - ~>
|
38
34
|
- !ruby/object:Gem::Version
|
@@ -40,7 +36,6 @@ dependencies:
|
|
40
36
|
type: :runtime
|
41
37
|
prerelease: false
|
42
38
|
version_requirements: !ruby/object:Gem::Requirement
|
43
|
-
none: false
|
44
39
|
requirements:
|
45
40
|
- - ~>
|
46
41
|
- !ruby/object:Gem::Version
|
@@ -48,7 +43,6 @@ dependencies:
|
|
48
43
|
- !ruby/object:Gem::Dependency
|
49
44
|
name: highline
|
50
45
|
requirement: !ruby/object:Gem::Requirement
|
51
|
-
none: false
|
52
46
|
requirements:
|
53
47
|
- - ~>
|
54
48
|
- !ruby/object:Gem::Version
|
@@ -56,11 +50,38 @@ dependencies:
|
|
56
50
|
type: :runtime
|
57
51
|
prerelease: false
|
58
52
|
version_requirements: !ruby/object:Gem::Requirement
|
59
|
-
none: false
|
60
53
|
requirements:
|
61
54
|
- - ~>
|
62
55
|
- !ruby/object:Gem::Version
|
63
56
|
version: 1.6.19
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: rake
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
type: :development
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ! '>='
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: rdoc
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
type: :development
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - ! '>='
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '0'
|
64
85
|
description: This gem provides the ability to launch console sessions on Mac
|
65
86
|
email:
|
66
87
|
- buddy@redhat.com
|
@@ -71,21 +92,25 @@ executables:
|
|
71
92
|
extensions: []
|
72
93
|
extra_rdoc_files: []
|
73
94
|
files:
|
95
|
+
- lib/console-launcher.rb
|
96
|
+
- lib/console-launcher_version.rb
|
97
|
+
- lib/rhev-manager/virtual-machine.rb
|
74
98
|
- bin/console-launcher
|
99
|
+
- man/console-launcher.1.html
|
100
|
+
- man/console-launcher.1
|
75
101
|
homepage: https://github.com/juhoffma/rhev-console-launcher
|
76
102
|
licenses: []
|
103
|
+
metadata: {}
|
77
104
|
post_install_message:
|
78
105
|
rdoc_options: []
|
79
106
|
require_paths:
|
80
107
|
- lib
|
81
108
|
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
109
|
requirements:
|
84
110
|
- - ! '>='
|
85
111
|
- !ruby/object:Gem::Version
|
86
112
|
version: '0'
|
87
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
-
none: false
|
89
114
|
requirements:
|
90
115
|
- - ! '>='
|
91
116
|
- !ruby/object:Gem::Version
|
@@ -93,8 +118,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
118
|
requirements:
|
94
119
|
- RemoteViewer - get it from http://people.freedesktop.org/~teuf/spice-gtk-osx/dmg/0.3.1/
|
95
120
|
rubyforge_project:
|
96
|
-
rubygems_version:
|
121
|
+
rubygems_version: 2.0.3
|
97
122
|
signing_key:
|
98
|
-
specification_version:
|
123
|
+
specification_version: 4
|
99
124
|
summary: RHEV-M Console Launcher
|
100
125
|
test_files: []
|