factor-connector-rackspace 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c7fd97ba1f4dcfffff47b62ea024fa7c6ab5bf0
|
4
|
+
data.tar.gz: f0a851fa2a1b8fe08a558a6b5dfc2b608e434fe1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6809c7e4f1492ad193580dbd68cfb04a3c4866a383e32363694b0a18ec2bbcf454020d9d05780331d222184d61db006e3cd9cd8f5e755dfe70034199dca7994a
|
7
|
+
data.tar.gz: 55ccf88e5e73ad0447f5842e8e8233466245c3142aeb877416c0713de437031c9b1176087fffb1f824809e582ea1ce160836e7e0742ed8bb47a6d6063464098d
|
@@ -78,7 +78,8 @@ Factor::Connector.service 'rackspace_compute' do
|
|
78
78
|
image_id = params['image_id'] || params['image']
|
79
79
|
region = (params['region'] || 'ord').to_sym
|
80
80
|
name = params['name']
|
81
|
-
wait = params['wait']
|
81
|
+
wait = params['wait'] || true
|
82
|
+
key_name = params['key_name']
|
82
83
|
|
83
84
|
fail "Username is required" unless username
|
84
85
|
fail "API Key is required" unless api_key
|
@@ -107,6 +108,7 @@ Factor::Connector.service 'rackspace_compute' do
|
|
107
108
|
image_id: image_id
|
108
109
|
}
|
109
110
|
server_settings[:name] = name if name
|
111
|
+
server_settings[:key_name] = key_name if key_name
|
110
112
|
|
111
113
|
info "Creating server"
|
112
114
|
begin
|
@@ -146,6 +148,7 @@ Factor::Connector.service 'rackspace_compute' do
|
|
146
148
|
fail "API Key is required" unless api_key
|
147
149
|
fail "Flavor ID is required" unless flavor_id
|
148
150
|
fail "Image ID is required" unless image_id
|
151
|
+
fail "Name is required" unless name
|
149
152
|
fail "Private Key is required" unless private_key
|
150
153
|
fail "Public Key is required" unless public_key
|
151
154
|
|
@@ -191,20 +194,13 @@ Factor::Connector.service 'rackspace_compute' do
|
|
191
194
|
}
|
192
195
|
server_settings[:name] = name if name
|
193
196
|
|
194
|
-
info "Creating server"
|
197
|
+
info "Creating server, this can take a few minutes"
|
195
198
|
begin
|
196
199
|
server = compute.servers.bootstrap(server_settings)
|
197
200
|
rescue
|
198
201
|
fail "Failed to create server with provided settings"
|
199
202
|
end
|
200
203
|
|
201
|
-
info "Waiting for the server. This can take a few minutes."
|
202
|
-
begin
|
203
|
-
server.wait_for { ready? }
|
204
|
-
rescue
|
205
|
-
fail "Server creation started, but couldn't get the status"
|
206
|
-
end
|
207
|
-
|
208
204
|
server.reload
|
209
205
|
server_info = server.attributes
|
210
206
|
|
@@ -0,0 +1,174 @@
|
|
1
|
+
require 'factor-connector-api'
|
2
|
+
require 'fog'
|
3
|
+
|
4
|
+
Factor::Connector.service 'rackspace_load_balancers' do
|
5
|
+
action 'list' do |params|
|
6
|
+
username = params['username']
|
7
|
+
api_key = params['api_key']
|
8
|
+
region = (params['region'] || 'ord').to_sym
|
9
|
+
|
10
|
+
fail "Username is required" unless username
|
11
|
+
fail "API Key is required" unless api_key
|
12
|
+
|
13
|
+
balancer_payload = {
|
14
|
+
:rackspace_username => username,
|
15
|
+
:rackspace_api_key => api_key,
|
16
|
+
:rackspace_region => region
|
17
|
+
}
|
18
|
+
|
19
|
+
info "Initializing connection settings"
|
20
|
+
begin
|
21
|
+
fog_wrapper = Fog::Rackspace::LoadBalancers.new balancer_payload
|
22
|
+
rescue
|
23
|
+
fail "Couldn't initialize connection"
|
24
|
+
end
|
25
|
+
|
26
|
+
info "Retrieving list of LoadBalancers"
|
27
|
+
begin
|
28
|
+
load_balancers = fog_wrapper.load_balancers.map { |s| s.attributes }
|
29
|
+
rescue
|
30
|
+
fail "Failed to retrieve LoadBalancers"
|
31
|
+
end
|
32
|
+
|
33
|
+
action_callback load_balancers
|
34
|
+
end
|
35
|
+
|
36
|
+
action 'get' do |params|
|
37
|
+
username = params['username']
|
38
|
+
api_key = params['api_key']
|
39
|
+
region = params['region']
|
40
|
+
load_balancer_id = params['load_balancer_id']
|
41
|
+
|
42
|
+
fail "Username is required" unless username
|
43
|
+
fail "API key is required" unless api_key
|
44
|
+
|
45
|
+
balancer_payload = {
|
46
|
+
:rackspace_username => username,
|
47
|
+
:rackspace_api_key => api_key,
|
48
|
+
:rackspace_region => region
|
49
|
+
}
|
50
|
+
|
51
|
+
info "Initializing connection settings"
|
52
|
+
begin
|
53
|
+
fog_wrapper = Fog::Rackspace::LoadBalancers.new balancer_payload
|
54
|
+
rescue
|
55
|
+
fail "Couldn't initialize connection"
|
56
|
+
end
|
57
|
+
|
58
|
+
info "Getting your LoadBalancer"
|
59
|
+
begin
|
60
|
+
load_balancer = fog_wrapper.get_load_balancer(load_balancer_id)
|
61
|
+
load_balancer_hash = load_balancer.body['loadBalancer']
|
62
|
+
rescue
|
63
|
+
fail "Failed to get your LoadBalancer"
|
64
|
+
end
|
65
|
+
|
66
|
+
action_callback load_balancer_hash
|
67
|
+
end
|
68
|
+
|
69
|
+
action 'delete' do |params|
|
70
|
+
username = params['username']
|
71
|
+
api_key = params['api_key']
|
72
|
+
region = (params['region'] || 'ord').to_sym
|
73
|
+
load_balancer_id = params['load_balancer_id']
|
74
|
+
|
75
|
+
fail "Username is required" unless username
|
76
|
+
fail "API Key is required" unless api_key
|
77
|
+
|
78
|
+
balancer_payload = {
|
79
|
+
:rackspace_username => username,
|
80
|
+
:rackspace_api_key => api_key,
|
81
|
+
:rackspace_region => region
|
82
|
+
}
|
83
|
+
|
84
|
+
info "Initializing connection settings"
|
85
|
+
begin
|
86
|
+
fog_wrapper = Fog::Rackspace::LoadBalancers.new balancer_payload
|
87
|
+
rescue
|
88
|
+
fail "Couldn't initialize connection"
|
89
|
+
end
|
90
|
+
|
91
|
+
info "Deleting LoadBalancer"
|
92
|
+
begin
|
93
|
+
load_balancer = fog_wrapper.delete_load_balancer(load_balancer_id)
|
94
|
+
load_balancer_hash = load_balancer.body['loadBalancer']
|
95
|
+
rescue
|
96
|
+
fail "Failed to delete LoadBalancer"
|
97
|
+
end
|
98
|
+
|
99
|
+
action_callback load_balancer_hash
|
100
|
+
end
|
101
|
+
|
102
|
+
action 'create' do |params|
|
103
|
+
username = params['username']
|
104
|
+
api_key = params['api_key']
|
105
|
+
region = (params['region'] || 'ord').to_sym
|
106
|
+
name = params['name']
|
107
|
+
protocol = params['protocol']
|
108
|
+
port = params['port']
|
109
|
+
ip_type = params['ip_type']
|
110
|
+
algorithm = params['algorithm']
|
111
|
+
|
112
|
+
fail "Username is required" unless username
|
113
|
+
fail "API Key is required" unless api_key
|
114
|
+
|
115
|
+
balancer_payload = {
|
116
|
+
:rackspace_username => username,
|
117
|
+
:rackspace_api_key => api_key,
|
118
|
+
:rackspace_region => region
|
119
|
+
}
|
120
|
+
|
121
|
+
info "Initializing connection settings"
|
122
|
+
begin
|
123
|
+
fog_wrapper = Fog::Rackspace::LoadBalancers.new balancer_payload
|
124
|
+
rescue
|
125
|
+
fail "Couldn't initialize connection"
|
126
|
+
end
|
127
|
+
|
128
|
+
info "Creating LoadBalancer"
|
129
|
+
begin
|
130
|
+
load_balancer = fog_wrapper.create_load_balancer(name, protocol, port, virtual_ips = [{'type' => ip_type}], nodes = nil, options = {:algorithm => algorithm })
|
131
|
+
load_balancer_hash = load_balancer.body['loadBalancer']
|
132
|
+
rescue
|
133
|
+
fail "Failed to create LoadBalancer"
|
134
|
+
end
|
135
|
+
|
136
|
+
action_callback load_balancer_hash
|
137
|
+
end
|
138
|
+
|
139
|
+
action 'add_node' do |params|
|
140
|
+
username = params['username']
|
141
|
+
api_key = params['api_key']
|
142
|
+
region = params['region']
|
143
|
+
load_balancer_id = params['load_balancer_id']
|
144
|
+
address = params['address']
|
145
|
+
port = params['port']
|
146
|
+
condition = params['condition']
|
147
|
+
|
148
|
+
fail "Username is required" unless username
|
149
|
+
fail "API Key is required" unless api_key
|
150
|
+
|
151
|
+
balancer_payload = {
|
152
|
+
:rackspace_username => username,
|
153
|
+
:rackspace_api_key => api_key,
|
154
|
+
:rackspace_region => region
|
155
|
+
}
|
156
|
+
|
157
|
+
info "Initializing connection settings"
|
158
|
+
begin
|
159
|
+
fog_wrapper = Fog::Rackspace::LoadBalancers.new balancer_payload
|
160
|
+
rescue
|
161
|
+
fail "Couldn't initialize connection"
|
162
|
+
end
|
163
|
+
|
164
|
+
info "Adding node"
|
165
|
+
begin
|
166
|
+
load_balancer = fog_wrapper.create_node(load_balancer_id, address, port, condition, options = {})
|
167
|
+
load_balancer_hash = load_balancer.body
|
168
|
+
rescue
|
169
|
+
info "Failed to add node"
|
170
|
+
end
|
171
|
+
|
172
|
+
action_callback load_balancer_hash
|
173
|
+
end
|
174
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: factor-connector-rackspace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Maciej Skierkowski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: factor-connector-api
|
@@ -104,6 +104,7 @@ files:
|
|
104
104
|
- lib/factor/connector/rackspace_compute.rb
|
105
105
|
- lib/factor/connector/rackspace_compute_flavors.rb
|
106
106
|
- lib/factor/connector/rackspace_compute_images.rb
|
107
|
+
- lib/factor/connector/rackspace_loadbalancers.rb
|
107
108
|
homepage: https://factor.io
|
108
109
|
licenses: []
|
109
110
|
metadata: {}
|