We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It is currently not possible to update / modify or delete vmware images created by the Image module
# rpm -q ansible-collection-theforeman-foreman ansible-collection-theforeman-foreman-0.7.0
ansible 2.9.10 config file = /etc/ansible/ansible.cfg configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/lib/python2.7/site-packages/ansible executable location = /usr/bin/ansible python version = 2.7.5 (default, Apr 2 2020, 13:16:51) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
tfm-rubygem-katello-3.14.1 foreman-1.24.3
Generating an image on the first run works fine, a second run ends in failed state
- hosts: all tasks: - name: define default variables set_fact: tfm_connection: &tfm_connection username: "admin" password: "secret" server_url: "https://localhost" validate_certs: "false" - name: centos 7 image creation in ESX1 theforeman.foreman.image: <<: *tfm_connection state: present name: "CentOS 7" uuid: "502f263f-6f70-a568-d0c9-7e25f4993ae0" image_username: "ansible" operatingsystem: "CentOS 7" compute_resource: "ESX1" architecture: "x86_64" user_data: true
Running the task a second time would update the image
Running the task a second time throws an error
TASK [centos 7 image creation in ESX1] *************************************************************************************************************************************************************************************************** fatal: [localhost]: FAILED! => {"changed": false, "error": {"errors": {"name": ["has already been taken"], "uuid": ["has already been taken"]}, "full_messages": ["Name has already been taken", "UUID has already been taken"], "id": null}, "msg": "Error while performing create on images: 422 Client Error: Unprocessable Entity"} PLAY RECAP *********************************************************************************************************************************************************************************************************************************** localhost : ok=2 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
According to the foreman api docs POST should be used for creating an image and PUT to update it https://theforeman.org/plugins/katello/3.14/api/apidoc/v2/images/update.html
The error might be caused by the module using POST instead of PUT on both runs
Additionally changing state: present to absent does not delete the image
state: present
absent
The text was updated successfully, but these errors were encountered:
This looks like it can't find the image it just created and tries to create a new one instead of updating (or deleting) it.
@Fobhep and @hlawatschek will love to look into that as time permits.
Sorry, something went wrong.
It seems that this error occurs only when you try to change the image name or name includes a space character.
add changelog for issue theforeman#927
0c7dd25
add changelog for issue #927
91ef150
a9c6cc8
Successfully merging a pull request may close this issue.
SUMMARY
It is currently not possible to update / modify or delete vmware images created by the Image module
ISSUE TYPE
ANSIBLE VERSION
KATELLO/FOREMAN VERSION
STEPS TO REPRODUCE
Generating an image on the first run works fine, a second run ends in failed state
EXPECTED RESULTS
Running the task a second time would update the image
ACTUAL RESULTS
Running the task a second time throws an error
According to the foreman api docs POST should be used for creating an image and PUT to update it
https://theforeman.org/plugins/katello/3.14/api/apidoc/v2/images/update.html
The error might be caused by the module using POST instead of PUT on both runs
Additionally changing
state: present
toabsent
does not delete the imageThe text was updated successfully, but these errors were encountered: