From 5c17ae75bf6e42a9376ae23a9c4bebc0d53f034c Mon Sep 17 00:00:00 2001 From: Vincent Simonin Date: Wed, 20 Nov 2024 15:32:40 +0100 Subject: [PATCH] :bug: Fix image creation on add host process --- flows.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/flows.json b/flows.json index e4117f2..d99f21e 100644 --- a/flows.json +++ b/flows.json @@ -3313,7 +3313,7 @@ "t": "set", "p": "payload", "pt": "msg", - "to": "{\t \"host\": $globalContext(\"config\").id,\t \"name\": $match(msg.result[0].RepoTags[0], /(.*):/).groups[0] ? $match(msg.result[0].RepoTags[0], /(.*):/).groups[0] : $substring(msg.result[0].Id,7,12),\t \"registry\": {\t \"id\": $lookup(msg.image2registry, msg.result[0].RepoTags[0])\t },\t \"version\": $split($split(msg.result[0].RepoTags[0], \"/\")[-1], ':')[1] ? $split($split(msg.result[0].RepoTags[0], \"/\")[-1], ':')[1] : msg.result[0].Id,\t \"size\": $round(msg.result[0].Size / 1024 / 1024),\t \"ImageID\": msg.result[0].Id,\t \"Digest\": $split(msg.result[0].RepoDigests[0], \"@\")[-1]\t}", + "to": "(\t $count(msg.result.RepoDigests) = 0 and $count(msg.result.RepoTags) = 0\t ? {\t \"host\": $globalContext(\"config\").id,\t \"name\": msg.result.Id,\t \"registry\": {\t \"id\": $lookup(msg.image2registry, msg.result.Id)\t },\t \"version\": \"\",\t \"size\": $round(msg.result.Size / 1024 / 1024),\t \"ImageID\": msg.result.Id,\t \"Digest\": null\t }\t : $count(msg.result.RepoDigests) > 0 and $count(msg.result.RepoTags) = 0\t ? {\t \"host\": $globalContext(\"config\").id,\t \"name\": $split(msg.result.RepoDigests[0], \"@\")[0],\t \"registry\": {\t \"id\": $lookup(msg.image2registry, msg.result.RepoDigests[0])\t },\t \"version\": $split(msg.result.RepoDigests[0], \"@\")[-1],\t \"size\": $round(msg.result.Size / 1024 / 1024),\t \"ImageID\": msg.result.Id,\t \"Digest\": $split(msg.result.RepoDigests[0], \"@\")[-1]\t }\t : {\t \"host\": $globalContext(\"config\").id,\t \"name\": $match(msg.result.RepoTags[0], /(.*):/).groups[0] ? $match(msg.result.RepoTags[0], /(.*):/).groups[0] : $substring(msg.result.Id,7,12),\t \"registry\": {\t \"id\": $lookup(msg.image2registry, msg.result.RepoTags[0])\t },\t \"version\": $split($split(msg.result.RepoTags[0], \"/\")[-1], ':')[1] ? $split($split(msg.result.RepoTags[0], \"/\")[-1], ':')[1] : msg.result.Id,\t \"size\": $round(msg.result.Size / 1024 / 1024),\t \"ImageID\": msg.result.Id,\t \"Digest\": $split(msg.result.RepoDigests[0], \"@\")[-1]\t }\t)", "tot": "jsonata" } ], diff --git a/package.json b/package.json index 9b7aa0e..6a74ad1 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "netbox-docker-agent", - "version": "1.5.4", + "version": "1.5.5", "description": "Saashup agent for netbox manager", "main": "index.js", "scripts": {