From 9fb7b7560ea8907f4bcae2f44e7373fb2eb99606 Mon Sep 17 00:00:00 2001
From: Christian Poessinger <christian@poessinger.com>
Date: Mon, 17 May 2021 21:30:18 +0200
Subject: ddclient: T3557: fix FileNotFoundError when querying status
 information

If ddclient is not problery configured it will start up but no status file is
generated. This commit checks if the status file exists before reading it.

(cherry picked from commit 041cea6d7a13a804b4e656778048bcefd0a46cb8)
---
 src/op_mode/dynamic_dns.py | 4 ++++
 1 file changed, 4 insertions(+)

(limited to 'src/op_mode')

diff --git a/src/op_mode/dynamic_dns.py b/src/op_mode/dynamic_dns.py
index 14bcf65c1..9d1dccafa 100755
--- a/src/op_mode/dynamic_dns.py
+++ b/src/op_mode/dynamic_dns.py
@@ -35,6 +35,10 @@ update-status: {{ entry.status }}
 """
 
 def show_status():
+    # A ddclient status file must not always exist
+    if not os.path.exists(cache_file):
+        sys.exit(0)
+
     data = {
         'hosts': []
     }
-- 
cgit v1.2.3