rhc 0.90.7 → 0.91.11

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.
@@ -0,0 +1,75 @@
1
+ # OpenShift Command Line Tools (RHC)
2
+
3
+ The OpenShift command line tools allow you to manage your OpenShift
4
+ applications from the command line. The [Getting Started
5
+ guide](https://openshift.redhat.com/app/getting_started) has additional
6
+ info on installing the tool on each supported operating system.
7
+
8
+ Please stop by #openshift on irc.freenode.net if you have any questions or
9
+ comments. For more information about OpenShift, visit https://openshift.redhat.com
10
+ or the OpenShift forum
11
+ https://openshift.redhat.com/community/forums/openshift.
12
+
13
+
14
+ ## Using RHC to create an application
15
+
16
+ DEPENDENCIES:
17
+
18
+ * git
19
+ * openssh-clients
20
+ * ruby (1.8.7 or later)
21
+ * rubygems
22
+ * json_pure gem (native json is fine too)
23
+ * parseconfig gem
24
+
25
+ Step 1: Create a domain to under which your applications will live:
26
+
27
+ $ rhc domain create -n desirednamespace -l rhlogin
28
+
29
+ The name you choose here will form part of your application's public
30
+ URL.
31
+
32
+ Step 2: Create an OpenShift application:
33
+
34
+ $ rhc app create -l rhlogin -a appname -r /path/to/new/git/repo -t <framework Ex: php-5.3>
35
+
36
+ Once that's complete, follow the directions printed at the end of running
37
+ rhc app create
38
+
39
+
40
+ ## Making changes to your application
41
+
42
+ Once your site is created, updating it is as simple as making changes to your
43
+ git repo. Commit them, then push. For example:
44
+
45
+ $ edit index.php
46
+ $ git commit -a -m "what I did"
47
+ $ git push
48
+
49
+ Then just reload your web page to see the changes.
50
+
51
+ ## OS X Notes:
52
+
53
+ git:
54
+ OS X 10.6 comes w/ ssh and ruby, but not with git, unless you have
55
+ Xcode 4.0.x installed (as a developer you should have Xcode anyway).
56
+ Xcode, however, is not free (unless you are a registered Apple
57
+ Developer) and costs around $5 from the Apple App Store.
58
+
59
+ If you do not have Xcode, you can obtain a pre-packaged version
60
+ of git from:
61
+
62
+ http://code.google.com/p/git-osx-installer/
63
+
64
+ Installing git from MacPorts/HomeBrew/Fink/etc requires Xcode.
65
+
66
+ Now obtain the client code, either via 'git clone' as above
67
+ or via the rhc gem.
68
+
69
+ json_pure gem:
70
+ The client tools also make use of JSON as the data set for
71
+ I/O, and therefore needs the json ruby gem. Unless you have
72
+ Xcode installed, you will need to install json_pure, which
73
+ is the 100% ruby version of the JSON gem. If you have Xcode,
74
+ you can elect to install either json_pure or the native
75
+ json gem.
data/Rakefile CHANGED
@@ -3,6 +3,7 @@
3
3
  require 'rubygems'
4
4
  require 'rake'
5
5
  require 'rake/clean'
6
+ require 'rake/testtask'
6
7
 
7
8
  begin
8
9
  require 'rubygems/package_task'
@@ -24,22 +25,31 @@ spec = Gem::Specification.new do |s|
24
25
  s.homepage = %q{https://openshift.redhat.com/app/express}
25
26
  s.description = %q{The client tools for the OpenShift Express platform that allow for application management.}
26
27
  s.files = FileList['lib/**/*.rb', 'lib/rhc', 'bin/*', 'conf/*'].to_a
27
- s.files += %w(LICENSE COPYRIGHT README Rakefile)
28
+ s.files += %w(LICENSE COPYRIGHT README.md Rakefile)
28
29
  s.executables = ['rhc', 'rhc-domain', 'rhc-app', 'rhc-sshkey', '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']
29
- begin
30
- # Use Ruby version to target F13, RHEL5, Windows and OSX (assume no Xcode)
31
- if ENV['JSON_PURE'] or (RUBY_VERSION == "1.8.6" or RUBY_PLATFORM =~ /mswin/ or RUBY_PLATFORM =~ /darwin/)
32
- s.add_dependency('json_pure')
33
- else
34
- s.add_dependency('json')
35
- end
36
- end
37
30
  s.add_dependency('parseconfig')
38
- s.add_dependency('rhc-rest', ">= 0.0.11")
31
+ s.add_dependency("rest-client")
32
+ # This does not need to be added as a dep for the RPM since it is only needed in extension installation
33
+ s.add_dependency('rake')
39
34
 
40
- # This should only affect 1.9 rubies, since it's already included in 1.8
35
+ # Adding install time dependencies for
36
+ # - test-unit (Ruby 1.9)
37
+ # - json_pure (Ruby (Ruby 1.8.6, Windows, Mac) / json (everything else)
41
38
  # http://en.wikibooks.org/wiki/Ruby_Programming/RubyGems
42
39
  s.extensions << 'ext/mkrf_conf.rb'
40
+
41
+ # Leave this message for a few versions, or until we can
42
+ # figure out how to get it only displayed if rhc-rest
43
+ # is installed (taken care of in extension)
44
+ s.post_install_message = <<-MSG
45
+ ===================================================
46
+ rhc-rest is no longer needed as an external gem
47
+ - If it is installed, it will be removed
48
+ - Its libraries are now included in rhc
49
+ - Any applications requiring rhc-rest will
50
+ still function as expected
51
+ ===================================================
52
+ MSG
43
53
  end
44
54
 
45
55
  # Define a :package task that bundles the gem
@@ -55,3 +65,9 @@ end
55
65
 
56
66
  # Add the 'pkg' directory to the clean task
57
67
  CLEAN.include("pkg")
68
+
69
+ Rake::TestTask.new(:test) do |t|
70
+ t.libs << 'test'
71
+ t.test_files = FileList['test/**/*_test.rb']
72
+ t.verbose = true
73
+ end
data/bin/rhc CHANGED
@@ -2,7 +2,7 @@
2
2
  #
3
3
  # print help
4
4
  #
5
- def p_usage
5
+ def p_usage(exit_code = 255)
6
6
  puts <<USAGE
7
7
 
8
8
  Usage: rhc (<resource> | --help) [<command>] [<args>]
@@ -17,7 +17,7 @@ List of resources
17
17
  See 'rhc <resource> --help' for more applicable commands and argumments on a specific resource.
18
18
 
19
19
  USAGE
20
- exit 255
20
+ exit exit_code
21
21
  end
22
22
 
23
23
 
@@ -34,21 +34,21 @@ end
34
34
  case ARGV[0]
35
35
  when "domain"
36
36
  system("rhc-domain #{get_args} 2>&1")
37
- retcode = $?
37
+ retcode = $?.exitstatus
38
38
  when "app"
39
39
  system("rhc-app #{get_args} 2>&1")
40
- retcode = $?
40
+ retcode = $?.exitstatus
41
41
  when "sshkey"
42
42
  system("rhc-sshkey #{get_args} 2>&1")
43
- retcode = $?
43
+ retcode = $?.exitstatus
44
44
  when "port-forward"
45
45
  system("rhc-port-forward #{get_args} 2>&1")
46
- retcode = $?
46
+ retcode = $?.exitstatus
47
47
  when "-h", "--help", "help", nil
48
- p_usage
48
+ p_usage 0
49
49
  else
50
50
  puts "Invalid rhc command: #{ARGV[0]}"
51
51
  p_usage
52
52
  end
53
53
 
54
- exit (retcode != 0 ? 1 : 0)
54
+ exit retcode
@@ -7,7 +7,7 @@ $embed_mapper = { 'add' => 'configure', 'remove' => 'deconfigure' }
7
7
  #
8
8
  # print help
9
9
  #
10
- def p_usage
10
+ def p_usage(exit_code = 255)
11
11
  libra_server = get_var('libra_server')
12
12
  rhlogin = get_var('default_rhlogin') ? "Default: #{get_var('default_rhlogin')}" : "required"
13
13
  type_keys = RHC::get_cartridge_listing(nil, ', ', libra_server, @http, 'standalone', false)
@@ -62,10 +62,10 @@ List of arguments
62
62
  -o|--opts options Options to pass to the server-side (linux based) tail command (applicable to tail command only) (-f is implicit. See the linux tail man page full list of options.) (Ex: --opts '-n 100')
63
63
  --alias alias Specify server alias (when using add/remove-alias)
64
64
  --config path Path of alternate config file
65
- --timeout # Timeout, in seconds, for connection
65
+ --timeout # Timeout, in seconds, for the session
66
66
  --enable-jenkins [name] Indicates to create a Jenkins application (if not already available) and embed the Jenkins client into this application. The default name will be 'jenkins' if not specified. Note that --no-dns is ignored for the creation of the Jenkins application.
67
67
  USAGE
68
- exit 255
68
+ exit exit_code
69
69
  end
70
70
 
71
71
 
@@ -95,8 +95,9 @@ def validate_args(val_type=true, val_cartridge=false, val_timeout=true)
95
95
  debug = $opt["debug"] ? true : false
96
96
  RHC::debug(debug)
97
97
 
98
- RHC::timeout($opt["timeout"] ? $opt["timeout"] : get_var('timeout')) if val_timeout
99
-
98
+ RHC::timeout($opt["timeout"], get_var('timeout')) if val_timeout
99
+ RHC::connect_timeout($opt["timeout"], get_var('timeout')) if val_timeout
100
+
100
101
  $password = $opt['password'] ? $opt['password'] : RHC::get_password
101
102
  end
102
103
 
@@ -541,12 +542,17 @@ begin
541
542
  ["--timeout", GetoptLong::REQUIRED_ARGUMENT]
542
543
  )
543
544
  else
544
- puts "Missing or invalid command!" unless ARGV[0] =~ /^(help|-h|--help)$/
545
- # just exit at this point
546
- # printing the usage description will be handled in the rescue
547
- exit 255
545
+ opts = GetoptLong.new(
546
+ ["--help", "-h", GetoptLong::NO_ARGUMENT]
547
+ )
548
+ unless ARGV[0] =~ /^(help|-h|--help)$/
549
+ puts "Missing or invalid command!" unless ARGV[0] =~ /^(help|-h|--help)$/
550
+ # just exit at this point
551
+ # printing the usage description will be handled in the rescue
552
+ exit 255
553
+ end
548
554
  end
549
-
555
+
550
556
  $opt = {}
551
557
  opts.each do |o, a|
552
558
  $opt[o[2..-1]] = a.to_s
@@ -556,7 +562,7 @@ rescue Exception => e
556
562
  p_usage
557
563
  end
558
564
 
559
- p_usage if $opt["help"]
565
+ p_usage 0 if $opt["help"]
560
566
 
561
567
  case argv_c[0]
562
568
  when "create"
@@ -586,7 +592,7 @@ when "cartridge"
586
592
  p_usage
587
593
  end
588
594
  when "-h", "--help", "help", nil
589
- p_usage
595
+ p_usage 0
590
596
  else
591
597
  puts "Invalid command!"
592
598
  p_usage
@@ -18,7 +18,7 @@ require 'test/unit/ui/console/testrunner'
18
18
  #
19
19
  # print help
20
20
  #
21
- def p_usage
21
+ def p_usage(exit_code = 255)
22
22
  rhlogin = get_var('default_rhlogin') ? "Default: #{get_var('default_rhlogin')}" : "required"
23
23
  puts <<USAGE
24
24
 
@@ -31,10 +31,10 @@ properly setup. Often run to troubleshoot connection issues.
31
31
  -d|--debug Print Debug info
32
32
  -h|--help Show Usage info
33
33
  --config path Path of alternate config file
34
- --timeout # Timeout, in seconds, for connection
34
+ --timeout # Timeout, in seconds, for the session
35
35
 
36
36
  USAGE
37
- exit 255
37
+ exit exit_code
38
38
  end
39
39
 
40
40
  begin
@@ -55,10 +55,13 @@ rescue Exception => e
55
55
  p_usage
56
56
  end
57
57
 
58
- if $opt["help"] || 0 != ARGV.length
59
- p_usage
58
+ if $opt["help"]
59
+ p_usage 0
60
60
  end
61
61
 
62
+ if 0 != ARGV.length
63
+ p_usage
64
+ end
62
65
 
63
66
  # If provided a config path, check it
64
67
  check_cpath($opt)
@@ -81,7 +84,9 @@ if $opt["debug"]
81
84
  end
82
85
  RHC::debug($debug)
83
86
 
84
- RHC::timeout($opt["timeout"] ? $opt["timeout"] : get_var('timeout'))
87
+ RHC::timeout($opt["timeout"], get_var('timeout'))
88
+ RHC::connect_timeout($opt["timeout"], get_var('timeout'))
89
+
85
90
 
86
91
  $opt["rhlogin"] = get_var('default_rhlogin') unless $opt["rhlogin"]
87
92
  if !RHC::check_rhlogin($opt['rhlogin'])
@@ -19,7 +19,7 @@ def p_valid_gear_sizes(invalid_gear_size)
19
19
  exit 255
20
20
  end
21
21
 
22
- def p_usage
22
+ def p_usage(error_code = 255)
23
23
  libra_server = get_var('libra_server')
24
24
  rhlogin = get_var('default_rhlogin') ? "Default: #{get_var('default_rhlogin')}" : "required"
25
25
  type_keys = RHC::get_cartridge_listing(nil, ', ', libra_server, @http, 'standalone', false)
@@ -40,14 +40,14 @@ Create an OpenShift app.
40
40
  -h|--help Show Usage info
41
41
  --no-dns Skip DNS check. Must be used in combination with --nogit
42
42
  --config path Path of alternate config file
43
- --timeout # Timeout, in seconds, for connection
43
+ --timeout # Timeout, in seconds, for the session
44
44
  --enable-jenkins [name] Create a Jenkins application (see Note 1)
45
45
 
46
46
  Notes:
47
47
  1. Jenkins applications will have Jenkins embedded. Their default name will be 'jenkins' if not specified and the '--no-dns' flag is ignored.
48
48
 
49
49
  USAGE
50
- exit 255
50
+ exit error_code
51
51
  end
52
52
 
53
53
  begin
@@ -84,16 +84,16 @@ check_cpath(opt)
84
84
  libra_server = get_var('libra_server')
85
85
  debug = get_var('debug') == 'false' ? nil : get_var('debug')
86
86
 
87
- if opt["help"] || 0 != ARGV.length
88
- p_usage
89
- end
87
+ p_usage 0 if opt["help"]
88
+
89
+ p_usage if 0 != ARGV.length
90
+
91
+ debug = true if opt["debug"]
90
92
 
91
- if opt["debug"]
92
- debug = true
93
- end
94
93
  RHC::debug(debug)
95
94
 
96
- RHC::timeout(opt['timeout'] ? opt['timeout'] : get_var('timeout'))
95
+ RHC::timeout(opt['timeout'], get_var('timeout'))
96
+ RHC::connect_timeout(opt["timeout"], get_var('timeout'))
97
97
 
98
98
  opt['rhlogin'] = get_var('default_rhlogin') unless opt['rhlogin']
99
99
 
@@ -4,7 +4,7 @@ require 'rhc-common'
4
4
  #
5
5
  # print help
6
6
  #
7
- def p_usage
7
+ def p_usage(exit_code = 255)
8
8
  rhlogin = get_var('default_rhlogin') ? "Default: #{get_var('default_rhlogin')}" : "required"
9
9
  puts <<USAGE
10
10
 
@@ -21,10 +21,10 @@ Bind a registered rhcloud user to a domain in rhcloud.
21
21
  -d|--debug Print Debug info
22
22
  -h|--help Show Usage info
23
23
  --config path Path of alternate config file
24
- --timeout # Timeout, in seconds, for connection
24
+ --timeout # Timeout, in seconds, for the session
25
25
 
26
26
  USAGE
27
- exit 255
27
+ exit exit_code
28
28
  end
29
29
 
30
30
  begin
@@ -62,16 +62,16 @@ ssh_pub_key_file_path = get_kpfile(ssh_key_file_path, opt['alter'])
62
62
  ssh_config = "#{ENV['HOME']}/.ssh/config"
63
63
  ssh_config_d = "#{ENV['HOME']}/.ssh/"
64
64
 
65
- if opt["help"] || 0 != ARGV.length
66
- p_usage
67
- end
65
+ p_usage 0 if opt["help"]
66
+ p_usage if 0 != ARGV.length
67
+
68
+
69
+ debug = true if opt["debug"]
68
70
 
69
- if opt["debug"]
70
- debug = true
71
- end
72
71
  RHC::debug(debug)
73
72
 
74
- RHC::timeout(opt["timeout"] ? opt["timeout"] : get_var('timeout'))
73
+ RHC::timeout(opt["timeout"], get_var('timeout'))
74
+ RHC::connect_timeout(opt["timeout"], get_var('timeout'))
75
75
 
76
76
  if !RHC::check_namespace(opt['namespace'])
77
77
  p_usage
@@ -3,7 +3,7 @@ require 'rhc-common'
3
3
 
4
4
  embed_mapper = { 'add' => 'configure', 'remove' => 'deconfigure' }
5
5
 
6
- def p_usage
6
+ def p_usage(exit_code = 255)
7
7
  rhlogin = get_var('default_rhlogin') ? "Default: #{get_var('default_rhlogin')}" : "required"
8
8
  puts <<USAGE
9
9
 
@@ -21,10 +21,10 @@ Control an OpenShift express app
21
21
  -h|--help Show Usage info
22
22
  --alias Specify server alias (when using add/remove-alias)
23
23
  --config path Path of alternate config file
24
- --timeout # Timeout, in seconds, for connection
24
+ --timeout # Timeout, in seconds, for the session
25
25
 
26
26
  USAGE
27
- exit 255
27
+ exit exit_code
28
28
  end
29
29
 
30
30
  def p_embedded_list
@@ -74,16 +74,15 @@ ssh_config_d = "#{ENV['HOME']}/.ssh/"
74
74
  if opt["embedded-list"]
75
75
  p_embedded_list
76
76
  end
77
- if opt["help"] || 0 != ARGV.length
78
- p_usage
79
- end
77
+ p_usage 0 if opt["help"]
78
+ p_usage if 0 != ARGV.length
79
+
80
+ debug = true if opt["debug"]
80
81
 
81
- if opt["debug"]
82
- debug = true
83
- end
84
82
  RHC::debug(debug)
85
83
 
86
- RHC::timeout(opt["timeout"] ? opt["timeout"] : get_var('timeout'))
84
+ RHC::timeout(opt["timeout"], get_var('timeout'))
85
+ RHC::connect_timeout(opt["timeout"], get_var('timeout'))
87
86
 
88
87
  opt["rhlogin"] = get_var('default_rhlogin') unless opt["rhlogin"]
89
88
 
@@ -4,7 +4,7 @@ require 'rhc-common'
4
4
  #
5
5
  # print help
6
6
  #
7
- def p_usage
7
+ def p_usage(exit_code = 255)
8
8
  rhlogin = get_var('default_rhlogin') ? "Default: #{get_var('default_rhlogin')}" : "required"
9
9
  puts <<USAGE
10
10
 
@@ -26,7 +26,7 @@ Manage multiple keys for the registered rhcloud user.
26
26
  -h|--help Show Usage info
27
27
 
28
28
  USAGE
29
- exit 255
29
+ exit exit_code
30
30
  end
31
31
 
32
32
  begin
@@ -68,13 +68,11 @@ libra_server = get_var('libra_server')
68
68
  debug = get_var('debug') == 'false' ? nil : get_var('debug')
69
69
  opt['rhlogin'] = get_var('default_rhlogin') unless opt['rhlogin']
70
70
 
71
- if opt['help'] || 0 != ARGV.length
72
- p_usage
73
- end
71
+ p_usage 0 if opt['help']
72
+ p_usage if 0 != ARGV.length
73
+
74
+ debug = true if opt['debug']
74
75
 
75
- if opt['debug']
76
- debug = true
77
- end
78
76
  RHC::debug(debug)
79
77
 
80
78
  # Validate for no command or multiple commands being specified