return decorator
-def categories(*categories):
+def categories(*all_of, any_of=None):
+ any_of = set(any_of) if any_of else set()
+ all_of = set(all_of) if all_of else set()
+
def decorator(func):
@funcutils.wraps(func)
def wrapper(*args, **kw):
return func(*args, **kw)
- wrapper.categories = categories
+ wrapper.all_categories = all_of
+ wrapper.any_categories = any_of
return wrapper
- decorator.categories = categories
+ decorator.all_categories = all_of
+ decorator.any_categories = any_of
return decorator
key_func = key if key else lambda x: x
result = (s for s in sequence if key_func(s) not in exclude)
return set(result) if isinstance(sequence, Set) else list(result)
+
+
+def is_nova_server(resource):
+ """
+ checks resource is a nova server
+ """
+ return isinstance(resource, dict) and "type" in resource and "properties" in resource and resource.get("type") == "OS::Nova::Server"
+