Forum Discussion

Timothy_Tait's avatar
Timothy_Tait
Icon for Altostratus rankAltostratus
Sep 28, 2022
Solved

Trying to assign a policy to a virtual server

i am trying to change policies on a virtual server, using the python sdk. i load the vs, i can load the existing policy on the vs, and delete it, but when i try to create a new policy for the vs, i ...
  • JRahm's avatar
    JRahm
    Oct 05, 2022

    Ok...so I wasn't able to come up with the warm and fuzzy solution. I get the same error, and I'm not sure why. That said, I have a workaround for you. This works for me with your partition/folder structure loaded on my local test LTM:

    # Use the modify method to PATCH the specific attribute that includes the policies list.
    vip.modify(policiesReference={"items": [{"name": "Portal_QA1", "partition": "QA1_Web", "subPath": "Shared"}]})
    
    # Since policies are subcollections, refresh with expandSubcollections attribute to validate at the vip level
    vip.refresh(requests_params={'params': 'expandSubcollections=true'})