Set basedir to . if there isn't one
This avoids special-casing '' = '.' everywhere the basedir gets used. Fixes #1729.
This commit is contained in:
parent
0f1706220b
commit
97cc384ccf
2 changed files with 2 additions and 4 deletions
|
@ -115,7 +115,7 @@ class PlayBook(object):
|
|||
else:
|
||||
self.inventory = inventory
|
||||
|
||||
self.basedir = os.path.dirname(playbook)
|
||||
self.basedir = os.path.dirname(playbook) or '.'
|
||||
(self.playbook, self.play_basedirs) = self._load_playbook_from_file(playbook)
|
||||
|
||||
# *****************************************************
|
||||
|
@ -132,7 +132,7 @@ class PlayBook(object):
|
|||
if type(playbook_data) != list:
|
||||
raise errors.AnsibleError("parse error: playbooks must be formatted as a YAML list")
|
||||
|
||||
basedir = os.path.dirname(path)
|
||||
basedir = os.path.dirname(path) or '.'
|
||||
utils.plugins.push_basedir(basedir)
|
||||
for play in playbook_data:
|
||||
if type(play) != dict:
|
||||
|
|
|
@ -49,8 +49,6 @@ class Connection(object):
|
|||
|
||||
vvv("EXEC %s" % cmd, host=self.host)
|
||||
basedir = self.runner.basedir
|
||||
if basedir == '':
|
||||
basedir = '.'
|
||||
p = subprocess.Popen(cmd, cwd=basedir, shell=True, stdin=None,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
stdout, stderr = p.communicate()
|
||||
|
|
Loading…
Reference in a new issue