summaryrefslogtreecommitdiffstats
path: root/filter_plugins
diff options
context:
space:
mode:
authorTim Bielawa <tbielawa@redhat.com>2016-11-14 09:15:45 -0800
committerTim Bielawa <tbielawa@redhat.com>2016-11-14 10:07:37 -0800
commit54820399a202a687b0251febbab64fb590577234 (patch)
tree97c021d0a4a00131736254648e4038e9c2ca682d /filter_plugins
parentb29e9340544cbfb127e0a7f6be88f8b4f2818b4d (diff)
downloadopenshift-54820399a202a687b0251febbab64fb590577234.tar.gz
openshift-54820399a202a687b0251febbab64fb590577234.tar.bz2
openshift-54820399a202a687b0251febbab64fb590577234.tar.xz
openshift-54820399a202a687b0251febbab64fb590577234.zip
Fix commit-offsets in version detection for containerized installs
* Applies the chomp_commit_offset logic to container version detection https://bugzilla.redhat.com/show_bug.cgi?id=1389137
Diffstat (limited to 'filter_plugins')
-rw-r--r--filter_plugins/oo_filters.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/filter_plugins/oo_filters.py b/filter_plugins/oo_filters.py
index 93fdd5ae4..97eacf9bf 100644
--- a/filter_plugins/oo_filters.py
+++ b/filter_plugins/oo_filters.py
@@ -889,11 +889,32 @@ class FilterModule(object):
'servers': FilterModule.oo_haproxy_backend_masters(servers_hostvars, nuage_rest_port)})
return loadbalancer_backends
+ @staticmethod
+ def oo_chomp_commit_offset(version):
+ """Chomp any "+git.foo" commit offset string from the given `version`
+ and return the modified version string.
+
+ Ex:
+ - chomp_commit_offset(None) => None
+ - chomp_commit_offset(1337) => "1337"
+ - chomp_commit_offset("v3.4.0.15+git.derp") => "v3.4.0.15"
+ - chomp_commit_offset("v3.4.0.15") => "v3.4.0.15"
+ - chomp_commit_offset("v1.3.0+52492b4") => "v1.3.0"
+ """
+ if version is None:
+ return version
+ else:
+ # Stringify, just in case it's a Number type. Split by '+' and
+ # return the first split. No concerns about strings without a
+ # '+', .split() returns an array of the original string.
+ return str(version).split('+')[0]
+
def filters(self):
""" returns a mapping of filters to methods """
return {
"oo_select_keys": self.oo_select_keys,
"oo_select_keys_from_list": self.oo_select_keys_from_list,
+ "oo_chomp_commit_offset": self.oo_chomp_commit_offset,
"oo_collect": self.oo_collect,
"oo_flatten": self.oo_flatten,
"oo_pdb": self.oo_pdb,