Problem

APS resources for brands were duplicated in Odin Automation 6.0 due to bug #APS-37738. The bug was fixed as described in KB130323 for Odin Automation 6.0.9. However, while the solution from KB130323 prevents the appearance of new redundant resources, it does not remove the old ones. Hence, this bug was filed: #APS-41094.

Resolution

To remove the unneeded resources, download and run this script on OA Operations MN. The script will remove duplicated brands APS resources and therefore will improve the performance of the 'update account info' action.

The script does not require to stop pem or pau services however it executes some SQL queries which theoretically can interfere with the database queries produced by the normal activity of the system. Thus, we strictly recommend to run this script in business calm time to eliminated such an interferential.

Script Usage

Script should be called on MN.

The script provides the following options:

--check

Specifying this option, we just ask to check the consistency of relationships between account APS resource and their brands APS resources. In this case script tries to find inconsistencies and types the brief report about current state of such a relationships. It could look like the following:

Fail: duplicate APS resources for brands are found:
  Brand #20 - 11828 resources
  Brand #5 - 2367 resources
  Brand #11 - 198 resources
  Brand #2 - 64651 resources

which means the system has the original inconsistency between accounts and brands APS resources.

If the inconsistencies are not detected, the script just types this:

 Verifying brand APS resources...OK. Duplicate APS resources for brands are not found

In such a case, there is no reason to run script to fix the issue as the inconsistencies we are looking for does not exist.

Example:

  python 164564-APS-41094-remove-duplicate-brand-resources.SaaS.py --check

--dry-run

To estimate how much time the script would take to fix the issues or to play the emulation of that work, there is special option has been implemented. Option tells the script to perform all work for fixing original issue but does not commit the changes done. Instead, script performs rollback of its transaction, which guarantees that fixing changes are not actualized and PA database keeps original state.

Example:

  time python 164564-APS-41094-remove-duplicate-brand-resources.SaaS.py --dry-run

--fix

This is the main option the script is aimed for. Option tells the script to find all inconsistencies between accounts and brands APS resources and fix all corresponding errors. This option tells the script to do absolutely the same as --dry-run does but in this case script commits its transaction and fixing changes are actualized.

Example:

  python 164564-APS-41094-remove-duplicate-brand-resources.SaaS.py --fix

--verbose

This option tells the script to type more details information to console

Example:

  python 164564-APS-41094-remove-duplicate-brand-resources.SaaS.py --dry-run --verbose

--help

This option tells the script to type its usage information.

Example:

  python 164564-APS-41094-remove-duplicate-brand-resources.SaaS.py --help

#- INTERNAL (content below this line is not visible in published article)

Internal content