rhc 0.91.12 → 0.92.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.
- data/Rakefile +2 -15
- data/bin/rhc-app +1 -5
- data/bin/rhc-create-app +3 -26
- data/bin/rhc-create-domain +2 -2
- data/lib/rhc-common.rb +54 -6
- metadata +23 -23
data/Rakefile
CHANGED
@@ -21,9 +21,9 @@ spec = Gem::Specification.new do |s|
|
|
21
21
|
s.version = /(Version: )(.*)/.match(File.read("client.spec"))[2]
|
22
22
|
s.author = "Red Hat"
|
23
23
|
s.email = %q{openshift@redhat.com}
|
24
|
-
s.summary = %q{OpenShift
|
24
|
+
s.summary = %q{OpenShift Client Tools}
|
25
25
|
s.homepage = %q{https://openshift.redhat.com/app/express}
|
26
|
-
s.description = %q{The client tools for the OpenShift
|
26
|
+
s.description = %q{The client tools for the OpenShift platform that allow for application management.}
|
27
27
|
s.files = FileList['lib/**/*.rb', 'lib/rhc', 'bin/*', 'conf/*'].to_a
|
28
28
|
s.files += %w(LICENSE COPYRIGHT README.md Rakefile)
|
29
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']
|
@@ -37,19 +37,6 @@ spec = Gem::Specification.new do |s|
|
|
37
37
|
# - json_pure (Ruby (Ruby 1.8.6, Windows, Mac) / json (everything else)
|
38
38
|
# http://en.wikibooks.org/wiki/Ruby_Programming/RubyGems
|
39
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
|
53
40
|
end
|
54
41
|
|
55
42
|
# Define a :package task that bundles the gem
|
data/bin/rhc-app
CHANGED
@@ -50,7 +50,7 @@ List of arguments
|
|
50
50
|
-a|--app application Application name (alphanumeric - max #{RHC::APP_NAME_MAX_LENGTH} chars) (required)
|
51
51
|
-t|--type type Type of app to create (#{type_keys}) (required for creating an application)
|
52
52
|
-c|--cartridge cartridge The embedded cartrige to manage (required for the cartridge command)
|
53
|
-
-g|--gear-size size The size of the gear for this app ([small|medium
|
53
|
+
-g|--gear-size size The size of the gear for this app ([small|medium], defaults to small)
|
54
54
|
-s|--scaling Enable scaling for this app
|
55
55
|
-r|--repo path Git Repo path (defaults to ./$app_name)
|
56
56
|
-n|--nogit Only create remote space, don't pull it locally
|
@@ -172,10 +172,6 @@ currently being created: '#{$opt['app']}'
|
|
172
172
|
end
|
173
173
|
|
174
174
|
$opt['gear-size']='small' unless $opt['gear-size']
|
175
|
-
if !['small','medium','large'].include? $opt['gear-size']
|
176
|
-
puts "Invalid gear size: %s" % $opt['gear-size']
|
177
|
-
p_usage
|
178
|
-
end
|
179
175
|
|
180
176
|
$opt['repo'] = $opt['app'] unless $opt['repo']
|
181
177
|
|
data/bin/rhc-create-app
CHANGED
@@ -1,24 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require 'rhc-common'
|
3
3
|
|
4
|
-
# FIXME: get better descriptions from runtime or docs team
|
5
|
-
$gear_size_order = ['small', 'medium', 'large']
|
6
|
-
$valid_gear_sizes = {'small' => 'allocates the standard resources for your application (default)',
|
7
|
-
'medium' => 'allocates a medium chunk of resources for your application',
|
8
|
-
'large' => 'allocates a larger chunk of resources for your application'
|
9
|
-
}
|
10
|
-
|
11
|
-
def p_valid_gear_sizes(invalid_gear_size)
|
12
|
-
puts "Invalid gear size #{invalid_gear_size}"
|
13
|
-
puts "Valid options are:"
|
14
|
-
puts ""
|
15
|
-
$gear_size_order.each do |gear_size|
|
16
|
-
puts " #{gear_size} - #{$valid_gear_sizes[gear_size]}"
|
17
|
-
end
|
18
|
-
|
19
|
-
exit 255
|
20
|
-
end
|
21
|
-
|
22
4
|
def p_usage(error_code = 255)
|
23
5
|
libra_server = get_var('libra_server')
|
24
6
|
rhlogin = get_var('default_rhlogin') ? "Default: #{get_var('default_rhlogin')}" : "required"
|
@@ -30,7 +12,7 @@ Create an OpenShift app.
|
|
30
12
|
|
31
13
|
-a|--app application Application name (alphanumeric - max #{RHC::APP_NAME_MAX_LENGTH} chars) (required)
|
32
14
|
-t|--type type Type of app to create (#{type_keys}) (required)
|
33
|
-
-g|--gear-size size The size of the gear for this app ([small|medium
|
15
|
+
-g|--gear-size size The size of the gear for this app ([small|medium], defaults to small)
|
34
16
|
-s|--scaling Enable scaling for this app
|
35
17
|
-l|--rhlogin rhlogin Red Hat login (RHN or OpenShift login) (#{rhlogin})
|
36
18
|
-p|--password password RHLogin password (optional, will prompt)
|
@@ -116,13 +98,8 @@ end
|
|
116
98
|
|
117
99
|
# Default gear size is small
|
118
100
|
gear_size = opt['gear-size']
|
119
|
-
if !gear_size
|
120
|
-
|
121
|
-
else
|
122
|
-
if !$valid_gear_sizes.include? gear_size
|
123
|
-
p_valid_gear_sizes gear_size
|
124
|
-
end
|
125
|
-
end
|
101
|
+
gear_size = 'small' if !gear_size
|
102
|
+
|
126
103
|
|
127
104
|
password = opt['password']
|
128
105
|
if !password
|
data/bin/rhc-create-domain
CHANGED
@@ -187,9 +187,9 @@ end
|
|
187
187
|
#
|
188
188
|
|
189
189
|
if File.readable?(ssh_key_file_path)
|
190
|
-
puts "OpenShift
|
190
|
+
puts "OpenShift key found at #{ssh_key_file_path}. Reusing..."
|
191
191
|
else
|
192
|
-
puts "Generating OpenShift
|
192
|
+
puts "Generating OpenShift ssh key to #{ssh_key_file_path}"
|
193
193
|
# Use system for interaction
|
194
194
|
system("ssh-keygen -t rsa -f '#{ssh_key_file_path}'")
|
195
195
|
end
|
data/lib/rhc-common.rb
CHANGED
@@ -439,7 +439,7 @@ module RHC
|
|
439
439
|
namespace = domain.id
|
440
440
|
# Catch errors
|
441
441
|
begin
|
442
|
-
application = domain.add_application(app_name,{:cartridge => app_type, :scale => true})
|
442
|
+
application = domain.add_application(app_name,{:cartridge => app_type, :scale => true, :gear_profile => gear_size})
|
443
443
|
|
444
444
|
# Variables that are needed for the rest of the function
|
445
445
|
app_uuid = application.uuid
|
@@ -668,7 +668,7 @@ To make changes to '#{app_name}', you must first clone it with:
|
|
668
668
|
git clone #{git_url}
|
669
669
|
|
670
670
|
LOOKSGOOD
|
671
|
-
puts "Then run 'git push' to update your OpenShift
|
671
|
+
puts "Then run 'git push' to update your OpenShift space."
|
672
672
|
end
|
673
673
|
end
|
674
674
|
if result && !result.empty?
|
@@ -697,7 +697,7 @@ LOOKSGOOD
|
|
697
697
|
http_post(net_http, url, json_data, password)
|
698
698
|
end
|
699
699
|
|
700
|
-
|
700
|
+
# Runs rhc-list-ports on server to check available ports
|
701
701
|
# :stderr return user-friendly port name, :stdout returns 127.0.0.1:8080 format
|
702
702
|
def self.list_ports(rhc_domain, namespace, app_name, app_uuid, debug=true)
|
703
703
|
|
@@ -709,6 +709,7 @@ LOOKSGOOD
|
|
709
709
|
|
710
710
|
hosts_and_ports = []
|
711
711
|
hosts_and_ports_descriptions = []
|
712
|
+
scaled_uuids = []
|
712
713
|
|
713
714
|
puts ssh_cmd if debug
|
714
715
|
|
@@ -716,25 +717,34 @@ LOOKSGOOD
|
|
716
717
|
|
717
718
|
stdout.each { |line|
|
718
719
|
line = line.chomp
|
719
|
-
if
|
720
|
-
|
720
|
+
if line.downcase =~ /scale/
|
721
|
+
scaled_uuid = line[5..-1]
|
722
|
+
scaled_uuids << scaled_uuid
|
723
|
+
else
|
724
|
+
if ip_and_port_simple_regex.match(line)
|
725
|
+
hosts_and_ports << line
|
726
|
+
end
|
721
727
|
end
|
722
728
|
}
|
723
729
|
|
724
730
|
stderr.each { |line|
|
725
731
|
line = line.chomp
|
726
|
-
|
727
732
|
if line.downcase =~ /permission denied/
|
728
733
|
puts line
|
729
734
|
exit 1
|
730
735
|
end
|
731
736
|
|
737
|
+
|
732
738
|
if line.index(ip_and_port_simple_regex)
|
733
739
|
hosts_and_ports_descriptions << line
|
734
740
|
end
|
735
741
|
}
|
736
742
|
|
737
743
|
}
|
744
|
+
|
745
|
+
scaled_uuids.each { |uuid|
|
746
|
+
list_scaled_ports(rhc_domain, namespace, app_name, uuid, hosts_and_ports, hosts_and_ports_descriptions, debug)
|
747
|
+
}
|
738
748
|
|
739
749
|
#hosts_and_ports_descriptions = stderr.gets.chomp.split(/\n/)
|
740
750
|
#hosts_and_ports = stdout.gets.chomp.split(/\n/)
|
@@ -758,6 +768,44 @@ LOOKSGOOD
|
|
758
768
|
return hosts_and_ports, hosts_and_ports_descriptions
|
759
769
|
|
760
770
|
end
|
771
|
+
|
772
|
+
# Runs rhc-list-ports on server to check available ports
|
773
|
+
# :stderr return user-friendly port name, :stdout returns 127.0.0.1:8080 format
|
774
|
+
def self.list_scaled_ports(rhc_domain, namespace, app_name, app_uuid, hosts_and_ports, hosts_and_ports_descriptions, debug=true)
|
775
|
+
|
776
|
+
ip_and_port_simple_regex = /[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\:[0-9]{1,5}/
|
777
|
+
|
778
|
+
ssh_host = "#{app_name}-#{namespace}.#{rhc_domain}"
|
779
|
+
|
780
|
+
ssh_cmd = "ssh -t #{app_uuid}@#{ssh_host} 'rhc-list-ports'"
|
781
|
+
|
782
|
+
puts ssh_cmd if debug
|
783
|
+
|
784
|
+
Open3.popen3(ssh_cmd) { |stdin, stdout, stderr|
|
785
|
+
|
786
|
+
stdout.each { |line|
|
787
|
+
line = line.chomp
|
788
|
+
|
789
|
+
if ip_and_port_simple_regex.match(line)
|
790
|
+
hosts_and_ports << line
|
791
|
+
end
|
792
|
+
}
|
793
|
+
|
794
|
+
stderr.each { |line|
|
795
|
+
line = line.chomp
|
796
|
+
|
797
|
+
if line.downcase =~ /permission denied/
|
798
|
+
puts line
|
799
|
+
exit 1
|
800
|
+
end
|
801
|
+
|
802
|
+
if line.index(ip_and_port_simple_regex)
|
803
|
+
hosts_and_ports_descriptions << line
|
804
|
+
end
|
805
|
+
}
|
806
|
+
}
|
807
|
+
|
808
|
+
end
|
761
809
|
|
762
810
|
def self.ctl_app(libra_server, net_http, app_name, rhlogin, password, action, embedded=false, framework=nil, server_alias=nil, print_result=true)
|
763
811
|
data = {:action => action,
|
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:
|
4
|
+
hash: 377
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 92
|
9
|
+
- 11
|
10
|
+
version: 0.92.11
|
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-
|
18
|
+
date: 2012-05-11 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: parseconfig
|
@@ -59,7 +59,7 @@ dependencies:
|
|
59
59
|
version: "0"
|
60
60
|
type: :runtime
|
61
61
|
version_requirements: *id003
|
62
|
-
description: The client tools for the OpenShift
|
62
|
+
description: The client tools for the OpenShift platform that allow for application management.
|
63
63
|
email: openshift@redhat.com
|
64
64
|
executables:
|
65
65
|
- rhc
|
@@ -81,31 +81,31 @@ extensions:
|
|
81
81
|
extra_rdoc_files: []
|
82
82
|
|
83
83
|
files:
|
84
|
-
- lib/rhc-
|
85
|
-
- lib/rhc-rest/version.rb
|
84
|
+
- lib/rhc-common.rb
|
86
85
|
- lib/rhc-rest/domain.rb
|
86
|
+
- lib/rhc-rest/application.rb
|
87
87
|
- lib/rhc-rest/cartridge.rb
|
88
88
|
- lib/rhc-rest/client.rb
|
89
|
-
- lib/rhc-rest/
|
89
|
+
- lib/rhc-rest/key.rb
|
90
90
|
- lib/rhc-rest/exceptions/exceptions.rb
|
91
91
|
- lib/rhc-rest/user.rb
|
92
|
-
- lib/rhc-rest/
|
93
|
-
- lib/rhc-
|
92
|
+
- lib/rhc-rest/version.rb
|
93
|
+
- lib/rhc-rest.rb
|
94
94
|
- lib/rhc
|
95
|
-
- bin/rhc-
|
96
|
-
- bin/rhc-app
|
97
|
-
- bin/rhc-create-app
|
98
|
-
- bin/rhc-domain
|
95
|
+
- bin/rhc-user-info
|
99
96
|
- bin/rhc-chk
|
100
|
-
- bin/rhc-create-
|
97
|
+
- bin/rhc-create-app
|
101
98
|
- bin/rhc-domain-info
|
102
|
-
- bin/rhc
|
103
|
-
- bin/rhc-user-info
|
99
|
+
- bin/rhc-ctl-domain
|
104
100
|
- bin/rhc-sshkey
|
105
|
-
- bin/rhc-port-forward
|
106
|
-
- bin/rhc-snapshot
|
107
101
|
- bin/rhc-tail-files
|
108
|
-
- bin/rhc-
|
102
|
+
- bin/rhc-create-domain
|
103
|
+
- bin/rhc-ctl-app
|
104
|
+
- bin/rhc-domain
|
105
|
+
- bin/rhc-snapshot
|
106
|
+
- bin/rhc-app
|
107
|
+
- bin/rhc-port-forward
|
108
|
+
- bin/rhc
|
109
109
|
- conf/express.conf
|
110
110
|
- LICENSE
|
111
111
|
- COPYRIGHT
|
@@ -115,7 +115,7 @@ files:
|
|
115
115
|
homepage: https://openshift.redhat.com/app/express
|
116
116
|
licenses: []
|
117
117
|
|
118
|
-
post_install_message:
|
118
|
+
post_install_message:
|
119
119
|
rdoc_options: []
|
120
120
|
|
121
121
|
require_paths:
|
@@ -144,6 +144,6 @@ rubyforge_project:
|
|
144
144
|
rubygems_version: 1.8.11
|
145
145
|
signing_key:
|
146
146
|
specification_version: 3
|
147
|
-
summary: OpenShift
|
147
|
+
summary: OpenShift Client Tools
|
148
148
|
test_files: []
|
149
149
|
|