Commit 4e4308b8 by Michael DeHaan

Merge branch 'refactor_pass' into devel

parents e24825cb ff87ac08
Subproject commit db5668b84c3a19498b843d0bfe34574aef40c193
Subproject commit 9b35a391213fe87834af5ebc907109de2bc0005f
......@@ -15,7 +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/>.
import v2.utils
import ansible.utils
class Playbook(object):
def __init__(self, filename):
......
......@@ -15,8 +15,11 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
from errors import AnsibleError
from playbook.tag import Tag
class Base(object):
def __init__(self):
pass
def __init__(self):
pass
......@@ -15,15 +15,16 @@
# You should have received a copy of the GNU General Public License
# 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):
def __init__(self, task):
pass
self._task = task
self._conditionals = []
def evaluate(self, context):
pass
def push(self, conditionals):
if not isinstance(conditionals, list):
conditionals = [ conditionals ]
self._conditionals.extend(conditionals)
......@@ -15,19 +15,25 @@
# 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.errors import AnsibleError
from v2.utils import list_union
from errors import AnsibleError
from ansible.utils import list_union
class Tag(object):
def __init__(self, tags=[]):
self.tags = tags
assert isinstance(tags, list)
self._tags = tags
def push(self, tag):
if tag not in self.tags:
self.tags.append(tag)
def push(self, tags):
if not isinstance(tags, list):
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):
return self.tags
return self._tags
def merge(self, tags):
# returns a union of the tags, which can be a string,
......@@ -38,8 +44,8 @@ class Tag(object):
tags = Tag(tags)
elif not isinstance(tags, Tag):
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):
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