Hi all, hoping for some help in solving a small mystery. We use Meraki group policies to customize firewall settings and apply VLAN tags, among other things. Right now, I'm using the API to standardize group policies for some networks. I wrote a Python script that removes the current group policies for a network ID I provide it and then it creates the new standard group policies.
The problem I'm running into is that sometimes the removal of the group policy returns a 400 client error, saying basically "You can't delete this group policy because there are N clients assigned to it." So, I thought I'll add a function to my script that gets the list of clients and then checks to see if their policy is set to one of the policies being deleted, and if so, make a put request to change that client's policy to "Normal" (aka no policy).
And this works fine except in a couple of annoying cases where for some reason, certain clients don't show up in the list of clients! I think this happens because we've cloned a few of our networks, and basically that client's mac address was coded to have that group policy on the original network. So basically, I have group policies with clients assigned, but those clients don't exist in the network, so I can't reassign those clients. Hence, I can't remove the group policy. Well, I CAN remove it, manually, but where's the fun in that?
Endpoints for reference:
Client list: /networks/{networkId}/clients
Client policy: /networks/{networkId}/clients/{clientId}/policy
Group policy: /networks/{networkId}/groupPolicies/{groupPolicyId}