From f9872a09438041ad73b92db5830b227c567929ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Torbj=C3=B6rn=20L=C3=B6nnemark?= <tobbez@ryara.net>
Date: Tue, 17 Jan 2023 01:55:31 +0100
Subject: [PATCH] Prevent errors on hosts where python3 is not available

---
 facts.d/{alchemy.py => alchemy.sh} | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
 rename facts.d/{alchemy.py => alchemy.sh} (91%)

diff --git a/facts.d/alchemy.py b/facts.d/alchemy.sh
similarity index 91%
rename from facts.d/alchemy.py
rename to facts.d/alchemy.sh
index bdced62..6ef1223 100755
--- a/facts.d/alchemy.py
+++ b/facts.d/alchemy.sh
@@ -1,5 +1,9 @@
-#!/usr/bin/env python3
+#!/usr/bin/env sh
 
+# Exit silently if python3 is not available
+/usr/bin/env python3 -c '' 2>/dev/null || exit 0
+
+/usr/bin/env python3 <<'EOF'
 # This fact is pulled onto all (?) hosts which has the "knuth" module
 # in their environment (so just about all hosts). Qucik and dirty fix
 # is to just eat all errors.
@@ -49,3 +53,4 @@ try:
 
 except:
     pass
+EOF
-- 
GitLab