Commit 4e4308b8 by Michael DeHaan

Merge branch 'refactor_pass' into devel

parents e24825cb ff87ac08
Subproject commit db5668b84c3a19498b843d0bfe34574aef40c193 Subproject commit 9b35a391213fe87834af5ebc907109de2bc0005f
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
import v2.utils import ansible.utils
class Playbook(object): class Playbook(object):
def __init__(self, filename): def __init__(self, filename):
......
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
from errors import AnsibleError
from playbook.tag import Tag
class Base(object): class Base(object):
def __init__(self): def __init__(self):
......
...@@ -15,15 +15,16 @@ ...@@ -15,15 +15,16 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
import v2.config as C
from v2.utils import template
from v2.utils import list_union
class Conditional(object): class Conditional(object):
def __init__(self, task): def __init__(self, task):
pass self._task = task
self._conditionals = []
def evaluate(self, context): def evaluate(self, context):
pass pass
def push(self, conditionals):
if not isinstance(conditionals, list):
conditionals = [ conditionals ]
self._conditionals.extend(conditionals)
...@@ -15,19 +15,25 @@ ...@@ -15,19 +15,25 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
from v2.errors import AnsibleError from errors import AnsibleError
from v2.utils import list_union from ansible.utils import list_union
class Tag(object): class Tag(object):
def __init__(self, tags=[]): def __init__(self, tags=[]):
self.tags = tags assert isinstance(tags, list)
self._tags = tags
def push(self, tag): def push(self, tags):
if tag not in self.tags: if not isinstance(tags, list):
self.tags.append(tag) tags = [ tags ]
for tag in tags:
if not isinstance(tag, basestring):
tag = str(tag)
if tag not in self._tags:
self._tags.append(tag)
def get_tags(self): def get_tags(self):
return self.tags return self._tags
def merge(self, tags): def merge(self, tags):
# returns a union of the tags, which can be a string, # returns a union of the tags, which can be a string,
...@@ -38,8 +44,8 @@ class Tag(object): ...@@ -38,8 +44,8 @@ class Tag(object):
tags = Tag(tags) tags = Tag(tags)
elif not isinstance(tags, Tag): elif not isinstance(tags, Tag):
raise AnsibleError('expected a Tag() instance, instead got %s' % type(tags)) raise AnsibleError('expected a Tag() instance, instead got %s' % type(tags))
return utils.list_union(self.tags, tags.get_tags()) return utils.list_union(self._tags, tags.get_tags())
def matches(self, tag): def matches(self, tag):
return tag in self.tags return tag in self._tags
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment