mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Merge branch 'always_run-6' of https://github.com/stoned/ansible into stoned-always_run-6
This commit is contained in:
@@ -37,6 +37,7 @@ import ansible.constants as C
|
||||
import ansible.inventory
|
||||
from ansible import utils
|
||||
from ansible.utils import template
|
||||
from ansible.utils import check_conditional
|
||||
from ansible import errors
|
||||
from ansible import module_common
|
||||
import poller
|
||||
@@ -156,6 +157,7 @@ class Runner(object):
|
||||
self.inventory = utils.default(inventory, lambda: ansible.inventory.Inventory(host_list))
|
||||
|
||||
self.module_vars = utils.default(module_vars, lambda: {})
|
||||
self.always_run = None
|
||||
self.connector = connection.Connection(self)
|
||||
self.conditional = conditional
|
||||
self.module_name = module_name
|
||||
@@ -941,3 +943,16 @@ class Runner(object):
|
||||
self.background = time_limit
|
||||
results = self.run()
|
||||
return results, poller.AsyncPoller(results, self)
|
||||
|
||||
# *****************************************************
|
||||
|
||||
def noop_on_check(self, inject):
|
||||
''' Should the runner run in check mode or not ? '''
|
||||
|
||||
# initialize self.always_run on first call
|
||||
if self.always_run is None:
|
||||
self.always_run = self.module_vars.get('always_run', False)
|
||||
self.always_run = check_conditional(
|
||||
self.always_run, self.basedir, inject, fail_on_undefined=True, jinja2=True)
|
||||
|
||||
return (self.check and not self.always_run)
|
||||
|
||||
Reference in New Issue
Block a user