|
1 | 1 | """ |
2 | | -Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved. |
| 2 | +Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | The Universal Permissive License (UPL), Version 1.0 |
4 | 4 | """ |
5 | 5 | from sets import Set |
@@ -311,22 +311,41 @@ def get_file_hash(file_name): |
311 | 311 |
|
312 | 312 |
|
313 | 313 | def save_changes(model_context): |
314 | | - if _wlst_helper.is_connected(): |
315 | | - print '****** online I am' |
316 | | - _wlst_helper.save() |
317 | | - _wlst_helper.activate() |
318 | | - _wlst_helper.disconnect() |
| 314 | + """ |
| 315 | + Call this if necessary to save changes and disconnect from the domain. |
| 316 | + This works in both offline and online. |
| 317 | + :param model_context: contains information about the current tool settings |
| 318 | + """ |
| 319 | + _method_name = 'save_changes' |
| 320 | + if model_context.get_target_wlst_mode() == WlstModes.ONLINE: |
| 321 | + if _wlst_helper.is_connected(): |
| 322 | + _logger.fine('WLSDPLY-09110', class_name=_class_name, method_name=_method_name) |
| 323 | + _wlst_helper.save() |
| 324 | + _wlst_helper.activate() |
| 325 | + _wlst_helper.disconnect() |
| 326 | + else: |
| 327 | + _logger.fine('WLSDPLY-09109', class_name=_class_name, method_name=_method_name) |
319 | 328 | else: |
320 | | - print '******* offline I am' |
| 329 | + _logger.fine('WLSDPLY-09111', class_name=_class_name, method_name=_method_name) |
321 | 330 | _wlst_helper.update_domain() |
322 | 331 |
|
323 | 332 |
|
324 | 333 | def read_again(model_context): |
325 | | - if _wlst_helper.is_connected(): |
326 | | - _wlst_helper.connect( model_context.get_admin_user(), model_context.get_admin_password(), |
327 | | - model_context.get_admin_url()) |
328 | | - _wlst_helper.edit() |
329 | | - _wlst_helper.start_edit() |
| 334 | + """ |
| 335 | + Establish connection with the domain and start editing in both online and offline wlst mode. |
| 336 | + :param model_context: contains information about the current tool settings |
| 337 | + """ |
| 338 | + _method_name = 'read_again' |
| 339 | + if model_context.get_target_wlst_mode() == WlstModes.ONLINE: |
| 340 | + if not _wlst_helper.is_connected(): |
| 341 | + _logger.fine('WLSDPLY-09113', class_name=_class_name, method_name=_method_name) |
| 342 | + _wlst_helper.connect(model_context.get_admin_user(), model_context.get_admin_password(), |
| 343 | + model_context.get_admin_url()) |
| 344 | + _wlst_helper.edit() |
| 345 | + _wlst_helper.start_edit() |
| 346 | + else: |
| 347 | + _logger.fine('WLSDPLY-09112', class_name=_class_name, method_name=_method_name) |
330 | 348 | else: |
| 349 | + _logger.fine('WLSDPLY-09114', class_name=_class_name, method_name=_method_name) |
331 | 350 | _wlst_helper.close_domain() |
332 | 351 | _wlst_helper.read_domain(model_context.get_domain_home()) |
0 commit comments