Skip to content

Commit

Permalink
Merge "Follow redirects by path_or_url preprocessor validation"
Browse files Browse the repository at this point in the history
  • Loading branch information
Zuul authored and openstack-gerrit committed Feb 20, 2020
2 parents ca0f985 + fe84cbe commit 2b2235f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Changed
* `docker image <https://hub.docker.com/r/xrally/xrally>`_ is switched to use
python3.6.

* *path_or_url* plugin follows redirects while validating urls now.

Fixed
~~~~~

Expand Down
2 changes: 1 addition & 1 deletion rally/plugins/common/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def pre_process(self, resource_spec, config):
if os.path.isfile(path):
return path
try:
head = requests.head(path, verify=False)
head = requests.head(path, verify=False, allow_redirects=True)
if head.status_code == 200:
return path
raise exceptions.InvalidScenarioArgument(
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/plugins/common/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ def test_preprocess_bogus(self, mock_requests_head, mock_isfile):
self.assertRaises(exceptions.InvalidScenarioArgument,
types.PathOrUrl({}, {}).pre_process,
"fake_path", {})
mock_requests_head.assert_called_once_with("fake_path", verify=False)
mock_requests_head.assert_called_once_with(
"fake_path", verify=False, allow_redirects=True)

@mock.patch("os.path.isfile")
@mock.patch("requests.head")
Expand Down

0 comments on commit 2b2235f

Please sign in to comment.