Some signature related things, prior to starting test scaffolding

pull/9250/head
Michael DeHaan 10 years ago
parent b8e4e59d6b
commit 7ebf246ff1

@ -15,13 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
from v2.playbook import Tag, Conditional
class PlaybookBase(Tag, Conditional):
'''
Implements a common object, which supports filtering based on
both tags and when: conditional statements
'''
class Base(object):
def __init__(self):
pass

@ -18,13 +18,7 @@
from v2.playbook.base import PlaybookBase
class Block(PlaybookBase):
def __init__(self):
self.ds = None
self.plays = []
def load(self, ds):
self.ds = ds
self.plays = []
def __init__(self):
pass
def get_plays(self):
return self.plays

@ -20,20 +20,17 @@ from v2.inventory import Host
from v2.playbook import Task
class Handler(Task):
def __init__(self):
self.triggered = False
self.triggered_by = []
pass
def flag_for_host(self, host):
if not isinstance(host, Host):
raise AnsibleError('handlers expected to be triggered by a Host(), instead got %s' % type(host))
if host.name not in self.triggered_by:
triggered_by.append(host.name)
assert instanceof(host, Host)
pass
def get_has_triggered(self):
return self.triggered
def has_triggered(self):
return self._triggered
def set_has_triggered(self, triggered):
if not isinstance(triggered, bool):
raise AnsibleError('a handlers triggered property should be a boolean, instead got %s' % type(triggered))
self.triggered = triggered
def set_triggered(self, triggered):
assert instanceof(triggered, bool)
self._triggered = triggered

@ -19,19 +19,20 @@ from v2.playbook.base import PlaybookBase
from v2.utils import list_union
class Role(PlaybookBase):
def __init__(self):
pass
def load(self, ds):
self.ds = ds
self.tasks = []
self.handlers = []
self.blocks = []
self.dependencies = []
self.metadata = dict()
self.defaults = dict()
self.vars = dict()
self.params = dict()
self._ds = ds
self._tasks = []
self._handlers = []
self._blocks = []
self._dependencies = []
self._metadata = dict()
self._defaults = dict()
self._vars = dict()
self._params = dict()
def get_vars(self):
# returns the merged variables for this role, including
@ -39,13 +40,13 @@ class Role(PlaybookBase):
return dict()
def get_immediate_dependencies(self):
return self.dependencies
return self._dependencies
def get_all_dependencies(self):
# returns a list built recursively, of all deps from
# all child dependencies
all_deps = []
for dep in self.dependencies:
for dep in self._dependencies:
list_union(all_deps, dep.get_all_dependencies())
all_deps = list_union(all_deps, self.dependencies)
return all_deps
@ -53,3 +54,5 @@ class Role(PlaybookBase):
def get_blocks(self):
# should return
return self.blocks

Loading…
Cancel
Save