forj 0.0.40 → 0.0.41

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: bf55692c422122d563704df71be87e18427bcdf2
4
- data.tar.gz: ffc9da6135f46720256dbabb3f8a9bf277a3d848
3
+ metadata.gz: 01a8a3f3825a0b5242367c3ff69a83675588800e
4
+ data.tar.gz: 2f78609c995ebf36be3f4becfc6b7bccbd3d42c4
5
5
  SHA512:
6
- metadata.gz: 29d4e63ea42e92a8b2225a550146e692afd76b95911a1d74ae257e1c5823483473774b3e5d1e3049f02bb2f189dac8a35a1f8ec32d8a2d52f55aa7f99b19730d
7
- data.tar.gz: 3a39d5dd6bed1d7cc75607e726625979a37dda94b59f337105b9479cf37228efff4bac5cd15442b1686b2e45fb5e815c18da326e82e7deaa4841f173fffc4dac
6
+ metadata.gz: f8bcda70764cf154d9762ac21f560965317d526c49e120f0469567ef8bd7238abc88638fd786bd5cb1e2bc539a3b4643f40f186c4e01de2bf1912cafc20f5f1d
7
+ data.tar.gz: cb6e149758f4111c93012df9f3fa6b4cecd865f408cf23ccca71d516685d630fdee6f57df4cf6a4d0f7169aeb73b6df2c8c4d58f9ce584432c8ec34737a8c435
data/README.md CHANGED
@@ -83,16 +83,35 @@ Commands:
83
83
  forj help [action] # Describe available FORJ actions or one specific action
84
84
  forj setup # set the credentials for forj cli
85
85
  forj show defaults # Show list of predefined value you can update in your ~/.forj/config.yaml
86
- forj ssh
86
+ forj ssh
87
87
 
88
88
 
89
- #### config.yaml description
89
+ #### Configuration
90
90
 
91
- While building your forge, forj needs to load some data by default. Those are listed in forj-<version>/lib/defaults.yaml
91
+ While building your forge, forj needs to load some data by default. Those are listed in the application.
92
92
 
93
- If you need to change one of this default value, update a ~/.forj/config.yaml file, with any kind of data that need to be changed.
93
+ You can show them with :
94
94
 
95
- Here are the variables list you can set:
95
+ $ forj show defaults
96
+
97
+ If you need to change one of them:
98
+
99
+ $ forj set "keypair_name=MyKeypairName"
100
+
101
+ ex:
102
+ forj set keypair_name=nova
103
+
104
+ You can check what kind of value, forj will use to boot/access your forge:
105
+
106
+ $ forj get -a dev
107
+
108
+
109
+ #### Your config.yaml
110
+
111
+ The following list gives you some details about keys/values required to boot/access your forge.
112
+
113
+
114
+ ~/.forj/config.yaml:
96
115
 
97
116
  default:
98
117
  account_name: name # Default forj account used to connect to your cloud. This setting is automatically set to the first account created with forj setup <CloudProvider>
@@ -107,8 +126,8 @@ Here are the variables list you can set:
107
126
  ports: [Port1,Port2,...] # list of additional ports to add in your cloud security group.
108
127
  # This list is added to the default one in defaults.yaml
109
128
  keypair_path: path # Define the file path to your OpenSSH private key. Useful to access your box with ssh command line.
110
- # By default. ~/.forj/keypairs/nova
111
- keypair_name: name # keypair name defined in your cloud to access your server. By default we named it 'nova'. If it doesn't exist, it will be created.
129
+ # By default. ~/.ssh/forj-id_rsa
130
+ keypair_name: name # keypair name defined in your cloud to access your server. By default we named it 'forj'. If it doesn't exist, it will be created.
112
131
  router: name # Router name used by your forge boxes will use to access internet.
113
132
  security_group: name # Security group name to configure and attach to each forge boxes.
114
133
  network: name # Network name to attach to each forge boxes. By default we use 'private'. If it doesn't exist, it will be created.
@@ -143,12 +162,12 @@ Development installation:
143
162
  **Fedora/CentOS/Redhat rpm like package system**
144
163
 
145
164
  $ sudo yum install git gcc ruby-devel libxml2-devel rubygem-rspec libxslt-devel python-yaml rubygem-nokogiri -y
146
- $ gem install rspec-rake rspec-mocks rspec-expectations
165
+ $ gem install rspec-rake rspec-mocks rspec-expectations
147
166
 
148
167
  **Ubuntu/Debian deb like package system (not tested)**
149
168
 
150
169
  $ sudo apt-get install git ruby-dev build-essential libopenssl-ruby1.9.1 libssl-dev zlib1g-dev -y
151
- $ gem install rspec rspec-rake rspec-mocks rspec-expectations
170
+ $ gem install rspec rspec-rake rspec-mocks rspec-expectations
152
171
 
153
172
  Then execute the following:
154
173
 
data/bin/forj CHANGED
@@ -68,7 +68,7 @@ class Forj < Thor
68
68
  Quick steps: How to create a forj?
69
69
  ----------------------------------
70
70
 
71
- To test a forj blueprint, you will need an account on a cloud solution.
71
+ To test a forj blueprint, you will need an account on a cloud solution.
72
72
  Currently forj cli supports only HPHelion (https://horizon.hp.com) but will be expanded to support most of known clouds supported by FOG. (http://fog.io)
73
73
 
74
74
  1. Setup your FORJ account.
@@ -91,26 +91,34 @@ forj command line details:
91
91
  end
92
92
  end
93
93
 
94
+ desc 'version', 'get GEM version of forj.'
95
+
96
+ def version()
97
+ if Gem.loaded_specs['forj']
98
+ puts Gem.loaded_specs['forj'].version.to_s
99
+ end
100
+ end
101
+
102
+
94
103
  ################################# BOOT
95
- desc 'boot <Blueprint> on <Provider> as <InstanceName> [options]', 'boot a Maestro box and instruct it to provision the blueprint'
104
+ desc 'boot <blueprint> <InstanceName> [options]', 'boot a Maestro box and instruct it to provision the blueprint'
96
105
 
97
106
  long_desc <<-LONGDESC
98
107
  This task boot a new forge with the following options
99
- \x5- blueprint : Is the name of the blueprint (currently cli only supports redstone)
108
+ \x5- blueprint : Is the name of the blueprint
100
109
  \x5- InstanceName : name of the forge
101
110
 
102
- Ex: forj boot redstone on hpcloud as maestro_test
111
+ Ex: forj boot redstone maestro_test -a dev
103
112
 
104
- `forj boot` load predefined forj values from `lib/defaults.yaml`. If you need to change one of them, add the key/value in your local config (-c or `~/.forj/config.yaml`).
105
- The list of predefined values can be retrieved with forj show defaults
113
+ When `forj boot` starts, some variables are loaded. If you want to check/updated them, use `forj get [-a account]`
106
114
 
107
115
  LONGDESC
108
116
 
109
- 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."
110
- method_option :maestro_repo, :aliases => '-m', :desc => "To use a different Maestro repository already cloned.
111
- By default, Maestro is systematically cloned to ~/.forj/maestro from github.
112
-
113
- Following options superseed your config file or forj defaults."
117
+ 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.
118
+
119
+ Following options superseed your Account, config file or forj defaults."
120
+ method_option :maestro_repo, :aliases => '-m', :desc => "config: maestro_repo : To use a different Maestro repository already cloned.
121
+ By default, Maestro is systematically cloned to ~/.forj/maestro from github."
114
122
  method_option :infra, :aliases => '-r', :desc => 'config: infra_repo : Defines your Infra directory to use while booting. You can also set FORJ_INFRA_DIR.'
115
123
  method_option :key_name, :aliases => '-k', :desc => "config: keypair_name : Keypair name to use."
116
124
  method_option :key_path, :aliases => '-p', :desc => "config: keypair_path : Private or Public key file to use."
@@ -122,15 +130,15 @@ Following options superseed your config file or forj defaults."
122
130
  Build system options:"
123
131
  method_option :boothook, :aliases => '-H', :desc => 'By default, boothook file used is build/bin/build-tools/boothook.sh. Use this option to set another one.'
124
132
  method_option :build, :aliases => '-B', :desc => 'Replace the default build.sh'
125
- method_option :branch, :aliases => '-R', :desc => "Branch name to clone for maestro.
133
+ method_option :branch, :aliases => '-R', :desc => "Branch name to clone for maestro.
126
134
 
127
135
  Maestro/infra bootstrap debugging:"
128
- method_option :test_box, :aliases => '-T', :desc => "Identify a path to become your test-box repository.
129
- Ex: if your maestro is in ~/src/forj-oss, --test_box ~/src/forj-oss/maestro build.sh and
136
+ method_option :test_box, :aliases => '-T', :desc => "Identify a path to become your test-box repository.
137
+ Ex: if your maestro is in ~/src/forj-oss, --test_box ~/src/forj-oss/maestro build.sh and
130
138
  test-box will send your local maestro repo to your box, for boot."
131
139
 
132
140
  def boot(blueprint, on_or_name, old_accountname = nil, as = nil, old_name = nil)
133
-
141
+
134
142
  Logging.set_level(Logger::INFO) if options[:verbose]
135
143
  Logging.set_level(Logger::DEBUG) if options[:debug]
136
144
 
@@ -142,30 +150,30 @@ Maestro/infra bootstrap debugging:"
142
150
  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]
143
151
  if oConfig.get('account_name') == old_accountname
144
152
  Logging.warning("%s` instead." % msg)
145
- else
153
+ else
146
154
  Logging.warning("%s -a '%s'` instead." % [msg, old_accountname])
147
155
  end
148
156
  name = old_name
149
- oConfig.set('account_name', old_accountname)
157
+ oConfig.set(:account_name, old_accountname)
150
158
  else
151
159
  name = on_or_name
152
160
  end
153
161
 
154
- Logging.fatal(1, "instance name '%s' not supported. Support only lower case, numeric and dash caracters." % [name]) if not /^[\d[[:lower:]]-]+$/ =~ name
162
+ Logging.fatal( 1, "instance name '%s' not supported. Support only lower case, numeric and dash caracters." % [name]) if not (/^[\d[[:lower:]]-]+$/ =~ name)
155
163
 
156
164
  # Options are added if they are set. Otherwise, get will retrieve the default value.
157
- oConfig.set('account_name', options[:account_name]) if options[:account_name]
158
- oConfig.set('infra_repo', options[:infra])
159
- oConfig.set('keypair_name', options[:key_name])
160
- oConfig.set('keypair_path', options[:key_path])
161
- oConfig.set('security_group', options[:security_group])
162
- oConfig.set('image', options[:image])
163
- oConfig.set('flavor', options[:maestro_flavor])
164
- oConfig.set('bp_flavor', options[:bp_flavor])
165
- oConfig.set(:maestro_repo , options[:maestro_repo])
165
+ oConfig.set(:account_name, options[:account_name]) if options[:account_name]
166
+ oConfig.set(:infra_repo, options[:infra])
167
+ oConfig.set(:keypair_name, options[:key_name])
168
+ oConfig.set(:keypair_path, options[:key_path])
169
+ oConfig.set(:security_group, options[:security_group])
170
+ oConfig.set(:image, options[:image])
171
+ oConfig.set(:flavor, options[:maestro_flavor])
172
+ oConfig.set(:bp_flavor, options[:bp_flavor])
173
+ oConfig.set(:maestro_repo , options[:maestro_repo])
166
174
  oConfig.set(:test_box, File.expand_path(options[:test_box])) if options[:test_box] and File.directory?(File.expand_path(options[:test_box]))
167
-
168
-
175
+
176
+
169
177
  if options[:key_path]
170
178
  mFound = options[:key_path].match(/^(.*)(\.pub)?$/)
171
179
  if mFound
@@ -173,75 +181,271 @@ Maestro/infra bootstrap debugging:"
173
181
  if mFound[2] and not File.exists?(File.expand_path(mFound[1]+mFound[2]))
174
182
  Logging.fatal(1, "'%s' is not a valid keypair files. At least the public key (.pub) is have to exist.")
175
183
  end
176
- oConfig.set('keypair_path', key_path)
184
+ oConfig.set(:keypair_path, key_path)
177
185
  else
178
186
  Logging.fatal(1, "'%s' is not a valid keypair files. At least the public key (.pub) is have to exist.")
179
187
  end
180
188
  end
181
189
 
182
- Boot.boot(blueprint, name, options[:build],
183
- options[:build_config], options[:branch],
190
+ Boot.boot(blueprint, name, options[:build],options[:branch],
184
191
  options[:boothook], options[:box_name], oConfig)
185
192
  end
186
193
 
187
194
  ################################# Show defaults
188
- desc 'show defaults', 'Show list of predefined value you can update in your ~/.forj/config.yaml'
189
- 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."
195
+ desc 'show <Object> [name]', 'Show Object (default valuesr, account data, etc...) values.'
196
+ long_desc <<-LONGDESC
197
+ This command helps to show values used by 'forj' to boot a blueprint (account data, default values, etc...)
190
198
 
191
- def show(name)
192
- case name
199
+ queriable Objects:
200
+
201
+ - defaults : Provide the list of predefined values, configured by forj, or by you in your ~/.forj/config.yaml (or another config file with -c)
202
+ - account [name] : without name, forj will give you the list of account saved. Otherwise print 'name' account data.
203
+ LONGDESC
204
+
205
+ def show(object, name = nil)
206
+ case object
193
207
  when 'defaults'
194
208
  oConfig=ForjConfig.new()
195
- oConfig.set('account_name', options[:account_name])
196
- oForjAccount = ForjAccount.new(oConfig)
197
- oForjAccount.ac_load()
198
209
 
199
210
  puts 'List of default values: (local refer to your config file. hash refer to your FORJ account data)'
200
- puts '-----------------------'
201
- puts oConfig.default_dump([oForjAccount.hAccountData]).to_yaml
202
- puts '-----------------------'
211
+ puts oConfig.default_dump().to_yaml
212
+ puts '---'
203
213
  puts "To change default values, update your ~/.forj/config.yaml and add the key/value entry under 'default' section."
214
+ when 'account'
215
+ oConfig=ForjConfig.new()
216
+ if not name
217
+ puts "List of FORJ accounts: Use 'forj account YourAccount' to see one account details."
218
+ oAccounts = ForjAccounts.new()
219
+ puts oAccounts.dump().to_yaml
220
+ else
221
+ oConfig.set(:account_name, name)
222
+ oAccount = ForjAccount.new(oConfig)
223
+ oAccount.ac_load()
224
+
225
+ puts "Account value for '%s':" % name
226
+ puts oAccount.dump().to_yaml
227
+ puts '---'
228
+ puts "To change those values, execute 'forj setup -a %s'." % options[:account_name]
229
+ end
230
+
204
231
  else
205
232
  Logging.error("object '%s' unknown." % name)
206
233
  end
207
234
  end
208
235
 
209
236
  ################################# DOWN
210
- desc 'down', 'delete the Maestro box and all systems installed by the blueprint'
237
+ desc 'down <InstanceName>', 'delete the Maestro box and all systems installed by the blueprint'
238
+ long_desc <<-LONGDESC
239
+ This action all servers that has been created under the instance name.
240
+
241
+ Warning! This action don't removed any network/security groups cloud object.
242
+ LONGDESC
243
+
244
+ def down(name)
245
+ Logging.set_level(Logger::INFO) if options[:verbose]
246
+ Logging.set_level(Logger::DEBUG) if options[:debug]
247
+ oConfig = ForjConfig.new(options[:config])
248
+ oConfig.set(:account_name, options[:account_name]) if options[:account_name]
249
+
250
+ Down.down(oConfig, name)
251
+ end
252
+
253
+ ################################# SET
254
+ desc 'set [key=value] [options]', 'Set some variables in defaults or account.'
211
255
  long_desc <<-LONGDESC
212
- Not yet implemented
256
+ You can set some variables to change 'forj' defaults or specifically for a FORJ account.
257
+
258
+ Ex: By default, forj use ~/.ssh/forj-id_rsa as keypair for all forge instance. During setup, if this keypair doesn't exist, it proposes to create it for you, with ssh-keygen.
259
+ If you want to use a keypair that already exists, you can set it as your default, with:
260
+
261
+ `forj set keypair_name=~/.ssh/id_rsa`
262
+
263
+ If you want to set this key only for your account 'dev':
264
+
265
+ `forj set keypair_name=~/.ssh/id_rsa -a dev`
266
+
267
+ If you want to get the list of possible key to set:
268
+
269
+ `forj set`
270
+
271
+ If you want to remove the key from dev, and ask for to re-use defaults (from your config or application default)
272
+
273
+ `forj set keypair_name= -a dev`
274
+
275
+ If you want to remove the key from your default, and re-use application default
276
+
277
+ `forj set keypair_name=`
278
+
213
279
  LONGDESC
214
280
 
215
- def down(name)
281
+ 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."
282
+
283
+ def set(key_val = nil)
216
284
  Logging.set_level(Logger::INFO) if options[:verbose]
217
285
  Logging.set_level(Logger::DEBUG) if options[:debug]
218
- Down.down(name)
219
- end
286
+
287
+ oConfig=ForjConfig.new()
288
+ if not key_val
289
+ puts "List of FORJ settings: Use 'forj set KeyName=Value [-a YourAccount]' to set one. Use `forj show defaults` / `account` to check values."
290
+ hMaps = oConfig.getAppDefault(:account_section_mapping)
291
+ hMaps.each_key { | key |
292
+ sDesc = rhGet(hMaps, key, :desc)
293
+ puts "%-15s : %s" % [key, sDesc]
294
+ }
295
+ else
296
+ mkey_val = key_val.match(/^(.*) *= *(.*)$/)
297
+ if mkey_val
298
+ if not options[:account_name]
299
+ if oConfig.exist?(mkey_val[1])
300
+ sBef = "%s: '%s'" % [oConfig.exist?(mkey_val[1]), oConfig.get(mkey_val[1])]
301
+ else
302
+ sBef = "unset"
303
+ end
304
+ if mkey_val[2] != ""
305
+ oConfig.LocalSet(mkey_val[1], mkey_val[2])
306
+ else
307
+ oConfig.LocalDel(mkey_val[1])
308
+ end
309
+ oConfig.SaveConfig()
310
+ if oConfig.exist?(mkey_val[1])
311
+ sAft = "%s: '%s'" % [oConfig.exist?(mkey_val[1]), oConfig.get(mkey_val[1])]
312
+ else
313
+ sAft = "unset"
314
+ end
315
+ puts "Updated:\n%s: %s => %s" % [mkey_val[1], sBef, sAft]
316
+ else
317
+ account_name = options[:account_name]
318
+ oConfig.set(:account_name, account_name)
319
+ oForjAccount = ForjAccount.new(oConfig)
320
+ oForjAccount.ac_load()
321
+ if oForjAccount.exist?(mkey_val[1])
322
+ sBef = "%s: '%s'" % [oForjAccount.exist?(mkey_val[1]).sub("hash", account_name), oForjAccount.get(mkey_val[1])]
323
+ else
324
+ sBef = "unset"
325
+ end
326
+ if mkey_val[2] == ""
327
+ oForjAccount.del(mkey_val[1])
328
+ else
329
+ oForjAccount.set(mkey_val[1], mkey_val[2])
330
+ end
331
+ oForjAccount.ac_save()
332
+ if oForjAccount.exist?(mkey_val[1])
333
+ sAft = "%s: '%s'" % [oForjAccount.exist?(mkey_val[1]).sub("hash", account_name), oForjAccount.get(mkey_val[1])]
334
+ else
335
+ sAft = "unset"
336
+ end
337
+ puts "Updated:\n%s: %s => %s" % [mkey_val[1], sBef, sAft]
338
+ end
339
+ else
340
+ Logging.fatal(1 ,"Syntax error. Please set your value like: 'key=value' and retry.")
341
+ end
342
+ end
343
+ end
344
+
345
+ ################################# GET
346
+ desc 'get', 'Get data from defaults or account values.'
347
+ long_desc <<-LONGDESC
348
+ forj cli maintain a list of key/value at 3 Levels:
349
+ \x5- Application defaults
350
+ \x5- Local config defaults
351
+ \x5- Account data
352
+
353
+ This function will help you identify which value has been retrieved from which level.
354
+
355
+ Ex: To get the default keypair_name, from your ~/.forj/config.yaml, or if not found, from application defaults.
356
+
357
+ `forj get keypair_name`
358
+
359
+ Ex: To get the keypair_name defined from the account, or from your ~/.forj/config.yaml, or if not found, from application defaults.
360
+
361
+ `forj get keypair_name -a dev`
362
+
363
+
364
+ LONGDESC
365
+
366
+ 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."
367
+
368
+ def get(key = nil)
369
+ Logging.set_level(Logger::INFO) if options[:verbose]
370
+ Logging.set_level(Logger::DEBUG) if options[:debug]
371
+
372
+ oConfig=ForjConfig.new()
373
+ if not options[:account_name]
374
+ if key
375
+ if oConfig.exist?(key)
376
+ puts "%s:'%s'" % [oConfig.exist?(key), oConfig.get(key)]
377
+ else
378
+ Logging.message("key '%s' not found" % [key])
379
+ end
380
+ else
381
+ puts "legend: default = Application defaults, local = Local default config\n\n" % [options[:account_name], options[:account_name]]
382
+ puts "%-15s(%-7s) %-12s:\n--------------------------------------" % ['key', 'origin', 'section name']
383
+ hMaps = oConfig.getAppDefault(:account_section_mapping)
384
+ hMaps.each { |map_key, value|
385
+ if oConfig.exist?(map_key)
386
+ puts "%-15s(%-7s) %-12s: '%s'" % [map_key, oConfig.exist?(map_key), value[:section], oConfig.get(map_key)]
387
+ else
388
+ puts "%-15s( ) %-12s: unset" % [map_key, value[:section]]
389
+ end
390
+
391
+ }
392
+ end
393
+ puts "\nUse 'forj set <key>=<value>' to update defaults"
394
+ else
395
+ oConfig.set(:account_name, options[:account_name])
396
+ oForjAccount = ForjAccount.new(oConfig)
397
+ Logging.fatal(1, "Unable to load account '%s'. Not found." % options[:account_name]) if not oForjAccount.ac_load
398
+ if key
399
+ if oForjAccount.exist?(key)
400
+ puts "%s: '%s'" % [oForjAccount.exist?(key).sub("hash", options[:account_name]), oForjAccount.get(key)]
401
+ elsif oForjAccount.exist?(key.parameterize.underscore.to_sym)
402
+ key_symb = key.parameterize.underscore.to_sym
403
+ puts "%s: '%s'" % [oForjAccount.exist?(key_symb).sub("hash", options[:account_name]), oForjAccount.get(key_symb)]
404
+ else
405
+ Logging.message("key '%s' not found"% [key])
406
+ end
407
+ else
408
+ puts "legend: default = Application defaults, local = Local default config, %s = '%s' account config\n\n" % [options[:account_name], options[:account_name]]
409
+ puts "%-15s(%-7s) %-12s:\n--------------------------------------" % ['key', 'origin', 'section name']
410
+ hMaps = oConfig.getAppDefault(:account_section_mapping)
411
+ hMaps.each { |map_key, value|
412
+ if oForjAccount.exist?(map_key)
413
+ puts "%-15s(%-7s) %-12s: '%s'" % [map_key, oForjAccount.exist?(map_key).sub("hash", options[:account_name]), value[:section], oForjAccount.get(map_key)]
414
+ else
415
+ puts "%-15s( ) %12s: unset" % [map_key, value[:section]]
416
+ end
417
+ }
418
+ end
419
+ puts "\nUse 'forj set <key>=<value> -a %s' to update account data.\nOr 'forj set <key>= -a %s' to restore key default value." % [options[:account_name], options[:account_name]]
420
+ end
421
+ end
220
422
 
221
423
  ################################# SSH
222
- desc 'ssh', 'connect to your forge thru ssh'
424
+ desc 'ssh <Instance> <Server> [options]', 'connect to your forge thru ssh'
223
425
  long_desc <<-LONGDESC
224
- Connect through ssh to an existing instance
426
+ Connect through ssh to a node attached to an instance
225
427
 
226
- not yet implemented
428
+ ex: forj ssh myforge review
227
429
  LONGDESC
228
430
 
229
431
  def ssh(name, server)
230
432
  Logging.set_level(Logger::INFO) if options[:verbose]
231
433
  Logging.set_level(Logger::DEBUG) if options[:debug]
232
- Ssh.connect(name, server)
434
+ oConfig = ForjConfig.new(options[:config])
435
+ oConfig.set(:account_name, options[:account_name]) if options[:account_name]
436
+ Ssh.connect(name, server, oConfig)
233
437
  end
234
438
 
235
439
  ################################# SETUP
236
440
  method_option :keypair_name, :aliases => '-k', :desc => "config keypair_name : Keypair name attached as default to your FORJ account."
237
- method_option :keypair_path, :aliases => '-p', :desc => "config keypair_path : SSH key file (private or public) to attach as default to your FORJ account.
238
- It will attach any detected private/public key thanks to the file name
441
+ method_option :keypair_path, :aliases => '-p', :desc => "config keypair_path : SSH key file (private or public) to attach as default to your FORJ account.
442
+ It will attach any detected private/public key thanks to the file name
239
443
  (without extension/.pem = private, .pub = public)"
240
444
 
241
445
  desc 'setup [AccountName [Provider]] [options]', "Setup FORJ cloud account credentials and information."
242
446
  long_desc <<-LONGDESC
243
447
  This setup will configure a FORJ account used to connect to your cloud system.
244
- \x5It will ask for your cloud provider credentials and services.
448
+ \x5It will ask for your cloud provider credentials and services.
245
449
 
246
450
  If AccountName is not set, 'hpcloud' will be used for AccountName and provider name, by default.
247
451
  \x5If AccountName is not set without provider, 'hpcloud' provider will be used, by default.
@@ -252,16 +456,16 @@ Several data will be requested like:
252
456
  \x5- Cloud provider credentials and services.
253
457
  \x5- user/password (password is encrypted)
254
458
  \x5- DNS settings if you want Maestro to manage it.
255
- \x5- domain name to add to each boxes hostname
459
+ \x5- domain name to add to each boxes hostname
256
460
  LONGDESC
257
461
  def setup(sAccountName = 'hpcloud', sProvider = "hpcloud")
258
462
  Logging.set_level(Logger::INFO) if options[:verbose]
259
463
  Logging.set_level(Logger::DEBUG) if options[:debug]
260
464
  oConfig=ForjConfig.new(options[:config])
261
- oConfig.set('provider', sProvider)
262
- oConfig.set('account_name', sAccountName)
263
- oConfig.set('keypair_path', options[:keypair_path]) if options[:keypair_path]
264
- oConfig.set('keypair_name', options[:keypair_name]) if options[:keypair_name]
465
+ oConfig.set(:provider, sProvider)
466
+ oConfig.set(:account_name, sAccountName)
467
+ oConfig.set(:keypair_path, options[:keypair_path]) if options[:keypair_path]
468
+ oConfig.set(:keypair_name, options[:keypair_name]) if options[:keypair_name]
265
469
  Setup.setup(oConfig)
266
470
  end
267
471