nixos/syncthing: match stale ids by subtracting in jq
This commit is contained in:
parent
fdd898f8f7
commit
82b59a8fb2
1 changed files with 7 additions and 7 deletions
|
@ -100,13 +100,13 @@ let
|
||||||
the Nix configured list of IDs
|
the Nix configured list of IDs
|
||||||
*/
|
*/
|
||||||
+ lib.optionalString s.override ''
|
+ lib.optionalString s.override ''
|
||||||
old_conf_${conf_type}_ids="$(curl -X GET ${s.baseAddress} | ${jq} --raw-output '.[].${s.GET_IdAttrName}')"
|
stale_${conf_type}_ids="$(curl -X GET ${s.baseAddress} | ${jq} \
|
||||||
for id in ''${old_conf_${conf_type}_ids}; do
|
--argjson new_ids ${lib.escapeShellArg (builtins.toJSON s.new_conf_IDs)} \
|
||||||
if echo ${lib.concatStringsSep " " s.new_conf_IDs} | grep -q $id; then
|
--raw-output \
|
||||||
continue
|
'[.[].${s.GET_IdAttrName}] - $new_ids | .[]'
|
||||||
else
|
)"
|
||||||
curl -X DELETE ${s.baseAddress}/$id
|
for id in ''${stale_${conf_type}_ids}; do
|
||||||
fi
|
curl -X DELETE ${s.baseAddress}/$id
|
||||||
done
|
done
|
||||||
''
|
''
|
||||||
))
|
))
|
||||||
|
|
Loading…
Reference in a new issue