-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/61715/
-----------------------------------------------------------
Review request for Ambari and Vitalyi Brodetskyi.
Bugs: AMBARI-21744
https://issues.apache.org/jira/browse/AMBARI-21744
Repository: ambari
Description
-------
Due to the issue with regex (missing ^ and $ boundaries),
resource_management.libraries.script.script.Script#get_package_from_available
may return wrong package.
{code}
>>> list=['hbase_3_0_0_0_229-master', 'hbase_3_0_0_0_229']
>>> if re.match('hbase_(\d|_)+', 'hbase_3_0_0_0_229-master'):
... print 'YES'
...
YES
>>> if re.match('hbase_(\d|_)+', 'hbase_3_0_0_0_229'):
... print 'YES'
...
YES
{code}
In this case, the first package name from a list of available packages will be
returned.
The impact of bug is that we may install a wrong package if it's simillary
named and goes first at list. Patch is a single-line fix.
Diffs
-----
ambari-common/src/main/python/resource_management/libraries/script/script.py
54a7e6df6f
Diff: https://reviews.apache.org/r/61715/diff/1/
Testing
-------
mvn clean test
Thanks,
Dmitro Lisnichenko