From ce79421698a41f8ae594bbf8875209030139d07e Mon Sep 17 00:00:00 2001 From: wh1te909 Date: Sun, 1 Dec 2019 08:27:41 +0000 Subject: [PATCH] check for updates on fresh agent install --- api/djangormm/api/views.py | 7 +++++++ install.sh | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/api/djangormm/api/views.py b/api/djangormm/api/views.py index 4bad0792..fe39daaa 100644 --- a/api/djangormm/api/views.py +++ b/api/djangormm/api/views.py @@ -38,7 +38,9 @@ from checks.models import ( MemoryHistory, CpuHistory, ) +from winupdate.models import WinUpdate from agents.tasks import uninstall_agent_task, sync_salt_modules_task +from winupdate.tasks import check_for_updates_task from agents.serializers import AgentHostnameSerializer logger.configure(**settings.LOG_CONFIG) @@ -303,6 +305,11 @@ def update(request): sync_salt_modules_task.delay(agent.pk) + # check for updates if this is fresh agent install + if not WinUpdate.objects.filter(agent=agent).exists(): + check_for_updates_task.delay(agent.pk) + + return Response("ok") diff --git a/install.sh b/install.sh index 0bbd49f1..c6e02986 100755 --- a/install.sh +++ b/install.sh @@ -649,7 +649,7 @@ server { location / { root /var/www/rmm/dist; try_files \$uri \$uri/ /index.html; - add_header Cache-Control "no-store, no-cache, must-revalidate"; + add_header Cache-Control "no-store, no-cache, must-revalidate"; add_header Pragma "no-cache"; } error_log /var/log/nginx/frontend-error.log;