Skip to content

Commit

Permalink
Merge pull request CentOS-PaaS-SIG#1694 from Dannyb48/beaker_xmlrpc_err
Browse files Browse the repository at this point in the history
Merged by Jenkins
  • Loading branch information
cp-bot authored Mar 17, 2020
2 parents 07022ba + 2fddbad commit 071b12b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion linchpin/FilterUtils/FilterUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,12 @@ def fetch_beaker_job_ids(topo_out):
for entry in topo_out:
entry_dict = {}
entry_dict["ids"] = []
if "id" in list(entry):
# filter out if the resource's job id has already
# been added. Workaround for Beaker server xmlrpc
# issue on python2
if "id" in list(entry) and not \
[id for ed in output
for id in ed.get("ids", []) if entry.get("id") == id[2:]]:
entry_dict["ids"].append("J:" + entry["id"])
output.append(entry_dict)
return output
Expand Down
7 changes: 7 additions & 0 deletions linchpin/tests/InventoryFilters/test_FilterPlugins_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ def test_fetch_beaker_job_ids():
assert_equals(expected,
filter_utils.fetch_beaker_job_ids(test_input))


def test_fetch_beaker_job_ids_count():
test_input = [{"id": "3124"}, {"id": "3124"}, {"id": "3214"}]
expected = [{'ids': ['J:3124']}, {'ids': ['J:3214']}]
assert_equals(expected,
filter_utils.fetch_beaker_job_ids(test_input))

def test_fetch_os_server_names():
test_input = [ {"resource_group": "openstack",
"role": "os_server",
Expand Down

0 comments on commit 071b12b

Please sign in to comment.