diff options
Diffstat (limited to 'filter_plugins')
-rw-r--r-- | filter_plugins/oo_filters.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/filter_plugins/oo_filters.py b/filter_plugins/oo_filters.py index b81c3bf7f..54891b066 100644 --- a/filter_plugins/oo_filters.py +++ b/filter_plugins/oo_filters.py @@ -881,17 +881,20 @@ class FilterModule(object): """ if not isinstance(version, basestring): raise errors.AnsibleFilterError("|failed expects a string or unicode") - # TODO: Do we need to make this actually convert v1.2.0-rc1 into 1.2.0-0.rc1 - # We'd need to be really strict about how we build the RPM Version+Release if version.startswith("v"): - version = version.replace("v", "") + version = version[1:] + # Strip release from requested version, we no longer support this. version = version.split('-')[0] - if include_dash: - version = "-" + version + if include_dash and version and not version.startswith("-"): + version = "-" + version return version + @staticmethod + def oo_startswith(input, prefix): + return input.startswith(prefix) + def filters(self): """ returns a mapping of filters to methods """ return { @@ -925,4 +928,5 @@ class FilterModule(object): "oo_oc_nodes_matching_selector": self.oo_oc_nodes_matching_selector, "oo_oc_nodes_with_label": self.oo_oc_nodes_with_label, "oo_merge_hostvars": self.oo_merge_hostvars, + "oo_startswith": self.oo_startswith, } |