Open remkolodder opened 2 months ago
My colleague reported that
inside vcenter_folder.py, is the only thing that changed between the versions and makes it likely the cause of the issue. If i remove that, it will create the folder as expected.
I am ofcourse willing to create a diff for this and a pull request, but is it something that you did on purpose and what is the reasoning behind it?
It looks like this has been implemented in #1113 in order to fix #1112. At least, that's what I've found out. I don't know more about it.
Apparently indeed, i can also understand why, because on subfolders you might get conflicts, and especially because the abstraction is 'parent folder' together with 'folder name', which can conflict if you have test1/parent_folder/folder_name and test2/parent_folder/folder_name, because which one is the right one? The one under test1 or test2?
I think the empty parent_folder though, is a special case where we say it's on the rootlevel of things, and either exists at rootlevel or not, which is different for folders with a parent folder as mentioned before.
The moid is ofcourse more unique but might make it more tricky to write an abstraction in config:
folders: a: subfolder_b c: subfolder_d
etc will not work with moid, you need to have "key-values" and able to calculate the id of c somewhere and store that so that subfolder_d will be created on the right entity.
SUMMARY
Initially I developed code for my employer, to create a list of folders and subfolders using community.vmware.vcenter_folder. The default version that gets installed on my test instance was 1.7.0 and that created the folders on the place I expect them to be created.
However, for work we use version 4.3.0, and there the same folder is not created as rootfolder, when a subfolder with the same name already exists.
ISSUE TYPE
COMPONENT NAME
community.vmware.vcenter_folder
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
The error can be reproduced on multiple different versions on different hardware. The version used is 1.7.0 which works and 4.3.0 that does not work.
STEPS TO REPRODUCE
run the below playbook and see the output of the task using v 4.3.0:
/home/remko/.ansible/collections/ansible_collections
Collection Version
community.vmware 4.3.0
/usr/lib/python3/dist-packages/ansible_collections
Collection Version
community.vmware 1.7.0
ansible-playbook -vvvv ./playbookfile.yaml
EXPECTED RESULTS
TASK [Create rootfolder] **** task path: /home/remko/workspace/git/scripts/ansible/projects/folders_demo/local_build_folders.yaml:14 Read vars_file 'credentials.yaml'