Merge branch 'callbackinit' of git://github.com/sergevanginderachter/ansible into devel
This commit is contained in:
commit
132c89e681
3 changed files with 9 additions and 2 deletions
|
@ -41,6 +41,10 @@ if constants.DEFAULT_LOG_PATH != '':
|
||||||
user = getpass.getuser()
|
user = getpass.getuser()
|
||||||
logger = logging.getLogger("p=%s u=%s | " % (mypid, user))
|
logger = logging.getLogger("p=%s u=%s | " % (mypid, user))
|
||||||
|
|
||||||
|
callback_plugins = []
|
||||||
|
|
||||||
|
def load_callback_plugins():
|
||||||
|
global callback_plugins
|
||||||
callback_plugins = [x for x in utils.plugins.callback_loader.all()]
|
callback_plugins = [x for x in utils.plugins.callback_loader.all()]
|
||||||
|
|
||||||
def get_cowsay_info():
|
def get_cowsay_info():
|
||||||
|
|
|
@ -129,11 +129,13 @@ class PlayBook(object):
|
||||||
self.inventory = inventory
|
self.inventory = inventory
|
||||||
|
|
||||||
self.basedir = os.path.dirname(playbook) or '.'
|
self.basedir = os.path.dirname(playbook) or '.'
|
||||||
|
utils.plugins.push_basedir(self.basedir)
|
||||||
vars = {}
|
vars = {}
|
||||||
if self.inventory.basedir() is not None:
|
if self.inventory.basedir() is not None:
|
||||||
vars['inventory_dir'] = self.inventory.basedir()
|
vars['inventory_dir'] = self.inventory.basedir()
|
||||||
self.filename = playbook
|
self.filename = playbook
|
||||||
(self.playbook, self.play_basedirs) = self._load_playbook_from_file(playbook, vars)
|
(self.playbook, self.play_basedirs) = self._load_playbook_from_file(playbook, vars)
|
||||||
|
ansible.callbacks.load_callback_plugins()
|
||||||
|
|
||||||
# *****************************************************
|
# *****************************************************
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ PLUGIN_PATH_CACHE = {}
|
||||||
_basedirs = []
|
_basedirs = []
|
||||||
|
|
||||||
def push_basedir(basedir):
|
def push_basedir(basedir):
|
||||||
|
if basedir not in _basedirs:
|
||||||
_basedirs.insert(0, basedir)
|
_basedirs.insert(0, basedir)
|
||||||
|
|
||||||
class PluginLoader(object):
|
class PluginLoader(object):
|
||||||
|
|
Loading…
Reference in a new issue