diff --git a/.github/workflows/unit_testing.yml b/.github/workflows/unit_testing.yml index 9affa109d..5c7b90a59 100644 --- a/.github/workflows/unit_testing.yml +++ b/.github/workflows/unit_testing.yml @@ -66,8 +66,7 @@ jobs: run: | cd /home/${USER}/.ansible/collections/ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }} ansible-test units --docker default --python ${{ matrix.python-version }} --coverage -v - ansible-test coverage report > coverage.txt - + ansible-test coverage report --include */plugins/* --omit */utils.py* > coverage.txt - name: Code Coverage Check run: | cd /home/${USER}/.ansible/collections/ansible_collections/${{ env.NAMESPACE }}/${{ env.COLLECTION_NAME }} diff --git a/plugins/module_utils/entity.py b/plugins/module_utils/entity.py index 0ea256eb8..149e7ed6b 100644 --- a/plugins/module_utils/entity.py +++ b/plugins/module_utils/entity.py @@ -79,8 +79,11 @@ def get_spec(self): def get_uuid(self, name): data = {"filter": "name=={0}".format(name), "length": 1} resp, status = self.list(data) - if resp and resp.get("entities"): - return resp["entities"][0]["metadata"]["uuid"] + entities = resp.get("entities") if resp else None + if entities: + for entity in entities: + if entity["spec"]["name"] == name: + return entity["metadata"]["uuid"] return None def _build_url(self, module, scheme, resource_type):