Skip to content

Commit

Permalink
Fixed an issue where if version was not specified in ah_collection an…
Browse files Browse the repository at this point in the history
…d state=absent then the module will fail
  • Loading branch information
Tompage1994 committed Apr 17, 2024
1 parent 486c6c8 commit 41d5b93
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions changelogs/fragments/bug_collection_delete.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
bugfixes:
- Fixed an issue where if version was not specified in ah_collection and state=absent then the module will fail
...
2 changes: 1 addition & 1 deletion plugins/modules/ah_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ def main():
if auto_approve:
if version:
pass
else:
elif path:
version = path.split("-")[-1].replace('.tar.gz', '')

# Attempt to look up an existing item based on the provided data
Expand Down
5 changes: 5 additions & 0 deletions tests/playbooks/ah_configs/ah_collections.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ ah_collections_overwrite:
timeout: 180
overwrite_existing: true

ah_collections_delete:
- namespace: galaxy
name: galaxy
state: absent

ah_git_collections:
- collection_name: collection_test
git_url: https://github.com/sean-m-sullivan/collection_test
Expand Down
6 changes: 6 additions & 0 deletions tests/playbooks/testing_collections_playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@
vars:
ah_collections: "{{ ah_collections_overwrite }}"

- name: Delete Collection
ansible.builtin.include_role:
name: collection
vars:
ah_collections: "{{ ah_collections_delete }}"

- name: Publish Collections
ansible.builtin.include_role:
name: publish
Expand Down

0 comments on commit 41d5b93

Please sign in to comment.