rhc 0.68.5 → 0.69.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -18,7 +18,7 @@ spec = Gem::Specification.new do |s|
18
18
  s.description = %q{OpenShift Express Client Tools}
19
19
  s.files = FileList['lib/**/*.rb', 'bin/*', 'conf/*'].to_a
20
20
  s.files += %w(LICENSE README Rakefile)
21
- s.executables = ['rhc-create-app', 'rhc-create-domain', 'rhc-ctl-app', 'rhc-snapshot', 'rhc-user-info']
21
+ s.executables = ['rhc-create-app', 'rhc-create-domain', 'rhc-ctl-app', 'rhc-snapshot', 'rhc-user-info', 'rhc-tail-files']
22
22
  s.add_dependency('json')
23
23
  s.add_dependency('parseconfig')
24
24
  end
@@ -110,16 +110,18 @@ end
110
110
 
111
111
  uuid = get_var(opt["rhlogin"])
112
112
  unless uuid
113
- puts "Could not find UUID for #{opt["rhlogin"]}"
113
+ puts "Could not find UUID for '#{opt["rhlogin"]}' in express.conf. Be sure you have successfully ran rhc-create-domain before running rhc-create-app."
114
114
  exit 99
115
115
  end
116
116
 
117
117
  opt["repo"] = opt["app"] unless opt["repo"]
118
118
 
119
- puts ""
120
- puts "Please support the developer preview - let #openshift on freenode know of any"
121
- puts "bugs you find"
122
- puts ""
119
+ puts "
120
+ Found a bug? Post to the forum and we'll get right on it.
121
+ IRC: #openshift on freenode
122
+ Forums: https://www.redhat.com/openshift/forums
123
+
124
+ "
123
125
 
124
126
  #
125
127
  # Confirm local git repo exists
@@ -310,8 +312,8 @@ git_url = "ssh://#{uuid}@#{opt['app']}-#{user_info['user_info']['namespace']}.#{
310
312
  unless opt['nogit']
311
313
  puts "Pulling new repo down"
312
314
 
313
- puts "git clone #{git_url} #{opt['repo']}" if debug
314
- git_pull = `git clone #{git_url} #{opt['repo']}`
315
+ puts "git clone --quiet #{git_url} #{opt['repo']}" if debug
316
+ git_pull = `git clone #{debug ? ' ' : '--quiet '}#{git_url} #{opt['repo']}`
315
317
  if $?.exitstatus != 0
316
318
  puts "Error in git pull"
317
319
  puts git_pull
@@ -38,7 +38,7 @@ Bind a registered rhcloud user to a domain in rhcloud.
38
38
  -n|--namespace namespace Opensift Express namespace (alphanumeric - max #{RHC::Maxdlen} chars) (required)
39
39
  -l|--rhlogin rhlogin Red Hat login (required)
40
40
  -p|--password password RHLogin password (optional, will prompt)
41
- -a|--alter Alter ssh key
41
+ -a|--alter Alter namespace (will change urls) and/or ssh key
42
42
  -d|--debug Print Debug info
43
43
  -h|--help Show Usage info
44
44
 
@@ -127,7 +127,7 @@ if File.readable?(libra_kfile)
127
127
  else
128
128
  puts "Generating Openshift Express ssh key to #{libra_kfile}"
129
129
  # Use system for interaction
130
- system("ssh-keygen -t rsa -f #{libra_kfile}")
130
+ system("ssh-keygen -t rsa -f '#{libra_kfile}'")
131
131
  end
132
132
 
133
133
  ssh_key = File.open(libra_kpfile).gets.chomp.split(' ')[1]
@@ -164,7 +164,7 @@ in #{@local_config_path} which has been created and populated for you.
164
164
 
165
165
  EOF
166
166
  else
167
- puts "RHLogin alteration successful."
167
+ puts "Alteration successful. You can use rhc-user-info to view any url changes."
168
168
  puts
169
169
  end
170
170
  exit 0
@@ -0,0 +1,122 @@
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: rhc-tail-file
34
+ Pull down application snapshot for a user
35
+
36
+ -l|--rhlogin rhlogin RHCloud rhlogin (#{rhlogin})
37
+ -a|--app Target application to snapshot (required)
38
+ -f|--files File glob relative to app (default ./logs/*) (optional)
39
+ -p|--password password RHLogin password (optional, will prompt)
40
+ -d|--debug Print Debug info
41
+ -h|--help Show Usage info
42
+
43
+ USAGE
44
+ exit 255
45
+ end
46
+
47
+ begin
48
+ opts = GetoptLong.new(
49
+ ["--debug", "-d", GetoptLong::NO_ARGUMENT],
50
+ ["--help", "-h", GetoptLong::NO_ARGUMENT],
51
+ ["--app", "-a", GetoptLong::REQUIRED_ARGUMENT],
52
+ ["--files", "-f", GetoptLong::OPTIONAL_ARGUMENT],
53
+ ["--rhlogin", "-l", GetoptLong::REQUIRED_ARGUMENT],
54
+ ["--password", "-p", GetoptLong::OPTIONAL_ARGUMENT]
55
+ )
56
+ opt = {}
57
+ opts.each do |o, a|
58
+ opt[o[2..-1]] = a.to_s
59
+ end
60
+ rescue Exception => e
61
+ #puts e.message
62
+ p_usage
63
+ end
64
+
65
+ # Pull in configs from files
66
+ libra_server = get_var('libra_server')
67
+ debug = get_var('debug') == 'false' ? nil : get_var('debug')
68
+ libra_domain = get_var('libra_domain')
69
+
70
+ libra_kfile = "#{ENV['HOME']}/.ssh/libra_id_rsa"
71
+ libra_kpfile = "#{ENV['HOME']}/.ssh/libra_id_rsa.pub"
72
+
73
+ if opt["help"] || !opt['app']
74
+ p_usage
75
+ end
76
+
77
+ if opt["debug"]
78
+ debug = true
79
+ end
80
+
81
+ opt["rhlogin"] = get_var('default_rhlogin') unless opt["rhlogin"]
82
+
83
+ if !RHC::check_rhlogin(opt['rhlogin'])
84
+ p_usage
85
+ end
86
+
87
+ password = opt['password']
88
+ if !password
89
+ password = RHC::get_password
90
+ end
91
+
92
+ user_info = RHC::get_user_info(libra_server, opt['rhlogin'], password, @http, debug, false)
93
+
94
+ app = opt['app']
95
+
96
+ begin
97
+ framework = user_info['app_info'][app]['framework'].split('-')[0]
98
+ rescue NoMethodError
99
+ puts
100
+ puts "Could not find app '#{opt['app']}'. Please run rhc-user-info to get a list"
101
+ puts "of your current running applications"
102
+ puts
103
+ exit 101
104
+ end
105
+
106
+ opt['files'] = "logs/*" unless opt['files']
107
+ file_glob = "#{framework}/#{opt['app']}/#{opt['files']}"
108
+
109
+ puts "Attempting to tail files: #{file_glob}"
110
+ puts "Use ctl + c to stop"
111
+ puts
112
+ puts "ssh #{user_info['user_info']['uuid']}@#{app}-#{user_info['user_info']['namespace']}.#{libra_domain} 'tail #{file_glob}'" if debug
113
+ system("ssh #{user_info['user_info']['uuid']}@#{app}-#{user_info['user_info']['namespace']}.#{libra_domain} 'tail #{file_glob}'")
114
+ if $?.exitstatus != 0 and $?.exitstatus != 255
115
+ puts
116
+ puts "Error in trying to tail files. You can tail manually by running:"
117
+ puts
118
+ puts "ssh #{user_info['user_info']['uuid']}@#{app}-#{user_info['user_info']['namespace']}.#{libra_domain} 'tail #{file_glob}'`"
119
+ puts
120
+ exit 254
121
+ end
122
+ exit 0
@@ -40,7 +40,8 @@ module RHC
40
40
  TYPES = {
41
41
  'php-5.3.2' => :php,
42
42
  'rack-1.1.0' => :rack,
43
- 'wsgi-3.2.1' => :wsgi
43
+ 'wsgi-3.2.1' => :wsgi,
44
+ 'jbossas-7.0.0' => :jbossas
44
45
  }
45
46
 
46
47
  def self.delay(time, adj=Defaultdelay)
@@ -222,6 +223,16 @@ module RHC
222
223
  end
223
224
  exit exit_code.nil? ? 666 : exit_code
224
225
  end
226
+
227
+ def self.print_response_messages(json_resp)
228
+ messages = json_resp['messages']
229
+ if (messages && !messages.empty?)
230
+ puts ''
231
+ puts 'MESSAGES:'
232
+ puts messages
233
+ puts ''
234
+ end
235
+ end
225
236
 
226
237
  def self.print_response_success(response, debug, always_print_result=false)
227
238
  if debug
@@ -229,11 +240,15 @@ module RHC
229
240
  print_json_body(response, debug)
230
241
  elsif always_print_result
231
242
  print_json_body(response, debug)
243
+ else
244
+ json_resp = JSON.parse(response.body)
245
+ print_response_messages(json_resp)
232
246
  end
233
247
  end
234
248
 
235
249
  def self.print_json_body(response, debug)
236
- json_resp = JSON.parse(response.body);
250
+ json_resp = JSON.parse(response.body)
251
+ print_response_messages(json_resp)
237
252
  exit_code = json_resp['exit_code']
238
253
  if debug
239
254
  if json_resp['debug']
@@ -244,7 +259,7 @@ module RHC
244
259
  puts "Exit Code: #{exit_code}"
245
260
  if (json_resp.length > 3)
246
261
  json_resp.each do |k,v|
247
- if (k != 'results' && k != 'debug' && k != 'exit_code')
262
+ if (k != 'result' && k != 'debug' && k != 'exit_code' && k != 'messages')
248
263
  puts "#{k.to_s}: #{v.to_s}"
249
264
  end
250
265
  end
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: 261
4
+ hash: 269
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 68
9
- - 5
10
- version: 0.68.5
8
+ - 69
9
+ - 3
10
+ version: 0.69.3
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: 2011-05-02 00:00:00 -05:00
18
+ date: 2011-05-12 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -54,6 +54,7 @@ executables:
54
54
  - rhc-ctl-app
55
55
  - rhc-snapshot
56
56
  - rhc-user-info
57
+ - rhc-tail-files
57
58
  extensions: []
58
59
 
59
60
  extra_rdoc_files: []
@@ -61,6 +62,7 @@ extra_rdoc_files: []
61
62
  files:
62
63
  - lib/rhc-common.rb
63
64
  - bin/rhc-create-domain
65
+ - bin/rhc-tail-files
64
66
  - bin/rhc-create-app
65
67
  - bin/rhc-ctl-app
66
68
  - bin/rhc-user-info