From 84cee772166fe61235af8ec3afa451f3fea7ef50 Mon Sep 17 00:00:00 2001 From: gursewak1997 Date: Tue, 17 Dec 2024 20:54:42 -0800 Subject: [PATCH] cmdlib: Support old FCOS version in parsing Ensure compatibility with older and newer versions. We have a few builds in testing stream with a different format. An example is 30.20190712.0 --- src/cosalib/cmdlib.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cosalib/cmdlib.py b/src/cosalib/cmdlib.py index 8d73b0e5c8..9a5196429a 100644 --- a/src/cosalib/cmdlib.py +++ b/src/cosalib/cmdlib.py @@ -343,8 +343,9 @@ def parse_fcos_version_to_timestamp(version): ''' Parses an FCOS build ID and verifies the versioning is accurate. Then it verifies that the parsed timestamp has %Y%m%d format and returns that. + Also, parses older format for versions, for eg. 30.20190712.0 ''' - m = re.match(r'^([0-9]{2})\.([0-9]{8})\.([0-9]+|dev)\.([0-9]+)$', version) + m = re.match(r'^([0-9]{2})\.([0-9]{8})\.([0-9]+|dev)(?:\.([0-9]+))?$', version) if m is None: raise Exception(f"Incorrect versioning for FCOS build {version}") try: