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.
- data/README.md +75 -0
- data/Rakefile +27 -11
- data/bin/rhc +8 -8
- data/bin/rhc-app +18 -12
- data/bin/rhc-chk +11 -6
- data/bin/rhc-create-app +10 -10
- data/bin/rhc-create-domain +10 -10
- data/bin/rhc-ctl-app +9 -10
- data/bin/rhc-ctl-domain +6 -8
- data/bin/rhc-domain +17 -10
- data/bin/rhc-domain-info +10 -10
- data/bin/rhc-port-forward +10 -10
- data/bin/rhc-snapshot +10 -10
- data/bin/rhc-sshkey +18 -12
- data/bin/rhc-tail-files +10 -10
- data/bin/rhc-user-info +2 -4
- data/ext/mkrf_conf.rb +54 -15
- data/lib/rhc-common.rb +27 -9
- data/lib/rhc-rest.rb +159 -0
- data/lib/rhc-rest/application.rb +82 -0
- data/lib/rhc-rest/cartridge.rb +64 -0
- data/lib/rhc-rest/client.rb +123 -0
- data/lib/rhc-rest/domain.rb +65 -0
- data/lib/rhc-rest/exceptions/exceptions.rb +73 -0
- data/lib/rhc-rest/key.rb +34 -0
- data/lib/rhc-rest/user.rb +41 -0
- data/lib/rhc-rest/version.rb +5 -0
- metadata +31 -24
- data/README +0 -69
@@ -0,0 +1,73 @@
|
|
1
|
+
module Rhc
|
2
|
+
module Rest
|
3
|
+
class BaseException < RuntimeError
|
4
|
+
attr_reader :code
|
5
|
+
def initialize(message=nil, code=nil)
|
6
|
+
super(message)
|
7
|
+
@code = code
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
#Exceptions thrown in case of an HTTP 5xx is received.
|
12
|
+
class ServerErrorException < Rhc::Rest::BaseException; end
|
13
|
+
|
14
|
+
#Exceptions thrown in case of an HTTP 503 is received.
|
15
|
+
#
|
16
|
+
#503 Service Unavailable
|
17
|
+
#
|
18
|
+
#The server is currently unable to handle the request due to a temporary
|
19
|
+
#overloading or maintenance of the server. The implication is that this
|
20
|
+
#is a temporary condition which will be alleviated after some delay.
|
21
|
+
|
22
|
+
class ServiceUnavailableException < Rhc::Rest::ServerErrorException; end
|
23
|
+
|
24
|
+
#Exceptions thrown in case of an HTTP 4xx is received with the exception
|
25
|
+
#of 401, 403, 403 and 422 where a more sepcific exception is thrown
|
26
|
+
#
|
27
|
+
#HTTP Error Codes 4xx
|
28
|
+
#
|
29
|
+
#The 4xx class of status code is intended for cases in which the client
|
30
|
+
#seems to have errored.
|
31
|
+
|
32
|
+
|
33
|
+
class ClientErrorException < Rhc::Rest::BaseException; end
|
34
|
+
|
35
|
+
#Exceptions thrown in case of an HTTP 404 is received.
|
36
|
+
#
|
37
|
+
#404 Not Found
|
38
|
+
#
|
39
|
+
#The server has not found anything matching the Request-URI or the
|
40
|
+
#requested resource does not exist
|
41
|
+
class ResourceNotFoundException < Rhc::Rest::ClientErrorException; end
|
42
|
+
|
43
|
+
#Exceptions thrown in case of an HTTP 422 is received.
|
44
|
+
class ValidationException < Rhc::Rest::ClientErrorException
|
45
|
+
attr_reader :field
|
46
|
+
def initialize(message, field=nil)
|
47
|
+
super(message)
|
48
|
+
@field = field
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
#Exceptions thrown in case of an HTTP 403 is received.
|
53
|
+
#
|
54
|
+
#403 Forbidden
|
55
|
+
#
|
56
|
+
#The server understood the request, but is refusing to fulfill it.
|
57
|
+
#Authorization will not help and the request SHOULD NOT be repeated.
|
58
|
+
class RequestDeniedException < Rhc::Rest::ClientErrorException; end
|
59
|
+
|
60
|
+
#Exceptions thrown in case of an HTTP 401 is received.
|
61
|
+
#
|
62
|
+
#401 Unauthorized
|
63
|
+
#
|
64
|
+
#The request requires user authentication. If the request already
|
65
|
+
#included Authorization credentials, then the 401 response indicates
|
66
|
+
#that authorization has been refused for those credentials.
|
67
|
+
class UnAuthorizedException < Rhc::Rest::ClientErrorException; end
|
68
|
+
|
69
|
+
#I/O Exceptions Connection timeouts, Unreachable host, etc
|
70
|
+
class ResourceAccessException < Rhc::Rest::BaseException; end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
data/lib/rhc-rest/key.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
module Rhc
|
2
|
+
module Rest
|
3
|
+
class Key
|
4
|
+
include Rest
|
5
|
+
attr_reader :name, :type, :content
|
6
|
+
def initialize(args)
|
7
|
+
@name = args[:name] || args["name"]
|
8
|
+
@type = args[:type] || args["type"]
|
9
|
+
@content = args[:content] || args["content"]
|
10
|
+
@links = args[:links] || args["links"]
|
11
|
+
end
|
12
|
+
|
13
|
+
# Update Key
|
14
|
+
def update(type, content)
|
15
|
+
logger.debug "Updating key #{self.name}" if @mydebug
|
16
|
+
url = @links['UPDATE']['href']
|
17
|
+
method = @links['UPDATE']['method']
|
18
|
+
payload = {:type => type, :content => content}
|
19
|
+
request = RestClient::Request.new(:url => url, :method => method, :headers => @@headers, :payload => payload)
|
20
|
+
return send(request)
|
21
|
+
end
|
22
|
+
|
23
|
+
#Delete Key
|
24
|
+
def destroy
|
25
|
+
logger.debug "Deleting key #{self.name}" if @mydebug
|
26
|
+
url = @links['DELETE']['href']
|
27
|
+
method = @links['DELETE']['method']
|
28
|
+
request = RestClient::Request.new(:url => url, :method => method, :headers => @@headers)
|
29
|
+
return send(request)
|
30
|
+
end
|
31
|
+
alias :delete :destroy
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module Rhc
|
2
|
+
module Rest
|
3
|
+
class User
|
4
|
+
include Rest
|
5
|
+
attr_reader :login
|
6
|
+
def initialize(args)
|
7
|
+
@login = args[:login] || args["login"]
|
8
|
+
@links = args[:links] || args["links"]
|
9
|
+
end
|
10
|
+
|
11
|
+
#Add Key for this user
|
12
|
+
def add_key(name, content, type)
|
13
|
+
url = @links['ADD_KEY']['href']
|
14
|
+
method = @links['ADD_KEY']['method']
|
15
|
+
payload = {:name => name, :type => type, :content => content}
|
16
|
+
request = RestClient::Request.new(:url => url, :method => method, :headers => @@headers, :payload => payload)
|
17
|
+
return send(request)
|
18
|
+
end
|
19
|
+
|
20
|
+
#Get all Key for this user
|
21
|
+
def keys
|
22
|
+
url = @links['LIST_KEYS']['href']
|
23
|
+
method = @links['LIST_KEYS']['method']
|
24
|
+
request = RestClient::Request.new(:url => url, :method => method, :headers => @@headers)
|
25
|
+
return send(request)
|
26
|
+
end
|
27
|
+
|
28
|
+
#Find Key by name
|
29
|
+
def find_key(name)
|
30
|
+
filtered = Array.new
|
31
|
+
keys.each do |key|
|
32
|
+
#TODO do a regex caomparison
|
33
|
+
if key.name == name
|
34
|
+
filtered.push(key)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
return filtered
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
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:
|
4
|
+
hash: 357
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 91
|
9
|
+
- 11
|
10
|
+
version: 0.91.11
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Red Hat
|
@@ -15,10 +15,10 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-04-
|
18
|
+
date: 2012-04-27 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
name:
|
21
|
+
name: parseconfig
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
24
|
none: false
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
type: :runtime
|
33
33
|
version_requirements: *id001
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
|
-
name:
|
35
|
+
name: rest-client
|
36
36
|
prerelease: false
|
37
37
|
requirement: &id002 !ruby/object:Gem::Requirement
|
38
38
|
none: false
|
@@ -46,19 +46,17 @@ dependencies:
|
|
46
46
|
type: :runtime
|
47
47
|
version_requirements: *id002
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
|
-
name:
|
49
|
+
name: rake
|
50
50
|
prerelease: false
|
51
51
|
requirement: &id003 !ruby/object:Gem::Requirement
|
52
52
|
none: false
|
53
53
|
requirements:
|
54
54
|
- - ">="
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
hash:
|
56
|
+
hash: 3
|
57
57
|
segments:
|
58
58
|
- 0
|
59
|
-
|
60
|
-
- 11
|
61
|
-
version: 0.0.11
|
59
|
+
version: "0"
|
62
60
|
type: :runtime
|
63
61
|
version_requirements: *id003
|
64
62
|
description: The client tools for the OpenShift Express platform that allow for application management.
|
@@ -84,31 +82,40 @@ extra_rdoc_files: []
|
|
84
82
|
|
85
83
|
files:
|
86
84
|
- lib/rhc-common.rb
|
85
|
+
- lib/rhc-rest/domain.rb
|
86
|
+
- lib/rhc-rest/application.rb
|
87
|
+
- lib/rhc-rest/cartridge.rb
|
88
|
+
- lib/rhc-rest/client.rb
|
89
|
+
- lib/rhc-rest/key.rb
|
90
|
+
- lib/rhc-rest/exceptions/exceptions.rb
|
91
|
+
- lib/rhc-rest/user.rb
|
92
|
+
- lib/rhc-rest/version.rb
|
93
|
+
- lib/rhc-rest.rb
|
87
94
|
- lib/rhc
|
88
|
-
- bin/rhc-
|
89
|
-
- bin/rhc-app
|
90
|
-
- bin/rhc-create-app
|
91
|
-
- bin/rhc-domain
|
95
|
+
- bin/rhc-user-info
|
92
96
|
- bin/rhc-chk
|
93
|
-
- bin/rhc-create-
|
97
|
+
- bin/rhc-create-app
|
94
98
|
- bin/rhc-domain-info
|
95
|
-
- bin/rhc
|
96
|
-
- bin/rhc-user-info
|
99
|
+
- bin/rhc-ctl-domain
|
97
100
|
- bin/rhc-sshkey
|
98
|
-
- bin/rhc-port-forward
|
99
|
-
- bin/rhc-snapshot
|
100
101
|
- bin/rhc-tail-files
|
101
|
-
- 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
|
102
109
|
- conf/express.conf
|
103
110
|
- LICENSE
|
104
111
|
- COPYRIGHT
|
105
|
-
- README
|
112
|
+
- README.md
|
106
113
|
- Rakefile
|
107
114
|
- ext/mkrf_conf.rb
|
108
115
|
homepage: https://openshift.redhat.com/app/express
|
109
116
|
licenses: []
|
110
117
|
|
111
|
-
post_install_message:
|
118
|
+
post_install_message: " ===================================================\n rhc-rest is no longer needed as an external gem\n - If it is installed, it will be removed\n - Its libraries are now included in rhc\n - Any applications requiring rhc-rest will \n still function as expected\n ===================================================\n"
|
112
119
|
rdoc_options: []
|
113
120
|
|
114
121
|
require_paths:
|
data/README
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
OpenShift Express (RHC)
|
2
|
-
========
|
3
|
-
|
4
|
-
Please stop by #openshift on irc.freenode.net if you have any questions or
|
5
|
-
comments. Another good resource are the blogs and forums at
|
6
|
-
http://openshift.redhat.com
|
7
|
-
|
8
|
-
|
9
|
-
Quickstart
|
10
|
-
========
|
11
|
-
|
12
|
-
DEPENDENCIES: git
|
13
|
-
openssh-clients
|
14
|
-
ruby (1.8.7 or later)
|
15
|
-
rubygems
|
16
|
-
json_pure gem (native json is fine too)
|
17
|
-
parseconfig gem
|
18
|
-
|
19
|
-
Step 1: Create an rhc domain:
|
20
|
-
|
21
|
-
$ rhc-create-domain -n desirednamespace -l rhlogin
|
22
|
-
|
23
|
-
Step 2: Create an rhc application:
|
24
|
-
|
25
|
-
$ rhc-create-app -l rhlogin -a appname -r /path/to/new/git/repo -t <framework Ex: php-5.3>
|
26
|
-
|
27
|
-
Once that's complete, follow the directions printed at the end of running
|
28
|
-
rhc-create-app
|
29
|
-
|
30
|
-
|
31
|
-
Updating your site
|
32
|
-
========
|
33
|
-
|
34
|
-
Once your site is created, updating it is as simple as making changes to your
|
35
|
-
git repo. Commit them, then push. For example:
|
36
|
-
|
37
|
-
$ edit index.php
|
38
|
-
$ git commit -a -m "what I did"
|
39
|
-
$ git push
|
40
|
-
|
41
|
-
Then just reload your web page to see the changes
|
42
|
-
|
43
|
-
-----------
|
44
|
-
OS X Notes:
|
45
|
-
-----------
|
46
|
-
|
47
|
-
git:
|
48
|
-
OS X 10.6 comes w/ ssh and ruby, but not with git, unless you have
|
49
|
-
Xcode 4.0.x installed (as a developer you should have Xcode anyway).
|
50
|
-
Xcode, however, is not free (unless you are a registered Apple
|
51
|
-
Developer) and costs around $5 from the Apple App Store.
|
52
|
-
|
53
|
-
If you do not have Xcode, you can obtain a pre-packaged version
|
54
|
-
of git from:
|
55
|
-
|
56
|
-
http://code.google.com/p/git-osx-installer/
|
57
|
-
|
58
|
-
Installing git from MacPorts/HomeBrew/Fink/etc requires Xcode.
|
59
|
-
|
60
|
-
Now obtain the client code, either via 'git clone' as above
|
61
|
-
or via the rhc gem.
|
62
|
-
|
63
|
-
json_pure gem:
|
64
|
-
The client tools also make use of JSON as the data set for
|
65
|
-
I/O, and therefore needs the json ruby gem. Unless you have
|
66
|
-
Xcode installed, you will need to install json_pure, which
|
67
|
-
is the 100% ruby version of the JSON gem. If you have Xcode,
|
68
|
-
you can elect to install either json_pure or the native
|
69
|
-
json gem.
|