theforeman / foreman-ansible-modules

Ansible modules for interacting with the Foreman API and various plugin APIs such as Katello
GNU General Public License v3.0
147 stars 163 forks source link

foreman_location provides incorrect information when removing parent location #397

Closed m-czernek closed 5 years ago

m-czernek commented 5 years ago
SUMMARY

When removing parent location that has defined children, we get state changed:

changed: [server1 -> localhost] => (item={'parent': 'loc_parent', 'children': ['dev', 'qa', 'prod']})

However, the location is still there (and so are the children).

Suggestion for bugfix: The above should fail.

Suggestion for improvement: Add option "force" or "recursive" that'd delete first all the children, then the parent location itself.

ISSUE TYPE
ANSIBLE VERSION
ansible 2.8.3
  config file = /home/mczernek/ansible.cfg
  configured module search path = ['/home/mczernek/library', '/home/mczernek/foreman-ansible-modules/plugins/modules']
  ansible python module location = /home/mczernek/foreman-ansible-modules-venv/lib64/python3.7/site-packages/ansible
  executable location = /home/mczernek/foreman-ansible-modules-venv/bin/ansible
  python version = 3.7.4 (default, Jul  9 2019, 16:32:37) [GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]
KATELLO/FOREMAN VERSION
tfm-rubygem-katello-3.10.0.54-1.el7sat.noarch
foreman-1.20.1.35-1.el7sat.noarch
NAILGUN VERSION
Version: 0.32.0

Nailgun for Satellite 6.5 is undefined

evgeni commented 5 years ago

This is "known" in https://projects.theforeman.org/issues/26937

evgeni commented 5 years ago

@m-czernek please try https://github.com/theforeman/foreman-ansible-modules/pull/437