summaryrefslogtreecommitdiffstats
path: root/filter_plugins
diff options
context:
space:
mode:
authorBrenton Leanhardt <bleanhar@redhat.com>2016-03-30 14:36:14 -0400
committerBrenton Leanhardt <bleanhar@redhat.com>2016-03-30 15:08:46 -0400
commit5c8e3c5efc9c7cf13923e6fe234fc17c9042419a (patch)
tree90a88c156432bee3b494967d382bbfa4ecfecd11 /filter_plugins
parentd4d0e1dc928adfd70e9ee297f214bd12e802c0c3 (diff)
downloadopenshift-5c8e3c5efc9c7cf13923e6fe234fc17c9042419a.tar.gz
openshift-5c8e3c5efc9c7cf13923e6fe234fc17c9042419a.tar.bz2
openshift-5c8e3c5efc9c7cf13923e6fe234fc17c9042419a.tar.xz
openshift-5c8e3c5efc9c7cf13923e6fe234fc17c9042419a.zip
Bug 1322335 - The package name is wrong for rpm upgrade
Diffstat (limited to 'filter_plugins')
-rw-r--r--filter_plugins/oo_filters.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/filter_plugins/oo_filters.py b/filter_plugins/oo_filters.py
index 3dc3f2fe9..cd67b69a5 100644
--- a/filter_plugins/oo_filters.py
+++ b/filter_plugins/oo_filters.py
@@ -710,6 +710,22 @@ class FilterModule(object):
return retval
+ @staticmethod
+ def oo_image_tag_to_rpm_version(version):
+ """ Convert an image tag string to an RPM version if necessary
+ Empty strings and strings that are already in rpm version format
+ are ignored.
+
+ Ex. v3.2.0.10 -> -3.2.0.10
+ """
+ if not isinstance(version, basestring):
+ raise errors.AnsibleFilterError("|failed expects a string or unicode")
+
+ if version.startswith("v"):
+ version = "-" + version.replace("v", "")
+
+ return version
+
def filters(self):
""" returns a mapping of filters to methods """
return {
@@ -738,4 +754,5 @@ class FilterModule(object):
"oo_31_rpm_rename_conversion": self.oo_31_rpm_rename_conversion,
"oo_pods_match_component": self.oo_pods_match_component,
"oo_get_hosts_from_hostvars": self.oo_get_hosts_from_hostvars,
+ "oo_image_tag_to_rpm_version": self.oo_image_tag_to_rpm_version,
}