rhc 0.84.13 → 0.84.15

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.
Files changed (3) hide show
  1. data/Rakefile +1 -1
  2. metadata +4 -6
  3. data/bin/rhc-port-forward +0 -146
data/Rakefile CHANGED
@@ -24,7 +24,7 @@ spec = Gem::Specification.new do |s|
24
24
  s.description = %q{The client tools for the OpenShift Express platform that allow for application management.}
25
25
  s.files = FileList['lib/**/*.rb', 'bin/*', 'conf/*'].to_a
26
26
  s.files += %w(LICENSE README Rakefile)
27
- s.executables = ['rhc-chk', 'rhc-create-app', 'rhc-create-domain', 'rhc-ctl-domain', 'rhc-ctl-app', 'rhc-snapshot', 'rhc-domain-info', 'rhc-user-info', 'rhc-tail-files', 'rhc-port-forward']
27
+ s.executables = ['rhc-chk', 'rhc-create-app', 'rhc-create-domain', 'rhc-ctl-domain', 'rhc-ctl-app', 'rhc-snapshot', 'rhc-domain-info', 'rhc-user-info', 'rhc-tail-files']
28
28
  begin
29
29
  # Use Ruby version to target F13, RHEL5, Windows and OSX (assume no Xcode)
30
30
  if ENV['JSON_PURE'] or (RUBY_VERSION == "1.8.6" or RUBY_PLATFORM =~ /mswin/ or RUBY_PLATFORM =~ /darwin/)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rhc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 341
4
+ hash: 337
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 84
9
- - 13
10
- version: 0.84.13
9
+ - 15
10
+ version: 0.84.15
11
11
  platform: ruby
12
12
  authors:
13
13
  - Red Hat
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-01-13 00:00:00 Z
18
+ date: 2012-01-17 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: json_pure
@@ -57,7 +57,6 @@ executables:
57
57
  - rhc-domain-info
58
58
  - rhc-user-info
59
59
  - rhc-tail-files
60
- - rhc-port-forward
61
60
  extensions: []
62
61
 
63
62
  extra_rdoc_files: []
@@ -70,7 +69,6 @@ files:
70
69
  - bin/rhc-create-domain
71
70
  - bin/rhc-domain-info
72
71
  - bin/rhc-user-info
73
- - bin/rhc-port-forward
74
72
  - bin/rhc-snapshot
75
73
  - bin/rhc-tail-files
76
74
  - bin/rhc-ctl-domain
@@ -1,146 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # Copyright 2011 Red Hat, Inc.
3
- #
4
- # Permission is hereby granted, free of charge, to any person
5
- # obtaining a copy of this software and associated documentation files
6
- # (the "Software"), to deal in the Software without restriction,
7
- # including without limitation the rights to use, copy, modify, merge,
8
- # publish, distribute, sublicense, and/or sell copies of the Software,
9
- # and to permit persons to whom the Software is furnished to do so,
10
- # subject to the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be
13
- # included in all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
- # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
- # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19
- # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20
- # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
- # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
- # SOFTWARE.
23
-
24
- require 'rhc-common'
25
-
26
- #
27
- # print help
28
- #
29
- def p_usage
30
- rhlogin = get_var('default_rhlogin') ? "Default: #{get_var('default_rhlogin')}" : "required"
31
- puts <<USAGE
32
-
33
- Usage: #{$0}
34
- Forward remote ports to the workstation
35
-
36
- -l|--rhlogin rhlogin Red Hat login (RHN or OpenShift login with OpenShift Express access) (#{rhlogin})
37
- -a|--app Target application (required)
38
- -p|--password password RHLogin password (optional, will prompt)
39
- -d|--debug Print Debug info
40
- -h|--help Show Usage info
41
- --config path Path of alternate config file
42
- --timeout # Timeout, in seconds, for connection
43
-
44
- USAGE
45
- exit 255
46
- end
47
-
48
- begin
49
- opts = GetoptLong.new(
50
- ["--debug", "-d", GetoptLong::NO_ARGUMENT],
51
- ["--help", "-h", GetoptLong::NO_ARGUMENT],
52
- ["--app", "-a", GetoptLong::REQUIRED_ARGUMENT],
53
- ["--rhlogin", "-l", GetoptLong::REQUIRED_ARGUMENT],
54
- ["--config", GetoptLong::REQUIRED_ARGUMENT],
55
- ["--password", "-p", GetoptLong::REQUIRED_ARGUMENT],
56
- ["--timeout", GetoptLong::REQUIRED_ARGUMENT]
57
- )
58
- opt = {}
59
- opts.each do |o, a|
60
- opt[o[2..-1]] = a.to_s
61
- end
62
- rescue Exception => e
63
- #puts e.message
64
- p_usage
65
- end
66
-
67
- # If provided a config path, check it
68
- check_cpath(opt)
69
-
70
- # Pull in configs from files
71
- libra_server = get_var('libra_server')
72
- debug = get_var('debug') == 'false' ? nil : get_var('debug')
73
-
74
- if opt['help'] || !opt['app']
75
- p_usage
76
- end
77
-
78
- if opt['debug']
79
- debug = true
80
- end
81
- RHC::debug(debug)
82
-
83
- RHC::timeout(opt["timeout"] ? opt["timeout"] : get_var('timeout'))
84
-
85
- opt['rhlogin'] = get_var('default_rhlogin') unless opt['rhlogin']
86
-
87
- if !RHC::check_rhlogin(opt['rhlogin'])
88
- p_usage
89
- end
90
-
91
- password = opt['password']
92
- if !password
93
- password = RHC::get_password
94
- end
95
-
96
- user_info = RHC::get_user_info(libra_server, opt['rhlogin'], password, @http, false)
97
-
98
- app_name = opt['app']
99
-
100
- unless user_info['app_info'][app_name]
101
- puts
102
- puts "Could not find app '#{app_name}'. Please run rhc-user-info to get a list"
103
- puts "of your current running applications"
104
- puts
105
- exit 101
106
- end
107
-
108
- app_uuid = user_info['app_info'][app_name]['uuid']
109
- namespace = user_info['user_info']['namespace']
110
- rhc_domain = user_info['user_info']['rhc_domain']
111
-
112
- puts "Checking available ports..."
113
-
114
- hosts_and_ports, hosts_and_ports_descriptions = RHC::list_ports(rhc_domain, namespace, app_name, app_uuid, debug)
115
-
116
- if hosts_and_ports.length == 0
117
- puts
118
- puts "No available ports to forward"
119
- exit 102
120
- end
121
-
122
- puts
123
-
124
- hosts_and_ports_descriptions.each { |description| puts "Binding #{description}..." }
125
-
126
- ssh_cmd = "ssh -N "
127
- hosts_and_ports.each { |port| ssh_cmd << "-L #{port}:#{port} " }
128
- ssh_cmd << "#{app_uuid}@#{app_name}-#{namespace}.#{rhc_domain}"
129
-
130
- puts ssh_cmd if debug
131
- puts
132
- puts "Use ctl + c to stop"
133
-
134
- begin
135
- exec ssh_cmd
136
- rescue SystemCallError
137
- puts
138
- puts "Error trying to forward ports. You can try to forward manually by running:"
139
- puts
140
- puts ssh_cmd
141
- puts
142
- exit 1
143
- end
144
-
145
- # never
146
- exit 1