From 2b5f1a01480a3e5ff4af0dc307387299a64db3a4 Mon Sep 17 00:00:00 2001 From: Darko Poljak Date: Tue, 27 Feb 2018 23:07:52 +0100 Subject: [PATCH] Fix a case when HOME is set but empty --- cdist/__init__.py | 9 +++++++-- docs/changelog | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cdist/__init__.py b/cdist/__init__.py index 1e2c9255..a8f6600f 100644 --- a/cdist/__init__.py +++ b/cdist/__init__.py @@ -175,6 +175,11 @@ def str_hash(s): def home_dir(): if 'HOME' in os.environ: - return os.path.join(os.environ['HOME'], ".cdist") + home = os.environ['HOME'] + if home: + rv = os.path.join(home, ".cdist") + else: + rv = None else: - return None + rv = None + return rv diff --git a/docs/changelog b/docs/changelog index bea3eb38..01c1d911 100644 --- a/docs/changelog +++ b/docs/changelog @@ -6,6 +6,7 @@ next: * Core: Add -4 and -6 params to force IPv4, IPv6 addresses respectively (Darko Poljak) * Type __package_update_index: Fix messaging (Thomas Eckert) * Type __package_dpkg: Add state parameter and messaging (Thomas Eckert) + * Core: Fix a case when HOME is set but empty (Darko Poljak) 4.8.0: 2018-02-14 * Core: Skip empty lines in parameter files (Darko Poljak)