forj 1.0.1 → 1.0.2
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.
- checksums.yaml +4 -4
- data/.gitignore +7 -0
- data/.gitreview +4 -0
- data/Gemfile +21 -19
- data/Gemfile.lock +71 -0
- data/bin/forj +126 -83
- data/forj.gemspec +64 -0
- data/{lib → forj}/defaults.yaml +23 -1
- data/lib/appinit.rb +5 -5
- data/lib/build_tmpl/build-env.py +293 -0
- data/lib/cloud_test.rb +121 -0
- data/lib/forj-settings.rb +52 -39
- data/lib/forj/ForjCli.rb +11 -10
- data/lib/forj/ForjCore.rb +8 -6
- data/lib/forj/process/ForjProcess.rb +345 -82
- data/lib/ssh.rb +81 -20
- metadata +110 -80
- data/lib/compute.rb +0 -36
- data/lib/connection.rb +0 -144
- data/lib/down.rb +0 -60
- data/lib/forj-account.rb +0 -294
- data/lib/forj-config.rb +0 -522
- data/lib/helpers.rb +0 -56
- data/lib/lib-forj/lib/core/core.rb +0 -1740
- data/lib/lib-forj/lib/core/definition.rb +0 -441
- data/lib/lib-forj/lib/core/definition_internal.rb +0 -306
- data/lib/lib-forj/lib/core_process/CloudProcess.rb +0 -334
- data/lib/lib-forj/lib/core_process/global_process.rb +0 -406
- data/lib/lib-forj/lib/core_process/network_process.rb +0 -603
- data/lib/lib-forj/lib/lib-forj.rb +0 -37
- data/lib/lib-forj/lib/providers/hpcloud/Hpcloud.rb +0 -419
- data/lib/lib-forj/lib/providers/hpcloud/compute.rb +0 -108
- data/lib/lib-forj/lib/providers/hpcloud/network.rb +0 -117
- data/lib/lib-forj/lib/providers/hpcloud/security_groups.rb +0 -67
- data/lib/lib-forj/lib/providers/templates/compute.rb +0 -42
- data/lib/lib-forj/lib/providers/templates/core.rb +0 -61
- data/lib/lib-forj/lib/providers/templates/network.rb +0 -33
- data/lib/log.rb +0 -162
- data/lib/network.rb +0 -365
- data/lib/repositories.rb +0 -222
- data/lib/security.rb +0 -207
- data/lib/ssh.sh +0 -185
- data/spec/connection_spec.rb +0 -52
- data/spec/forj-config_spec.rb +0 -237
- data/spec/repositories_spec.rb +0 -50
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d95b1a07c10d838de079ed6f1b10dacef00a934
|
4
|
+
data.tar.gz: d0f344da5294bd7af52704da66644be8a1db86e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9effbaa7903c205306c60aace31d50916044526e835dacbb753a459d675cc584f27b30c762394da05502f18cc0fc7c93330a79f48140eaac8714fd53bc47ebc7
|
7
|
+
data.tar.gz: 40ad850f4458fbf69d38ad26425367ed52417a354a5ef326e4caa5af33f78f40332794139a9f38655fe9ef8694f19a955327ee86fec66ed49265fb6ae102b602
|
data/.gitignore
ADDED
data/.gitreview
ADDED
data/Gemfile
CHANGED
@@ -16,24 +16,26 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
|
18
18
|
source 'https://rubygems.org'
|
19
|
-
group(:development, :test) do
|
20
|
-
gem 'rake'
|
21
|
-
gem 'debugger'
|
22
|
-
gem 'byebug'
|
23
|
-
gem 'rspec', "~> 3.1.0", :require => false
|
24
|
-
end
|
25
19
|
|
26
|
-
|
27
|
-
|
28
|
-
gem '
|
29
|
-
gem '
|
30
|
-
gem '
|
31
|
-
gem '
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
gem '
|
36
|
-
gem '
|
37
|
-
gem '
|
38
|
-
gem '
|
20
|
+
gemspec
|
21
|
+
#group(:development, :test) do
|
22
|
+
# gem 'rake'
|
23
|
+
# gem 'debugger'
|
24
|
+
# gem 'byebug'
|
25
|
+
# gem 'rspec', "~> 3.1.0", :require => false
|
26
|
+
#end
|
27
|
+
|
28
|
+
# if updating here, update forj.gemspec as well, to be coherent.
|
29
|
+
#gem 'mime-types','1.25.1'
|
30
|
+
#gem 'excon','0.31.0'
|
31
|
+
#gem 'json','1.7.5'
|
32
|
+
#gem 'nokogiri','1.5.11'
|
33
|
+
#gem 'fog', '1.19.0'
|
34
|
+
#gem 'git', '>=1.2.7'
|
35
|
+
#gem 'rainbow'
|
36
|
+
#gem 'thor', '>=0.16.0'
|
37
|
+
#gem 'highline','>=1.6.21'
|
38
|
+
#gem 'ansi','>=1.4.3'
|
39
|
+
#gem 'encryptor','>=1.3.0'
|
40
|
+
#gem 'bundler', '1.7.3'
|
39
41
|
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
forj (1.0.2)
|
5
|
+
ansi (>= 1.4.3)
|
6
|
+
bundler
|
7
|
+
encryptor (>= 1.3.0)
|
8
|
+
fog (= 1.19.0)
|
9
|
+
git (>= 1.2.7)
|
10
|
+
highline (>= 1.6.21)
|
11
|
+
json (= 1.7.5)
|
12
|
+
lorj (~> 0.2.0)
|
13
|
+
nokogiri (= 1.5.11)
|
14
|
+
thor (>= 0.16.0)
|
15
|
+
|
16
|
+
GEM
|
17
|
+
remote: https://rubygems.org/
|
18
|
+
specs:
|
19
|
+
ansi (1.4.3)
|
20
|
+
builder (3.2.2)
|
21
|
+
diff-lcs (1.2.5)
|
22
|
+
encryptor (1.3.0)
|
23
|
+
excon (0.31.0)
|
24
|
+
fog (1.19.0)
|
25
|
+
builder
|
26
|
+
excon (~> 0.31.0)
|
27
|
+
formatador (~> 0.2.0)
|
28
|
+
mime-types
|
29
|
+
multi_json (~> 1.0)
|
30
|
+
net-scp (~> 1.1)
|
31
|
+
net-ssh (>= 2.1.3)
|
32
|
+
nokogiri (~> 1.5)
|
33
|
+
ruby-hmac
|
34
|
+
formatador (0.2.5)
|
35
|
+
git (1.2.8)
|
36
|
+
highline (1.6.21)
|
37
|
+
json (1.7.5)
|
38
|
+
lorj (0.2.0)
|
39
|
+
ansi (>= 1.4.3)
|
40
|
+
encryptor (= 1.3.0)
|
41
|
+
highline (~> 1.6.21)
|
42
|
+
mime-types (2.4.3)
|
43
|
+
multi_json (1.10.1)
|
44
|
+
net-scp (1.2.1)
|
45
|
+
net-ssh (>= 2.6.5)
|
46
|
+
net-ssh (2.9.1)
|
47
|
+
nokogiri (1.5.11)
|
48
|
+
rake (10.4.2)
|
49
|
+
rspec (3.1.0)
|
50
|
+
rspec-core (~> 3.1.0)
|
51
|
+
rspec-expectations (~> 3.1.0)
|
52
|
+
rspec-mocks (~> 3.1.0)
|
53
|
+
rspec-core (3.1.7)
|
54
|
+
rspec-support (~> 3.1.0)
|
55
|
+
rspec-expectations (3.1.2)
|
56
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
57
|
+
rspec-support (~> 3.1.0)
|
58
|
+
rspec-mocks (3.1.3)
|
59
|
+
rspec-support (~> 3.1.0)
|
60
|
+
rspec-support (3.1.2)
|
61
|
+
ruby-hmac (0.4.0)
|
62
|
+
thor (0.19.1)
|
63
|
+
|
64
|
+
PLATFORMS
|
65
|
+
ruby
|
66
|
+
|
67
|
+
DEPENDENCIES
|
68
|
+
bundler
|
69
|
+
forj!
|
70
|
+
rake (~> 10.0)
|
71
|
+
rspec (~> 3.1.0)
|
data/bin/forj
CHANGED
@@ -16,39 +16,29 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
|
18
18
|
require 'rubygems'
|
19
|
+
#require 'debugger' # Use to debug with Ruby < 2.0
|
20
|
+
#require 'byebug' # Use to debug with Ruby >= 2.0
|
19
21
|
require 'bundler/setup'
|
20
|
-
require 'require_relative'
|
22
|
+
#require 'require_relative'
|
21
23
|
require 'thor'
|
22
24
|
require 'ansi'
|
23
25
|
|
24
26
|
$APP_PATH = File.dirname(__FILE__)
|
25
27
|
$LIB_PATH = File.expand_path(File.join(File.dirname($APP_PATH),'lib'))
|
26
28
|
|
27
|
-
$LOAD_PATH << $LIB_PATH
|
28
|
-
$LOAD_PATH << File.join($LIB_PATH, 'lib-forj', 'lib')
|
29
|
-
|
30
29
|
require 'appinit.rb' # Load generic Application level function
|
31
30
|
|
32
31
|
# Initialize forj paths
|
33
32
|
AppInit::forj_initialize()
|
34
33
|
|
35
|
-
#
|
36
|
-
$FORJ_LOGGER=ForjLog.new()
|
37
|
-
|
38
|
-
require 'forj-config.rb' # Load class ForjConfig and Meta data class variables. Requires Logging to be fully set.
|
39
|
-
require 'forj-account.rb' # Load class ForjAccount
|
40
|
-
require 'connection.rb' # Load class ForjConnection
|
34
|
+
require 'lorj' # Use lorj library for Cloud agnostics feature.
|
41
35
|
|
42
|
-
|
43
|
-
|
36
|
+
PrcLib.app_name = 'forj'
|
37
|
+
PrcLib.app_defaults = 'forj'
|
44
38
|
|
45
|
-
include Down
|
46
|
-
include Ssh
|
47
39
|
require 'forj-settings.rb' # Settings features
|
40
|
+
require 'ssh.rb'
|
48
41
|
|
49
|
-
#require 'debugger' # Use to debug with Ruby < 2.0
|
50
|
-
#require 'byebug' # Use to debug with Ruby >= 2.0
|
51
|
-
require 'lib-forj.rb'
|
52
42
|
|
53
43
|
$LIB_FORJ_DEBUG = 1 # less verbose
|
54
44
|
|
@@ -58,7 +48,7 @@ class ForjThor < Thor
|
|
58
48
|
class_option :debug, :aliases => '-d', :desc => 'Set debug mode'
|
59
49
|
class_option :verbose, :aliases => '-v', :desc => 'Set verbose mode'
|
60
50
|
class_option :config, :aliases => '-c', :desc => 'Path to a different forj config file. By default, use ~/.forj/config.yaml'
|
61
|
-
class_option :
|
51
|
+
class_option :lorj_debug, :desc => "Set lorj debug level verbosity. 1 to 5. Default is one."
|
62
52
|
|
63
53
|
|
64
54
|
desc "help [action]", "Describe available FORJ actions or one specific action"
|
@@ -140,25 +130,17 @@ Maestro/infra bootstrap debugging:"
|
|
140
130
|
test-box will send your local maestro repo to your box, for boot."
|
141
131
|
|
142
132
|
def boot(blueprint, on_or_name, old_accountname = nil, as = nil, old_name = nil)
|
133
|
+
Forj::Settings.common_options(options)
|
143
134
|
|
144
|
-
|
145
|
-
Logging.set_level(Logger::DEBUG) if options[:debug]
|
146
|
-
|
147
|
-
unless options[:libforj_debug].nil?
|
148
|
-
$LIB_FORJ_DEBUG = options[:libforj_debug].to_i
|
149
|
-
Logging.set_level(Logger::DEBUG)
|
150
|
-
end
|
151
|
-
|
152
|
-
oConfig = ForjConfig.new(options[:config])
|
153
|
-
|
135
|
+
oConfig = Lorj::Config.new(options[:config])
|
154
136
|
|
155
137
|
# depreciated: <BluePrint> on <AccountName> as <InstanceName>
|
156
138
|
if old_accountname and as and old_name
|
157
139
|
msg = "The syntax `forj boot '%s' on '%s' as '%s'` is depreciated.\nUse `forj boot '%s' '%s'" % [blueprint, old_accountname, old_name, blueprint, old_name]
|
158
140
|
if oConfig.get('account_name') == old_accountname
|
159
|
-
|
141
|
+
PrcLib.warning("%s` instead." % msg)
|
160
142
|
else
|
161
|
-
|
143
|
+
PrcLib.warning("%s -a '%s'` instead." % [msg, old_accountname])
|
162
144
|
end
|
163
145
|
name = old_name
|
164
146
|
oConfig.set(:account_name, old_accountname)
|
@@ -166,36 +148,36 @@ Maestro/infra bootstrap debugging:"
|
|
166
148
|
name = on_or_name
|
167
149
|
end
|
168
150
|
|
169
|
-
|
151
|
+
PrcLib.fatal( 1, "instance name '%s' not supported. Support only lower case, numeric and dash caracters." % [name]) if not (/^[\d[[:lower:]]-]+$/ =~ name)
|
170
152
|
|
171
153
|
# Options are added if they are set. Otherwise, get will retrieve the default value.
|
172
154
|
oConfig.set(:account_name, options[:account_name]) if options[:account_name]
|
173
|
-
oForjAccount =
|
155
|
+
oForjAccount = Lorj::Account.new(oConfig)
|
174
156
|
oForjAccount.ac_load()
|
175
157
|
|
176
158
|
oConfig.set(:infra_repo, options[:infra])
|
177
159
|
oConfig.set(:keypair_name, options[:key_name])
|
178
160
|
oConfig.set(:keypair_path, options[:key_path])
|
179
161
|
oConfig.set(:security_group, options[:security_group])
|
180
|
-
oConfig.set(:image_name, options[:
|
162
|
+
oConfig.set(:image_name, options[:image_name])
|
181
163
|
oConfig.set(:flavor, options[:maestro_flavor])
|
182
164
|
oConfig.set(:bp_flavor, options[:bp_flavor])
|
183
165
|
oConfig.set(:maestro_repo , options[:maestro_repo])
|
184
166
|
oConfig.set(:branch , options[:branch])
|
185
167
|
oConfig.set(:test_box, File.expand_path(options[:test_box])) if options[:test_box] and File.directory?(File.expand_path(options[:test_box]))
|
186
168
|
|
187
|
-
|
169
|
+
PrcLib.warning("test_box is currently disabled in this version. It will be re-activated in newer version.") if options[:test_box]
|
188
170
|
|
189
171
|
if options[:key_path]
|
190
172
|
mFound = options[:key_path].match(/^(.*)(\.pub)?$/)
|
191
173
|
if mFound
|
192
174
|
key_path = File.expand_path(mFound[1])
|
193
175
|
if mFound[2] and not File.exists?(File.expand_path(mFound[1]+mFound[2]))
|
194
|
-
|
176
|
+
PrcLib.fatal(1, "'%s' is not a valid keypair files. At least the public key (.pub) is have to exist.")
|
195
177
|
end
|
196
178
|
oConfig.set(:keypair_path, key_path)
|
197
179
|
else
|
198
|
-
|
180
|
+
PrcLib.fatal(1, "'%s' is not a valid keypair files. At least the public key (.pub) is have to exist.")
|
199
181
|
end
|
200
182
|
end
|
201
183
|
aProcesses = []
|
@@ -208,21 +190,21 @@ Maestro/infra bootstrap debugging:"
|
|
208
190
|
# boot/down/ssh/...
|
209
191
|
aProcesses << File.join($LIB_PATH, 'forj', 'ForjCli.rb')
|
210
192
|
|
211
|
-
oCloud = ForjCloud.new(oForjAccount, oConfig[:account_name], aProcesses)
|
193
|
+
#oCloud = ForjCloud.new(oForjAccount, oConfig[:account_name], aProcesses)
|
194
|
+
oCloud = Lorj::CloudCore.new(oForjAccount, oConfig[:account_name], aProcesses)
|
212
195
|
|
213
196
|
oConfig[:instance_name] = name
|
214
197
|
|
215
198
|
if blueprint == 'maestro'
|
216
|
-
|
199
|
+
PrcLib.info("Starting boot process of '%s'. No blueprint requested." % oConfig[:instance_name])
|
217
200
|
else
|
218
201
|
oConfig[:blueprint] = blueprint
|
219
|
-
|
202
|
+
PrcLib.info("Starting boot process of '%s' with blueprint '%s'." % [oConfig[:instance_name], oConfig[:blueprint]])
|
220
203
|
end
|
221
204
|
|
222
|
-
|
205
|
+
PrcLib.high_level_msg ("Preparing your forge '%s'. Please be patient. more output in '%s'\n" % [oConfig[:instance_name], File.join($FORJ_DATA_PATH, "forj.log")])
|
223
206
|
|
224
207
|
oCloud.Create(:forge)
|
225
|
-
#Boot.boot(blueprint, name, options[:build], options[:boothook], options[:box_name], oForjAccount)
|
226
208
|
end
|
227
209
|
|
228
210
|
################################# Show defaults
|
@@ -237,16 +219,18 @@ queriable Objects:
|
|
237
219
|
LONGDESC
|
238
220
|
|
239
221
|
def show(object, name = nil)
|
222
|
+
Settings.common_options(options)
|
223
|
+
|
240
224
|
case object
|
241
225
|
when 'defaults'
|
242
|
-
oConfig=
|
226
|
+
oConfig=Lorj::Config.new()
|
243
227
|
|
244
228
|
puts 'List of default values: (local refer to your config file. hash refer to your FORJ account data)'
|
245
229
|
puts oConfig.default_dump().to_yaml
|
246
230
|
puts '---'
|
247
|
-
puts "To change default values,
|
231
|
+
puts "To change default values, use 'forj get' to check valid keys, and update with 'forj set'"
|
248
232
|
when 'account'
|
249
|
-
oConfig=
|
233
|
+
oConfig=Lorj::Config.new()
|
250
234
|
if not name
|
251
235
|
puts "List of FORJ accounts: Use 'forj account YourAccount' to see one account details."
|
252
236
|
oAccounts = ForjAccounts.new()
|
@@ -263,28 +247,85 @@ queriable Objects:
|
|
263
247
|
end
|
264
248
|
|
265
249
|
else
|
266
|
-
|
250
|
+
PrcLib.error("object '%s' unknown." % name)
|
267
251
|
end
|
268
252
|
end
|
269
253
|
|
270
|
-
#################################
|
271
|
-
desc '
|
254
|
+
################################# DESTROY
|
255
|
+
desc 'destroy <InstanceName> [options]', 'delete the Maestro box and all systems installed by the blueprint'
|
272
256
|
long_desc <<-LONGDESC
|
273
|
-
This action all servers
|
257
|
+
This action destroy all servers found under the instance name and allow you to destroy all of them or just one of them.
|
274
258
|
|
275
|
-
Warning! This action
|
259
|
+
Warning! This action do not remove any network/security groups cloud object.
|
276
260
|
LONGDESC
|
277
261
|
|
278
|
-
|
279
|
-
|
280
|
-
|
262
|
+
method_option :force, :aliases => "-f", :desc => "force deletion of all servers for the given InstanceName"
|
263
|
+
|
264
|
+
def destroy(name)
|
265
|
+
Forj::Settings.common_options(options)
|
281
266
|
|
282
|
-
oConfig =
|
267
|
+
oConfig = Lorj::Config.new(options[:config])
|
283
268
|
oConfig.set(:account_name, options[:account_name]) if options[:account_name]
|
284
|
-
oForjAccount =
|
269
|
+
oForjAccount = Lorj::Account.new(oConfig)
|
285
270
|
oForjAccount.ac_load()
|
286
271
|
|
287
|
-
|
272
|
+
aProcesses = []
|
273
|
+
|
274
|
+
# Defines how to manage Maestro and forges
|
275
|
+
# create a maestro box. Identify a forge instance, delete it,...
|
276
|
+
aProcesses << File.join($LIB_PATH, 'forj', 'ForjCore.rb')
|
277
|
+
|
278
|
+
# Defines how cli will control FORJ features
|
279
|
+
# boot/down/ssh/...
|
280
|
+
aProcesses << File.join($LIB_PATH, 'forj', 'ForjCli.rb')
|
281
|
+
|
282
|
+
oCloud = Lorj::CloudCore.new(oForjAccount, oConfig[:account_name], aProcesses)
|
283
|
+
|
284
|
+
oForge = oCloud.Get(:forge, name)
|
285
|
+
|
286
|
+
if oForge[:servers].count > 0
|
287
|
+
|
288
|
+
if options[:force]
|
289
|
+
#Destroy all servers found
|
290
|
+
oCloud.Delete(:forge)
|
291
|
+
else
|
292
|
+
#Ask the user to get server(s) to destroy
|
293
|
+
serverList = []
|
294
|
+
index = 0
|
295
|
+
|
296
|
+
oForge[:servers].each{ |server|
|
297
|
+
serverList[index] = server[:name]
|
298
|
+
index = index + 1
|
299
|
+
}
|
300
|
+
|
301
|
+
serverList << "all"
|
302
|
+
serverList << "esc"
|
303
|
+
|
304
|
+
say("Select the index of the server you want to destroy")
|
305
|
+
value = choose { | q |
|
306
|
+
q.choices(*serverList)
|
307
|
+
}
|
308
|
+
|
309
|
+
oServerNumber = serverList.index(value)
|
310
|
+
|
311
|
+
if oServerNumber >= 0 and oServerNumber < oForge[:servers].count
|
312
|
+
#Destroy selected server
|
313
|
+
oConfig.set(:forge_server, oForge[:servers][oServerNumber][:id] )
|
314
|
+
oCloud.Delete(:forge)
|
315
|
+
elsif oServerNumber == serverList.index("all")
|
316
|
+
#Destroy all servers found
|
317
|
+
oCloud.Delete(:forge)
|
318
|
+
elsif oServerNumber == serverList.index("esc")
|
319
|
+
#esc
|
320
|
+
PrcLib.high_level_msg("No server destroyed on your demand.\n" % name )
|
321
|
+
end
|
322
|
+
|
323
|
+
end
|
324
|
+
|
325
|
+
else
|
326
|
+
PrcLib.high_level_msg("No server(s) found on forge instance '%s'.\n" % name )
|
327
|
+
end
|
328
|
+
|
288
329
|
end
|
289
330
|
|
290
331
|
################################# SET
|
@@ -321,7 +362,7 @@ Ex: By default, forj use ~/.ssh/forj-id_rsa as keypair for all forge instance. D
|
|
321
362
|
Logging.set_level(Logger::INFO) if options[:verbose]
|
322
363
|
Logging.set_level(Logger::DEBUG) if options[:debug]
|
323
364
|
|
324
|
-
oConfig=
|
365
|
+
oConfig=Lorj::Config.new()
|
325
366
|
|
326
367
|
if p.length == 0 and not options[:account_name]
|
327
368
|
Forj::Settings::config_show_all(oConfig)
|
@@ -338,8 +379,8 @@ Ex: By default, forj use ~/.ssh/forj-id_rsa as keypair for all forge instance. D
|
|
338
379
|
end
|
339
380
|
|
340
381
|
################################# GET
|
341
|
-
|
342
|
-
|
382
|
+
desc 'get', 'Get data from defaults or account values.'
|
383
|
+
long_desc <<-LONGDESC
|
343
384
|
forj cli maintain a list of key/value at 3 Levels:
|
344
385
|
\x5- Application defaults
|
345
386
|
\x5- Local config defaults
|
@@ -356,15 +397,15 @@ Ex: To get the keypair_name defined from the account, or from your ~/.forj/confi
|
|
356
397
|
`forj get keypair_name -a dev`
|
357
398
|
|
358
399
|
|
359
|
-
|
400
|
+
LONGDESC
|
360
401
|
|
361
|
-
|
402
|
+
method_option :account_name, :aliases => '-a', :desc => "Set the forj account name to use. By default, uses the default account set in your local config file."
|
362
403
|
|
363
404
|
def get(key = nil)
|
364
|
-
|
365
|
-
|
405
|
+
PrcLib.set_level(Logger::INFO) if options[:verbose]
|
406
|
+
PrcLib.set_level(Logger::DEBUG) if options[:debug]
|
366
407
|
|
367
|
-
oConfig =
|
408
|
+
oConfig = Lorj::Config.new()
|
368
409
|
if not options[:account_name] and not key
|
369
410
|
Forj::Settings::config_get_all(oConfig)
|
370
411
|
|
@@ -380,20 +421,26 @@ Ex: To get the keypair_name defined from the account, or from your ~/.forj/confi
|
|
380
421
|
end
|
381
422
|
|
382
423
|
################################# SSH
|
383
|
-
|
384
|
-
|
424
|
+
desc 'ssh <Instance> [options]', 'connect to your forge thru ssh'
|
425
|
+
long_desc <<-LONGDESC
|
385
426
|
Connect through ssh to a node attached to an instance
|
386
427
|
|
387
|
-
ex: forj ssh myforge review
|
388
|
-
|
428
|
+
ex: forj ssh myforge -n review
|
429
|
+
LONGDESC
|
389
430
|
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
431
|
+
method_option :box_name, :aliases => '-n', :desc => "box name to create ssh connection"
|
432
|
+
method_option :identity, :aliases => '-i', :desc => "Private key file name."
|
433
|
+
|
434
|
+
def ssh(oInstanceName)
|
435
|
+
Forj::Settings.common_options(options)
|
436
|
+
|
437
|
+
oConfig = Lorj::Config.new(options[:config])
|
438
|
+
|
439
|
+
oConfig.set(:box_ssh, options[:box_name]) if options[:box_name]
|
440
|
+
oConfig.set(:identity, options[:identity]) if options[:identity]
|
441
|
+
|
442
|
+
Forj::Ssh.connect(oInstanceName, oConfig)
|
443
|
+
end
|
397
444
|
|
398
445
|
################################# SETUP
|
399
446
|
|
@@ -415,15 +462,9 @@ Several data will be requested like:
|
|
415
462
|
\x5- domain name to add to each boxes hostname
|
416
463
|
LONGDESC
|
417
464
|
def setup(sAccountName = 'hpcloud', sProvider = "hpcloud")
|
418
|
-
|
419
|
-
Logging.set_level(Logger::DEBUG) if options[:debug]
|
465
|
+
Forj::Settings.common_options(options)
|
420
466
|
|
421
|
-
|
422
|
-
$LIB_FORJ_DEBUG = options[:libforj_debug].to_i
|
423
|
-
Logging.set_level(Logger::DEBUG)
|
424
|
-
end
|
425
|
-
|
426
|
-
oConfig=ForjConfig.new(options[:config])
|
467
|
+
oConfig=Lorj::Config.new(options[:config])
|
427
468
|
oConfig.set(:provider_name, sProvider)
|
428
469
|
oConfig.set(:account_name, sAccountName)
|
429
470
|
|
@@ -437,7 +478,9 @@ Several data will be requested like:
|
|
437
478
|
# boot/down/ssh/...
|
438
479
|
aProcesses << File.join($LIB_PATH, 'forj', 'ForjCli.rb')
|
439
480
|
|
440
|
-
|
481
|
+
# Loading CloudCore embedding provider controller + its process.
|
482
|
+
oCloud = Lorj::CloudCore.new(oConfig, oConfig[:account_name], aProcesses)
|
483
|
+
|
441
484
|
|
442
485
|
oCloud.Setup(:forge, sAccountName)
|
443
486
|
oCloud.config.ac_save()
|