diff options
author | Nimesh <nimesh.patni@msystechnologies.com> | 2018-09-27 08:35:02 +0530 |
---|---|---|
committer | Nimesh <nimesh.patni@msystechnologies.com> | 2018-09-27 08:35:02 +0530 |
commit | 348cc974110f494527663e72ffd89a41ecd66471 (patch) | |
tree | a89b97849362b1eac77d3574eab857cb47e86ca3 | |
parent | 8daa1c6598182777802eba6a74928f28a32f6835 (diff) | |
download | chef-348cc974110f494527663e72ffd89a41ecd66471.tar.gz |
Minor improvement to raise the error for invalid strings within first check
- Instead of calling searchProvides and then raising error from string_to_prco_tuple
- catch the names having any whitespaces within the first condition itself
- valid: "foo <=> version"; Invalid: "foo bar baz"
Signed-off-by: Nimesh <nimesh.patni@msystechnologies.com>
-rw-r--r-- | lib/chef/provider/package/yum/yum_helper.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/chef/provider/package/yum/yum_helper.py b/lib/chef/provider/package/yum/yum_helper.py index d2c04c72db..7e99951555 100644 --- a/lib/chef/provider/package/yum/yum_helper.py +++ b/lib/chef/provider/package/yum/yum_helper.py @@ -125,8 +125,9 @@ def query(command): # - in order to fix this, something would have to happen where getProvides was called first and # then the result was searchNevra'd. please be extremely careful if attempting to fix that # since searchNevra does not support prco tuples. - if any(elem in command['provides'] for elem in r"<=>"): - # handles flags (<, >, =, etc) and versions, but no wildcareds + if bool(re.search('\\s+', command['provides'])): + # handles flags (<, >, =, etc) and versions, but no wildcareds + # raises error for any invalid input like: 'FOO BAR BAZ' pkgs = obj.getProvides(*string_to_prco_tuple(command['provides'])) elif do_nevra: # now if we're given version or arch properties explicitly, then we do a SearchNevra. |