more winupdate fixes
This commit is contained in:
parent
97766b3a57
commit
a92e2f3c7b
|
@ -10,4 +10,5 @@ urlpatterns = [
|
|||
path("wmi/", views.NatsWMI.as_view()),
|
||||
path("offline/", views.OfflineAgents.as_view()),
|
||||
path("logcrash/", views.LogCrash.as_view()),
|
||||
path("superseded/", views.SupersededWinUpdate.as_view()),
|
||||
]
|
||||
|
|
|
@ -258,9 +258,23 @@ class NatsWinUpdates(APIView):
|
|||
agent.delete_superseded_updates()
|
||||
|
||||
# more superseded updates cleanup
|
||||
for u in agent.winupdates.filter(
|
||||
date_installed__isnull=True, result="failed"
|
||||
).exclude(installed=True):
|
||||
if pyver.parse(agent.version) <= pyver.parse("1.4.2"):
|
||||
for u in agent.winupdates.filter(
|
||||
date_installed__isnull=True, result="failed"
|
||||
).exclude(installed=True):
|
||||
u.delete()
|
||||
|
||||
return Response("ok")
|
||||
|
||||
|
||||
class SupersededWinUpdate(APIView):
|
||||
authentication_classes = []
|
||||
permission_classes = []
|
||||
|
||||
def post(self, request):
|
||||
agent = get_object_or_404(Agent, agent_id=request.data["agent_id"])
|
||||
updates = agent.winupdates.filter(guid=request.data["guid"])
|
||||
for u in updates:
|
||||
u.delete()
|
||||
|
||||
return Response("ok")
|
||||
|
|
2
go.mod
2
go.mod
|
@ -7,6 +7,6 @@ require (
|
|||
github.com/josephspurrier/goversioninfo v1.2.0
|
||||
github.com/nats-io/nats.go v1.10.1-0.20210107160453-a133396829fc
|
||||
github.com/ugorji/go/codec v1.2.3
|
||||
github.com/wh1te909/rmmagent v1.4.2
|
||||
github.com/wh1te909/rmmagent v1.4.3-0.20210202083714-12142d6dfd1f
|
||||
golang.org/x/net v0.0.0-20210119194325-5f4716e94777 // indirect
|
||||
)
|
||||
|
|
2
go.sum
2
go.sum
|
@ -89,6 +89,8 @@ github.com/ugorji/go/codec v1.2.3/go.mod h1:5FxzDJIgeiWJZslYHPj+LS1dq1ZBQVelZFnj
|
|||
github.com/wh1te909/go-win64api v0.0.0-20201021040544-8fba2a0fc3d0/go.mod h1:cfD5/vNQFm5PD5Q32YYYBJ6VIs9etzp8CJ9dinUcpUA=
|
||||
github.com/wh1te909/rmmagent v1.4.2 h1:noG/ELSue3d6UF7o0gp1ty0DpGbfrVz0VG6NEQm9kGM=
|
||||
github.com/wh1te909/rmmagent v1.4.2/go.mod h1:mcI27szhAGjAQzhX8eCsluE5670kUAyi3tJVJa6LNTo=
|
||||
github.com/wh1te909/rmmagent v1.4.3-0.20210202083714-12142d6dfd1f h1:9r7AFleOMiVs8AiAsUezau3GVL22bqbUDz6qlRUIMFM=
|
||||
github.com/wh1te909/rmmagent v1.4.3-0.20210202083714-12142d6dfd1f/go.mod h1:mcI27szhAGjAQzhX8eCsluE5670kUAyi3tJVJa6LNTo=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
|
|
|
@ -161,6 +161,13 @@ func Listen(apihost, natshost, version string, debug bool) {
|
|||
rClient.R().SetBody(p).Patch("/winupdates/")
|
||||
}
|
||||
}()
|
||||
case "superseded":
|
||||
go func() {
|
||||
var p *rmm.SupersededUpdate
|
||||
if err := dec.Decode(&p); err == nil {
|
||||
rClient.R().SetBody(p).Post("/superseded/")
|
||||
}
|
||||
}()
|
||||
case "needsreboot":
|
||||
go func() {
|
||||
var p *rmm.AgentNeedsReboot
|
||||
|
|
|
@ -68,7 +68,11 @@
|
|||
</q-td>
|
||||
<q-td>{{ props.row.severity }}</q-td>
|
||||
<q-td>{{ formatMessage(props.row.title) }}</q-td>
|
||||
<q-td @click.native="showFullMsg(props.row.title, props.row.description)">
|
||||
<q-td
|
||||
@click.native="
|
||||
showFullMsg(props.row.title, props.row.description, props.row.more_info_urls, props.row.categories)
|
||||
"
|
||||
>
|
||||
<span style="cursor: pointer; text-decoration: underline" class="text-primary">{{
|
||||
formatMessage(props.row.description)
|
||||
}}</span>
|
||||
|
@ -125,7 +129,7 @@ export default {
|
|||
},
|
||||
{
|
||||
name: "description",
|
||||
label: "Description",
|
||||
label: "More Info",
|
||||
field: "description",
|
||||
align: "left",
|
||||
sortable: true,
|
||||
|
@ -137,6 +141,14 @@ export default {
|
|||
align: "left",
|
||||
sortable: true,
|
||||
},
|
||||
{
|
||||
name: "more_info_urls",
|
||||
field: "more_info_urls",
|
||||
},
|
||||
{
|
||||
name: "categories",
|
||||
field: "categories",
|
||||
},
|
||||
],
|
||||
visibleColumns: ["action", "installed", "severity", "title", "description", "date_installed"],
|
||||
};
|
||||
|
@ -155,10 +167,19 @@ export default {
|
|||
formatMessage(msg) {
|
||||
return msg.substring(0, 80) + "...";
|
||||
},
|
||||
showFullMsg(title, msg) {
|
||||
showFullMsg(title, msg, urls, categories) {
|
||||
let support_urls = "";
|
||||
urls.forEach(u => {
|
||||
support_urls += `<a href='${u}' target='_blank'>${u}</a><br/>`;
|
||||
});
|
||||
let cats = categories.join(", ");
|
||||
this.$q.dialog({
|
||||
title: title,
|
||||
message: msg.split(". ").join(".<br />"),
|
||||
message:
|
||||
`<b>Categories:</b> ${cats}<br/><br/>` +
|
||||
"<b>Description</b><br/>" +
|
||||
msg.split(". ").join(".<br />") +
|
||||
`<br/><br/><b>Support Urls</b><br/>${support_urls}`,
|
||||
html: true,
|
||||
fullWidth: true,
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue