diff --git a/imageroot/actions/get-facts/10get_facts b/imageroot/actions/get-facts/10get_facts new file mode 100755 index 0000000..7b92f6e --- /dev/null +++ b/imageroot/actions/get-facts/10get_facts @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 + +# +# Copyright (C) 2024 Nethesis S.r.l. +# SPDX-License-Identifier: GPL-2.0-only +# + +import json +import subprocess +import os +import sys +import agent + +units = -1 +try: + p = subprocess.run(["/usr/bin/podman", "exec", "-ti", "vpn", "find", "/etc/openvpn/ccd", "-type", "f"], capture_output=True, text=True) + units = len(p.stdout.split("\n")) - 1 +except Exception as ex: + print(agent.SD_ERR, ex, file=sys.stderr) + units = 0 + +json.dump({ + "units": units +}, fp=sys.stdout)