Index: admin/plib/modules/panel-migrator/backend/lib/python/parallels/plesk/source/plesk/actions/fetch/decrypt_passwords.py IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== --- admin/plib/modules/panel-migrator/backend/lib/python/parallels/plesk/source/plesk/actions/fetch/decrypt_passwords.py (revision 51028df1d4ebcf6a10c9f728092e0abaca023d92) +++ admin/plib/modules/panel-migrator/backend/lib/python/parallels/plesk/source/plesk/actions/fetch/decrypt_passwords.py (revision 87a424c053534c3188bc58c0a0301b67631d35a4) @@ -81,14 +81,27 @@ decrypted_password_items, decrypted_password_errors = password_decryptor.decrypt_passwords( encrypted_password_items ) + list_failed_objects = [] # Update objects with decrypted passwords for decrypted_password_item in decrypted_password_items: + # if password decrypted to None, generate password + if decrypted_password_item.password is None: + logger.fwarn( + messages.FAILED_TO_DECRYPT_ACCOUNT_PASSWORD, + object_description=decrypted_password_item.description + ) + decrypted_password_item.id_object.password = Password( + password_text=generate_random_password(), + password_type='plain' + ) + list_failed_objects.append(decrypted_password_item.description) + continue + # if password decrypted well decrypted_password_item.id_object.password = Password( password_text=decrypted_password_item.password, password_type='plain' ) # Show message for failed decryption actions and generate passwords for related objects - list_objects = [] for decrypted_password_error in decrypted_password_errors: logger.fwarn( messages.FAILED_TO_DECRYPT_ACCOUNT_PASSWORD, @@ -99,15 +112,15 @@ password_text=generate_random_password(), password_type='plain' ) - list_objects.append(decrypted_password_error.description) + list_failed_objects.append(decrypted_password_error.description) # Add message with a list of affected objects to the final report - if list_objects: + if list_failed_objects: global_context.pre_check_report.add_issue( 'password_decryption_failure', Issue.SEVERITY_WARNING, safe_format( messages.FAILED_TO_DECRYPT_PASSWORDS, - list_objects=format_multiline_list(list_objects) + list_objects=format_multiline_list(list_failed_objects) ) )