[GH-ISSUE #1293] Agent assigned Automation Policy - patch policy not used. #2746

Closed
opened 2026-03-14 05:20:38 +03:00 by kerem · 5 comments
Owner

Originally created by @af7567 on GitHub (Sep 23, 2022).
Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/1293

Server Info (please complete the following information):

  • OS: Ubuntu 20.04.5
  • Browser: Chrome
  • RMM Version (as shown in top left of web UI): v0.14.8

Installation Method:

  • [*] Standard

Agent Info (please complete the following information):

  • Agent version: v2.3.1
  • Agent OS: Win 10 v21H2

Describe the bug
When an automation policy which includes a patch policy is applied to an agent by right click > Assign Automation Policy the patch policy is not used. Instead the Client or Site patch policy is used.
In the agent edit screen the correct automation policies are shown, but the effective patch policy used is the one from the site/client.

Each agent can have its own "patches" settings applied which can be used as a workaround, but I expected the patch policy from the automation policy to be used. It's also a lot easier to assign an automation policy to a few agents than to edit the patches section in each :)

Originally created by @af7567 on GitHub (Sep 23, 2022). Original GitHub issue: https://github.com/amidaware/tacticalrmm/issues/1293 **Server Info (please complete the following information):** - OS: Ubuntu 20.04.5 - Browser: Chrome - RMM Version (as shown in top left of web UI): v0.14.8 **Installation Method:** - [*] Standard **Agent Info (please complete the following information):** - Agent version: v2.3.1 - Agent OS: Win 10 v21H2 **Describe the bug** When an automation policy which includes a patch policy is applied to an agent by right click > Assign Automation Policy the patch policy is not used. Instead the Client or Site patch policy is used. In the agent edit screen the correct automation policies are shown, but the effective patch policy used is the one from the site/client. Each agent can have its own "patches" settings applied which can be used as a workaround, but I expected the patch policy from the automation policy to be used. It's also a lot easier to assign an automation policy to a few agents than to edit the patches section in each :)
kerem 2026-03-14 05:20:38 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@silversword411 commented on GitHub (Sep 23, 2022):

How are you determining that it's the Client/Site policy, and not the Agent policy that's being applied?

<!-- gh-comment-id:1256462515 --> @silversword411 commented on GitHub (Sep 23, 2022): How are you determining that it's the Client/Site policy, and not the Agent policy that's being applied?
Author
Owner

@af7567 commented on GitHub (Sep 23, 2022):

The Agent policy patch policy has a different installation time to the Client policy but patches had not been getting installed at that time. So I checked by right clicking the agent > Edit and looked in the Automation Policies - Effective Patch Policy section and can see the time shown there is the one from the Client policy.
The Agent policy above is shown correctly, only the effecive patch policy is wrong.

<!-- gh-comment-id:1256487923 --> @af7567 commented on GitHub (Sep 23, 2022): The Agent policy patch policy has a different installation time to the Client policy but patches had not been getting installed at that time. So I checked by right clicking the agent > Edit and looked in the Automation Policies - Effective Patch Policy section and can see the time shown there is the one from the Client policy. The Agent policy above is shown correctly, only the effecive patch policy is wrong.
Author
Owner

@af7567 commented on GitHub (Sep 23, 2022):

I think the problem is here:

github.com/amidaware/tacticalrmm@5a1cbdcd3b/api/tacticalrmm/agents/models.py (L627-L634)

It seems to be going through the policies in the order agent, site, client, default. But since there is no break after finding a valid policy it always continues through to the end even if a valid agent policy is found. Since I don't have any default policy set, it ends up with the client policy.

I haven't really tested that theory though :) If that is the problem wouldn't it also affect site and client policies?

<!-- gh-comment-id:1256522927 --> @af7567 commented on GitHub (Sep 23, 2022): I think the problem is here: https://github.com/amidaware/tacticalrmm/blob/5a1cbdcd3baf7ef85d60eeda353195db0e441efb/api/tacticalrmm/agents/models.py#L627-L634 It seems to be going through the policies in the order agent, site, client, default. But since there is no break after finding a valid policy it always continues through to the end even if a valid agent policy is found. Since I don't have any default policy set, it ends up with the client policy. I haven't really tested that theory though :) If that is the problem wouldn't it also affect site and client policies?
Author
Owner

@af7567 commented on GitHub (Sep 28, 2022):

I have tested adding that break in the loop and now updates are getting installed when I expect them to. It was also preventing the site automation patch policy from overriding the client automation patch policy for me. So I suspect anyone who has default policies set wil have them in effect rather than any patch policy set in site/client/agent.

Since then, one problem I noticed is that on the frontend, the "Effective Patch Policy" displayed on the right click > edit menu still shows the client patch policy even though it is actually executing the agent patch policy (I can see it is executing at the right time from DebugLog messages I added). Is this frontend data cached or something? It should be getting the data from agent.get_patch_policy() as far as I can tell. Nevermind, I guess I needed to restart more than just the celery service for changes to take effect on the frontend :) So now that seems OK too.

<!-- gh-comment-id:1261469726 --> @af7567 commented on GitHub (Sep 28, 2022): I have tested adding that `break` in the loop and now updates are getting installed when I expect them to. It was also preventing the site automation patch policy from overriding the client automation patch policy for me. So I suspect anyone who has default policies set wil have them in effect rather than any patch policy set in site/client/agent. ~Since then, one problem I noticed is that on the frontend, the "Effective Patch Policy" displayed on the right click > edit menu still shows the client patch policy even though it is actually executing the agent patch policy (I can see it is executing at the right time from DebugLog messages I added). Is this frontend data cached or something? It should be getting the data from `agent.get_patch_policy()` as far as I can tell.~ Nevermind, I guess I needed to restart more than just the celery service for changes to take effect on the frontend :) So now that seems OK too.
Author
Owner

@wh1te909 commented on GitHub (Oct 2, 2022):

@af7567 thanks so much for debugging this, would you be able to submit a PR with the fix?

<!-- gh-comment-id:1264726175 --> @wh1te909 commented on GitHub (Oct 2, 2022): @af7567 thanks so much for debugging this, would you be able to submit a PR with the fix?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tacticalrmm#2746
No description provided.