lorj 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,24 +26,24 @@ class SSLErrorMgt
26
26
  if @iRetry <@iMaxRetry
27
27
  sleep(2)
28
28
  @iRetry+=1
29
- print "%s/%s try... 'unknown protocol' SSL Error\r" % [@iRetry, @iMaxRetry] if $FORJ_LOGGER.level == 0
29
+ print "%s/%s try... 'unknown protocol' SSL Error\r" % [@iRetry, @iMaxRetry] if PrcLib.level == 0
30
30
  return false
31
31
  else
32
- Logging.error('Too many retry. %s' % message)
32
+ PrcLib.error('Too many retry. %s' % message)
33
33
  return true
34
34
  end
35
35
  elsif e.is_a?(Excon::Errors::InternalServerError)
36
36
  if @iRetry <@iMaxRetry
37
37
  sleep(2)
38
38
  @iRetry+=1
39
- print "%s/%s try... %s\n" % [@iRetry, @iMaxRetry, ANSI.red(e.class)] if $FORJ_LOGGER.level == 0
39
+ print "%s/%s try... %s\n" % [@iRetry, @iMaxRetry, ANSI.red(e.class)] if PrcLib.level == 0
40
40
  return false
41
41
  else
42
- Logging.error('Too many retry. %s' % message)
42
+ PrcLib.error('Too many retry. %s' % message)
43
43
  return true
44
44
  end
45
45
  else
46
- Logging.error("Exception %s: %s\n%s" % [e.class, message,backtrace.join("\n")])
46
+ PrcLib.error("Exception %s: %s\n%s" % [e.class, message,backtrace.join("\n")])
47
47
  return true
48
48
  end
49
49
  end
@@ -51,17 +51,17 @@ class SSLErrorMgt
51
51
  end
52
52
 
53
53
 
54
- class CloudProcess < BaseProcess
54
+ class CloudProcess
55
55
  def connect(sCloudObj, hParams)
56
56
  oSSLError = SSLErrorMgt.new # Retry object
57
- Logging.debug("%s:%s Connecting to '%s' - Project '%s'" % [self.class, sCloudObj, config.get(:provider), hParams[:tenant]])
57
+ PrcLib.debug("%s:%s Connecting to '%s' - Project '%s'" % [self.class, sCloudObj, config.get(:provider), hParams[:tenant]])
58
58
  begin
59
- controler.connect(sCloudObj)
59
+ controller_connect(sCloudObj)
60
60
  rescue => e
61
61
  if not oSSLError.ErrorDetected(e.message,e.backtrace, e)
62
62
  retry
63
63
  end
64
- Logging.error('%s:%s: Unable to connect.\n%s' % [self.class, sCloudObj, e.message ])
64
+ PrcLib.error('%s:%s: Unable to connect.\n%s' % [self.class, sCloudObj, e.message ])
65
65
  nil
66
66
  end
67
67
  end
@@ -71,66 +71,68 @@ end
71
71
  # Keypair management
72
72
  # ---------------------------------------------------------------------------
73
73
  class CloudProcess
74
+
75
+ # KeyPair Create Process Handler
76
+ # The process implemented is:
77
+ # * Check local SSH keypairs
78
+ # * Check remote keypair existence
79
+ # * Compare and warn if needed.
80
+ # * Import public key found if missing remotely and name it.
81
+ #
82
+ # Return:
83
+ # - keypair : Lorj::Data keypair object. Following additional data should be found in the keypair attributes
84
+ # - :coherent : Boolean. True, if the local keypair (public AND private) is coherent with remote keypair found in the cloud
85
+ # - :private_key_file: String. Path to local private key file
86
+ # - :public_key_file : String. Path to local public key file
87
+ # - :public_key : String. Public key content. (config[:public_key] is also set - Used to import it)
88
+ #
74
89
  def forj_get_or_create_keypair(sCloudObj, hParams)
75
90
  sKeypair_name = hParams[:keypair_name]
76
91
  # setup has configured and copied the appropriate key to forj keypairs.
77
92
 
78
- hKeys = keypair_detect(sKeypair_name, File.expand_path(hParams[:keypair_path]))
79
- if hKeys[:private_key_exist? ]
80
- hParams[:private_key_file] = File.join(hKeys[:keypair_path], hKeys[:private_key_name])
81
- Logging.info("Openssh private key file '%s' exists." % hParams[:private_key_file])
82
- end
83
- if hKeys[:public_key_exist? ]
84
- hParams[:public_key_file] = File.join(hKeys[:keypair_path], hKeys[:public_key_name])
85
- else
86
- Logging.fatal("Public key file is not found. Please run 'forj setup %s'" % config[:account_name])
87
- end
93
+ hLocalKeypair = keypair_detect(sKeypair_name, File.expand_path(hParams[:keypair_path]))
88
94
 
89
- Logging.state("Searching for keypair '%s'" % [sKeypair_name] )
95
+ private_key_file = File.join(hLocalKeypair[:keypair_path], hLocalKeypair[:private_key_name])
96
+ public_key_file = File.join(hLocalKeypair[:keypair_path], hLocalKeypair[:private_key_name])
97
+
98
+ PrcLib.info("Found openssh private key file '%s'." % private_key_file) if hLocalKeypair[:private_key_exist? ]
99
+ PrcLib.info("Found openssh public key file '%s'." % public_key_file) if hLocalKeypair[:public_key_exist? ]
100
+
101
+ PrcLib.state("Searching for keypair '%s'" % [sKeypair_name] )
90
102
 
91
103
  keypairs = forj_query_keypair(sCloudObj, {:name => sKeypair_name}, hParams)
92
- if keypairs.length > 0
93
- keypair = keypairs[0]
94
- # Check the public key with the one found here, locally.
95
- if not keypair[:public_key].nil? and keypair[:public_key] != ""
96
- begin
97
- local_pub_key = File.read(hParams[:public_key_file])
98
- rescue => e
99
- Logging.error("Unable to read '%s'.\n%s",[hParams[:public_key_file], e.message] )
100
- keypair[:coherent] = false
101
- else
102
- if local_pub_key.split(' ')[1].strip == keypair[:public_key].split(' ')[1].strip
103
- Logging.info("keypair '%s' local files are coherent with keypair in your cloud service. You will be able to connect to your box over SSH." % sKeypair_name)
104
- keypair[:coherent] = true
105
- else
106
- keypair[:coherent] = false
107
- Logging.warning("Your local keypair file '%s' are incoherent with public key '%s' found in your cloud. You won't be able to access your box with this keypair.\nPublic key found in the cloud:\n%s" % [hParams[:public_key_file], sKeypair_name, keypair[:public_key]])
108
- end
109
- end
110
- else
111
- keypair[:coherent] = false
112
- Logging.warning("Unable to verify keypair coherence between your cloud and your local SSH keys. The cloud controller did not provided ':public_key'")
104
+
105
+ if keypairs.length == 0
106
+ PrcLib.fatal(1, "Unable to import keypair '%s'. Public key file is not found. Please run 'forj setup %s'" % [sKeypair_name, config[:account_name]]) if not hLocalKeypair[:public_key_exist? ]
107
+ begin
108
+ config[:public_key] = File.read(hLocalKeypair[:public_key_file])
109
+ rescue => e
110
+ PrcLib.error("Unable to import keypair '%s'. '%s' is unreadable.\n%s",[hLocalKeypair[:public_key_file], e.message] )
113
111
  end
114
- else
115
- config[:public_key] = File.read(hParams[:public_key_file])
116
112
  keypair = create_keypair(sCloudObj, hParams)
117
- if not hKeys[:private_key_exist? ]
113
+ if not hLocalKeypair[:private_key_exist? ]
118
114
  keypair[:coherent] = false
119
115
  else
120
116
  keypair[:coherent] = true
121
117
  end
118
+ else
119
+ keypair = keypairs[0]
120
+ keypair[:coherent] = coherent_keypair?(hLocalKeypair, keypair)
121
+ # Adding information about key files.
122
+ end
123
+ if keypair[:coherent]
124
+ keypair[:private_key_file] = hLocalKeypair[:private_key_file]
125
+ keypair[:public_key_file] = hLocalKeypair[:public_key_file]
122
126
  end
123
- # Adding information about key files.
124
- keypair[:private_key_file] = hParams[:private_key_file]
125
- keypair[:public_key_file] = hParams[:public_key_file]
126
127
  keypair
128
+
127
129
  end
128
130
 
129
131
  def forj_query_keypair(sCloudObj, sQuery, hParams)
130
132
  key_name = hParams[:keypair_name]
131
133
  oSSLError = SSLErrorMgt.new
132
134
  begin
133
- oList = controler.query(sCloudObj, sQuery)
135
+ oList = controller_query(sCloudObj, sQuery)
134
136
  query_single(sCloudObj, oList, sQuery, key_name)
135
137
  rescue => e
136
138
  if not oSSLError.ErrorDetected(e.message, e.backtrace, e)
@@ -140,25 +142,26 @@ class CloudProcess
140
142
 
141
143
  end
142
144
 
145
+ # Internal process function: Create keypair
143
146
  def create_keypair(sCloudObj, hParams)
144
147
  key_name = hParams[:keypair_name]
145
- Logging.state("Importing keypair '%s'" % [key_name])
148
+ PrcLib.state("Importing keypair '%s'" % [key_name])
146
149
  oSSLError=SSLErrorMgt.new
147
150
  begin
148
- keypair = controler.create(sCloudObj)
149
- Logging.info("Keypair '%s' imported." % [keypair[:name]])
151
+ keypair = controller_create(sCloudObj)
152
+ PrcLib.info("Keypair '%s' imported." % [keypair[:name]])
150
153
  rescue StandardError => e
151
154
  if not oSSLError.ErrorDetected(e.message,e.backtrace, e)
152
155
  retry
153
156
  end
154
- Logging.error "error importing keypair '%s'" % [key_name]
157
+ PrcLib.error "error importing keypair '%s'" % [key_name]
155
158
  end
156
159
  keypair
157
160
  end
158
161
 
162
+ # Build keypair data information structure with files found in local filesystem.
163
+ # Take care of priv with or without .pem and pubkey with pub.
159
164
  def keypair_detect(keypair_name, key_fullpath)
160
- # Build key data information structure.
161
- # Take care of priv with or without .pem and pubkey with pub.
162
165
 
163
166
  key_basename = File.basename(key_fullpath)
164
167
  key_path = File.expand_path(File.dirname(key_fullpath))
@@ -167,12 +170,18 @@ class CloudProcess
167
170
  key_basename = mObj[1]
168
171
 
169
172
  private_key_ext = nil
170
- private_key_ext = "" if File.exists?(File.join(key_path, key_basename))
171
- private_key_ext = '.pem' if File.exists?(File.join(key_path, key_basename + '.pem'))
173
+ temp_file1 = File.join(key_path, key_basename)
174
+ private_key_ext = "" if File.exists?(temp_file1) and not File.directory?(temp_file1)
175
+ temp_file2 = File.join(key_path, key_basename + '.pem')
176
+ private_key_ext = '.pem' if File.exists?(temp_file2) and not File.directory?(temp_file2)
177
+
172
178
  if private_key_ext
173
179
  private_key_exist = true
174
180
  private_key_name = key_basename + private_key_ext
175
181
  else
182
+ [ temp_file1, temp_file2].each { | temp_file |
183
+ PrcLib.warning("keypair_detect: Private key file name detection has detected '%s' as a directory. Usually, it should be a private key file. Please check." % temp_file) if File.directory?(temp_file)
184
+ }
176
185
  private_key_exist = false
177
186
  private_key_name = key_basename
178
187
  end
@@ -181,13 +190,76 @@ class CloudProcess
181
190
  public_key_name = key_basename + '.pub'
182
191
 
183
192
 
193
+ # keypair basic structure
184
194
  {:keypair_name => keypair_name,
185
195
  :keypair_path => key_path, :key_basename => key_basename,
186
196
  :private_key_name => private_key_name, :private_key_exist? => private_key_exist,
187
- :public_key_name => public_key_name, :public_key_exist? => public_key_exist,
197
+ :public_key_name => public_key_name, :public_key_exist? => public_key_exist
188
198
  }
189
199
  end
190
200
 
201
+ def forj_get_keypair(sCloudObj, sName, hParams)
202
+ oSSLError = SSLErrorMgt.new
203
+ begin
204
+ controller_get(sCloudObj, sName)
205
+ rescue => e
206
+ if not oSSLError.ErrorDetected(e.message,e.backtrace, e)
207
+ retry
208
+ end
209
+ end
210
+ end
211
+
212
+ def get_keypairs_path(hParams, hKeys)
213
+ sKeypair_name = hParams[:keypair_name]
214
+
215
+ if hKeys[:private_key_exist? ]
216
+ hParams[:private_key_file] = File.join(hKeys[:keypair_path], hKeys[:private_key_name])
217
+ PrcLib.info("Openssh private key file '%s' exists." % hParams[:private_key_file])
218
+ end
219
+ if hKeys[:public_key_exist? ]
220
+ hParams[:public_key_file] = File.join(hKeys[:keypair_path], hKeys[:public_key_name])
221
+ else
222
+ PrcLib.fatal(1, "Public key file is not found. Please run 'forj setup %s'" % config[:account_name])
223
+ end
224
+
225
+ PrcLib.state("Searching for keypair '%s'" % [sKeypair_name] )
226
+
227
+ hParams
228
+ end
229
+
230
+ # Check if 2 keypair objects are coherent (Same public key)
231
+ # Parameters:
232
+ # - +hLocalKeypair+ : Keypair structure representing local files existence. see keypair_detect
233
+ # - +keypair+ : Keypair object to check.
234
+ #
235
+ # return:
236
+ # - coherent : Boolean. True if same public key.
237
+ def coherent_keypair?(hLocalKeypair, keypair)
238
+ #send keypairs by parameter
239
+
240
+ sKeypair_name = hLocalKeypair[:keypair_name]
241
+ bCoherent = false
242
+
243
+ # Check the public key with the one found here, locally.
244
+ if not keypair[:public_key].nil? and keypair[:public_key] != ""
245
+ begin
246
+ local_pub_key = File.read(File.join(hLocalKeypair[:keypair_path], hLocalKeypair[:public_key_name]))
247
+ rescue => e
248
+ PrcLib.error("Unable to read '%s'.\n%s" % [hLocalKeypair[:public_key_file], e.message] )
249
+ else
250
+ if local_pub_key.split(' ')[1].strip == keypair[:public_key].split(' ')[1].strip
251
+ PrcLib.info("keypair '%s' local files are coherent with keypair in your cloud service. You will be able to connect to your box over SSH." % sKeypair_name)
252
+ bCoherent = true
253
+ else
254
+ PrcLib.warning("Your local keypair file '%s' are incoherent with public key '%s' found in your cloud. You won't be able to access your box with this keypair.\nPublic key found in the cloud:\n%s" % [hLocalKeypair[:public_key_file], sKeypair_name, keypair[:public_key]])
255
+ end
256
+ end
257
+ else
258
+ PrcLib.warning("Unable to verify keypair coherence with your local SSH keys. No public key (:public_key) provided.")
259
+ end
260
+ bCoherent
261
+
262
+ end
191
263
  end
192
264
 
193
265
  # ---------------------------------------------------------------------------
@@ -199,12 +271,12 @@ class CloudProcess
199
271
  # CloudProcess predefines some values. Consult CloudProcess.rb for details
200
272
  def forj_get_or_create_flavor(sCloudObj, hParams)
201
273
  sFlavor_name = hParams[:flavor_name]
202
- Logging.state("Searching for flavor '%s'" % [sFlavor_name] )
274
+ PrcLib.state("Searching for flavor '%s'" % [sFlavor_name] )
203
275
 
204
276
  flavors = query_flavor(sCloudObj, {:name => sFlavor_name}, hParams)
205
277
  if flavors.length == 0
206
278
  if not hParams[:create]
207
- Logging.error("Unable to create %s '%s'. Creation is not supported." % [sCloudObj, sFlavor_name])
279
+ PrcLib.error("Unable to create %s '%s'. Creation is not supported." % [sCloudObj, sFlavor_name])
208
280
  ForjLib::Data.new.set(nil, sCloudObj)
209
281
  else
210
282
  create_flavor(sCloudObj,hParams)
@@ -226,7 +298,7 @@ class CloudProcess
226
298
  sFlavor_name = hParams[:flavor_name]
227
299
  oSSLError = SSLErrorMgt.new
228
300
  begin
229
- oList = controler.query(sCloudObj, sQuery)
301
+ oList = controller_query(sCloudObj, sQuery)
230
302
  rescue => e
231
303
  if not oSSLError.ErrorDetected(e.message,e.backtrace, e)
232
304
  retry
@@ -239,10 +311,10 @@ end
239
311
  # ---------------------------------------------------------------------------
240
312
  # Image management
241
313
  # ---------------------------------------------------------------------------
242
- class CloudProcess < BaseProcess
314
+ class CloudProcess
243
315
  def forj_get_or_create_image(sCloudObj, hParams)
244
316
  sImage_name = hParams[:image_name]
245
- Logging.state("Searching for image '%s'" % [sImage_name] )
317
+ PrcLib.state("Searching for image '%s'" % [sImage_name] )
246
318
 
247
319
  search_the_image(sCloudObj, {:name => sImage_name}, hParams)
248
320
  # No creation possible.
@@ -253,10 +325,15 @@ class CloudProcess < BaseProcess
253
325
  images = forj_query_image(sCloudObj, sQuery, hParams)
254
326
  case images.length()
255
327
  when 0
256
- Logging.info("No image '%s' found" % [ image_name ] )
328
+ PrcLib.info("No image '%s' found" % [ image_name ] )
257
329
  nil
330
+ when 1
331
+ PrcLib.info("Found image '%s'." % [ image_name ])
332
+ images[0, :ssh_user] = ssh_user(images[0, :name])
333
+ images[0]
258
334
  else
259
- Logging.info("Found image '%s'." % [ image_name ])
335
+ PrcLib.info("Found several images '%s'. Selecting the first one '%s'" % [ image_name, images[0, :name] ])
336
+ images[0, :ssh_user] = ssh_user(images[0, :name])
260
337
  images[0]
261
338
  end
262
339
  end
@@ -264,23 +341,33 @@ class CloudProcess < BaseProcess
264
341
  def forj_query_image(sCloudObj, sQuery, hParams)
265
342
  oSSLError = SSLErrorMgt.new
266
343
  begin
267
- controler.query(sCloudObj, sQuery)
344
+ images = controller_query(sCloudObj, sQuery)
268
345
  rescue => e
269
346
  if not oSSLError.ErrorDetected(e.message,e.backtrace, e)
270
347
  retry
271
348
  end
272
349
  end
350
+ images.each { |image|
351
+ image[:ssh_user] = ssh_user(image[:name])
352
+ }
353
+ images
354
+ end
355
+
356
+ def ssh_user(image_name)
357
+ return "fedora" if image_name =~ /fedora/i
358
+ return "centos" if image_name =~ /centos/i
359
+ return "ubuntu"
273
360
  end
274
361
  end
275
362
 
276
363
  # ---------------------------------------------------------------------------
277
364
  # Server management
278
365
  # ---------------------------------------------------------------------------
279
- class CloudProcess < BaseProcess
366
+ class CloudProcess
280
367
  # Process Handler functions
281
368
  def forj_get_or_create_server(sCloudObj, hParams)
282
369
  sServer_name = hParams[:server_name]
283
- Logging.state("Searching for server '%s'" % [sServer_name] )
370
+ PrcLib.state("Searching for server '%s'" % [sServer_name] )
284
371
  servers = forj_query_server(sCloudObj, {:name => sServer_name}, hParams)
285
372
  if servers.length > 0
286
373
  # Get server details
@@ -290,13 +377,22 @@ class CloudProcess < BaseProcess
290
377
  end
291
378
  end
292
379
 
380
+ def forj_delete_server(sCloudObj, hParams)
381
+ oSSLError = SSLErrorMgt.new
382
+ begin
383
+ controller_delete(sCloudObj)
384
+ PrcLib.info("Server %s was destroyed " % hParams[:server][:name] )
385
+ rescue => e
386
+ if not oSSLError.ErrorDetected(e.message,e.backtrace, e)
387
+ retry
388
+ end
389
+ end
390
+ end
391
+
293
392
  def forj_query_server(sCloudObj, sQuery, hParams)
294
- server_name = "Undefined"
295
- server_name = sQuery[:name] if sQuery.key?(:name)
296
393
  oSSLError = SSLErrorMgt.new
297
394
  begin
298
- oList = controler.query(sCloudObj, sQuery)
299
- query_single(sCloudObj, oList, sQuery, server_name)
395
+ controller_query(sCloudObj, sQuery)
300
396
  rescue => e
301
397
  if not oSSLError.ErrorDetected(e.message,e.backtrace, e)
302
398
  retry
@@ -307,7 +403,7 @@ class CloudProcess < BaseProcess
307
403
  def forj_get_server(sCloudObj, sId, hParams)
308
404
  oSSLError = SSLErrorMgt.new
309
405
  begin
310
- controler.get(sCloudObj, sId)
406
+ controller_get(sCloudObj, sId)
311
407
  rescue => e
312
408
  if not oSSLError.ErrorDetected(e.message,e.backtrace, e)
313
409
  retry
@@ -319,13 +415,13 @@ class CloudProcess < BaseProcess
319
415
  def create_server(sCloudObj, hParams)
320
416
  name = hParams[:server_name]
321
417
  begin
322
- Logging.info("boot: meta-data provided.") if hParams[:meta_data]
323
- Logging.info("boot: user-data provided.") if hParams[:user_data]
324
- Logging.state('creating server %s' % [name])
325
- server = controler.create(sCloudObj)
326
- Logging.info("%s '%s' created." % [sCloudObj, name])
418
+ PrcLib.info("boot: meta-data provided.") if hParams[:meta_data]
419
+ PrcLib.info("boot: user-data provided.") if hParams[:user_data]
420
+ PrcLib.state('creating server %s' % [name])
421
+ server = controller_create(sCloudObj)
422
+ PrcLib.info("%s '%s' created." % [sCloudObj, name])
327
423
  rescue => e
328
- Logging.fatal(1, "Unable to create server '%s'" % name, e)
424
+ PrcLib.fatal(1, "Unable to create server '%s'" % name, e)
329
425
  end
330
426
  server
331
427
  end
@@ -333,7 +429,7 @@ class CloudProcess < BaseProcess
333
429
  def forj_get_server_log(sCloudObj, sId, hParams)
334
430
  oSSLError = SSLErrorMgt.new
335
431
  begin
336
- controler.get(sCloudObj, sId)
432
+ controller_get(sCloudObj, sId)
337
433
  rescue => e
338
434
  if not oSSLError.ErrorDetected(e.message,e.backtrace, e)
339
435
  retry
@@ -344,14 +440,14 @@ end
344
440
  # ---------------------------------------------------------------------------
345
441
  # Addresses management
346
442
  # ---------------------------------------------------------------------------
347
- class CloudProcess < BaseProcess
443
+ class CloudProcess
348
444
  # Process Handler functions
349
445
  def forj_get_or_assign_public_address(sCloudObj, hParams)
350
446
  # Function which to assign a public IP address to a server.
351
447
  sServer_name = hParams[:server, :name]
352
448
 
353
- Logging.state("Searching public IP for server '%s'" % [sServer_name] )
354
- addresses = controler.query(sCloudObj, {:server_id => hParams[:server, :id]})
449
+ PrcLib.state("Searching public IP for server '%s'" % [sServer_name] )
450
+ addresses = controller_query(sCloudObj, {:server_id => hParams[:server, :id]})
355
451
  if addresses.length == 0
356
452
  assign_address(sCloudObj, hParams)
357
453
  else
@@ -371,7 +467,7 @@ class CloudProcess < BaseProcess
371
467
  :more => "Found several %s. Searching for '%s'.",
372
468
  :items => :public_ip
373
469
  }
374
- oList = controler.query(sCloudObj, sQuery)
470
+ oList = controller_query(sCloudObj, sQuery)
375
471
  query_single(sCloudObj, oList, sQuery, server_name, sInfo)
376
472
  rescue => e
377
473
  if not oSSLError.ErrorDetected(e.message,e.backtrace, e)
@@ -383,7 +479,7 @@ class CloudProcess < BaseProcess
383
479
  def forj_get_public_address(sCloudObj, sId, hParams)
384
480
  oSSLError = SSLErrorMgt.new
385
481
  begin
386
- controler.get(sCloudObj, sId)
482
+ controller_get(sCloudObj, sId)
387
483
  rescue => e
388
484
  if not oSSLError.ErrorDetected(e.message,e.backtrace, e)
389
485
  retry
@@ -395,11 +491,11 @@ class CloudProcess < BaseProcess
395
491
  def assign_address(sCloudObj, hParams)
396
492
  name = hParams[:server, :name]
397
493
  begin
398
- Logging.state('Getting public IP for server %s' % [name])
399
- ip_address = controler.create(sCloudObj)
400
- Logging.info("Public IP '%s' for server '%s' assigned." % [ip_address[:public_ip], name])
494
+ PrcLib.state('Getting public IP for server %s' % [name])
495
+ ip_address = controller_create(sCloudObj)
496
+ PrcLib.info("Public IP '%s' for server '%s' assigned." % [ip_address[:public_ip], name])
401
497
  rescue => e
402
- Logging.fatal(1, "Unable to assign a public IP to server '%s'" % name, e)
498
+ PrcLib.fatal(1, "Unable to assign a public IP to server '%s'" % name, e)
403
499
  end
404
500
  ip_address
405
501
  end