Prisma Cloud Compute: How to resolve errors while upgrading 32.01.128 console version to the latest console version

Prisma Cloud Compute: How to resolve errors while upgrading 32.01.128 console version to the latest console version

793
Created On 04/03/24 22:20 PM - Last Modified 10/30/25 21:47 PM


Objective


Some users are experiencing the following error while upgrading their 32.01.128 version console to the latest version 

Error (can be seen under console logs):

panic: write exception: write errors: [The path 'rules.0.collections' must exist in the document in order to apply array updates.]

The objective of this article is to help users resolve this error and upgrade their self-hosted 32.01.128 version console to the latest version.

 



Environment


  • Prisma Cloud Compute Self-Hosted
  • Console version 32.01.128


Procedure


Please follow the following steps in order to fix some broken data in the customer’s MongoDB:

  1. Create a backup of the running console.

  2. Connect to the Machine where the Console container is running.

  3. Run sudo su to switch to root user.

  4. Run `cd /var/lib/twistlock` to switch the directory to the twistlock directory.

  5. Copy, past and run the following command that will create a script that is called fixPolicyRulesWithMissingCollecitons.js

    echo 'const conn = new Mongo();
    const db = conn.getDB("twistlock");
    
    const policyCollection = db.policy;
    
    policyCollection.find({}).forEach(policy => {
        if (policy.hasOwnProperty("rules")) {
            policy.rules.forEach(rule => {
                if (!rule.hasOwnProperty("collections")) {
                    rule.collections = [];
                }
            });
            policyCollection.updateOne(
                { _id: policy._id },
                { $set: { rules: policy.rules } }
            );
        }
    });
    print("Policy collection update completed.");' > fixPolicyRulesWithMissingCollecitons.js
  6. Verify that the script exist by running ls.

  7. Run docker ps.

  8. Copy the id of the Console container.

  9. Run docker exec -it <ID_FROM_STEP_8> bash to create a session inside the Console container.

  10. Run cd /var/lib/twistlock to change the directory to the twistlock directory.

  11. Verify that you can see the script that is called fixPolicyRulesWithMissingCollecitons.js by running ls.

  12. Run mongosh fixPolicyRulesWithMissingCollecitons.js.

  13. Make sure that you see the message "Policy collection update completed". that indicates that the script ran successfully.

  14. After this, upgrade should work and you should be able to upgrade your console to the latest version



Actions
  • Print
  • Copy Link

    https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA14u0000008XipCAE&lang=en_US&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail