@ -28,7 +28,7 @@ from ansible.template import Templar
class Taggable :
class Taggable :
untagged = set( [ ' untagged ' ] )
untagged = frozen set( [ ' untagged ' ] )
_tags = FieldAttribute ( isa = ' list ' , default = [ ] , listof = ( string_types , int ) )
_tags = FieldAttribute ( isa = ' list ' , default = [ ] , listof = ( string_types , int ) )
def __init__ ( self ) :
def __init__ ( self ) :
@ -70,8 +70,8 @@ class Taggable:
else :
else :
tags = set ( [ i for i , _ in itertools . groupby ( tags ) ] )
tags = set ( [ i for i , _ in itertools . groupby ( tags ) ] )
else :
else :
# this makes i ntersection work for untagged
# this makes i sdisjoint work for untagged
tags = self . __class__ . untagged
tags = self . untagged
if only_tags :
if only_tags :
@ -79,9 +79,9 @@ class Taggable:
if ' always ' in tags or ' all ' in only_tags :
if ' always ' in tags or ' all ' in only_tags :
should_run = True
should_run = True
elif tags . intersection ( only_tags ) :
elif not tags . isdisjoint ( only_tags ) :
should_run = True
should_run = True
elif ' tagged ' in only_tags and tags != self . __class__ . untagged :
elif ' tagged ' in only_tags and tags != self . untagged :
should_run = True
should_run = True
if should_run and skip_tags :
if should_run and skip_tags :
@ -90,9 +90,9 @@ class Taggable:
if ' all ' in skip_tags :
if ' all ' in skip_tags :
if ' always ' not in tags or ' always ' in skip_tags :
if ' always ' not in tags or ' always ' in skip_tags :
should_run = False
should_run = False
elif tags . intersection ( skip_tags ) :
elif not tags . isdisjoint ( skip_tags ) :
should_run = False
should_run = False
elif ' tagged ' in skip_tags and tags != self . __class__ . untagged :
elif ' tagged ' in skip_tags and tags != self . untagged :
should_run = False
should_run = False
return should_run
return should_run