mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 13:20:23 -07:00
os.path.dirname returns '' not None in some cases, handle this so inventory can be specified with ./
This commit is contained in:
parent
79ec5fac7a
commit
1f7c197a9d
1 changed files with 5 additions and 1 deletions
|
@ -374,7 +374,11 @@ class Inventory(object):
|
||||||
""" if inventory came from a file, what's the directory? """
|
""" if inventory came from a file, what's the directory? """
|
||||||
if not self.is_file():
|
if not self.is_file():
|
||||||
return None
|
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):
|
def playbook_basedir(self):
|
||||||
""" returns the directory of the current playbook """
|
""" returns the directory of the current playbook """
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue