1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

VMware: Restrict vcenter_folder for vCenter

Folder creation API is only supported by vCenter, specifying
Standalone ESXi system will raise error.
This fix adds an user warning for suggesting this restriction.

Fixes: 

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2019-06-11 15:28:34 +05:30 committed by Gonéri Le Bouder
parent 31bec0dd95
commit 6c23a8df66
2 changed files with 6 additions and 0 deletions
changelogs/fragments
lib/ansible/modules/cloud/vmware

View file

@ -0,0 +1,2 @@
minor_changes:
- Restrict vcenter_folder to vCenter only, since folder creation api is not supported on ESXi hostsystem (https://github.com/ansible/ansible/issues/49938).

View file

@ -19,6 +19,7 @@ module: vcenter_folder
short_description: Manage folders on given datacenter
description:
- This module can be used to create, delete, move and rename folder on then given datacenter.
- This module is only supported for vCenter.
version_added: '2.5'
author:
- Abhijeet Kasurde (@Akasurde)
@ -330,6 +331,9 @@ def main():
module.fail_json(msg="Failed to manage folder as folder_name can only contain 80 characters.")
vcenter_folder_mgr = VmwareFolderManager(module)
if not vcenter_folder_mgr.is_vcenter():
module.fail_json(msg="Module vcenter_folder is meant for vCenter, hostname %s "
"is not vCenter server." % module.params.get('hostname'))
vcenter_folder_mgr.ensure()