From 1f7c197a9d9a5e8efb9bc7d2c84b9acb5894334d Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Sun, 2 Jun 2013 16:01:09 -0400 Subject: [PATCH] os.path.dirname returns '' not None in some cases, handle this so inventory can be specified with ./ --- lib/ansible/inventory/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ansible/inventory/__init__.py b/lib/ansible/inventory/__init__.py index 460b63053a..17e501f143 100644 --- a/lib/ansible/inventory/__init__.py +++ b/lib/ansible/inventory/__init__.py @@ -374,7 +374,11 @@ class Inventory(object): """ if inventory came from a file, what's the directory? """ if not self.is_file(): return None - return os.path.dirname(self.host_list) + dname = os.path.dirname(self.host_list) + if dname is None or dname == '': + cwd = os.getcwd() + return cwd + return dname def playbook_basedir(self): """ returns the directory of the current playbook """