From 17f3d76445ee2a6a2fa69f3a0d6c2a1821a31fc8 Mon Sep 17 00:00:00 2001 From: Matthew Mosesohn Date: Thu, 29 Dec 2016 10:57:58 +0300 Subject: [PATCH] Update inventory.py --- contrib/inventory_builder/inventory.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/contrib/inventory_builder/inventory.py b/contrib/inventory_builder/inventory.py index fea4ca0e6..2f02375c6 100644 --- a/contrib/inventory_builder/inventory.py +++ b/contrib/inventory_builder/inventory.py @@ -86,8 +86,12 @@ class KargoInventory(object): self.write_config(self.config_file) def write_config(self, config_file): - with open(config_file, 'w') as f: - self.config.write(f) + if config_file: + with open(config_file, 'w') as f: + self.config.write(f) + else: + print("WARNING: Unable to save config. Make sure you set " + "CONFIG_FILE env var.") def debug(self, msg): if DEBUG: