Skip to content
New issue

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

vm_name now not a required variable #93

Merged
merged 7 commits into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/93-bugfix-vm_name-required.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
minor_changes:
- info - Made vm_name variable required only when state is set to present in content_template module
5 changes: 3 additions & 2 deletions plugins/modules/content_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
vm_name:
description:
- The name of the VM to be used to create template.
- This attribute is required only when the state attribute is set to present
type: str
required: true
anna-savina marked this conversation as resolved.
Show resolved Hide resolved
host:
description:
- Host onto which the virtual machine template should be placed.
Expand Down Expand Up @@ -206,7 +206,7 @@ def main():
argument_spec.update(
template=dict(type='str', required=True),
library=dict(type='str', required=True),
vm_name=dict(type='str', required=True),
vm_name=dict(type='str'),
host=dict(type='str'),
cluster=dict(type='str'),
resource_pool=dict(type='str'),
Expand All @@ -217,6 +217,7 @@ def main():
argument_spec=argument_spec,
supports_check_mode=True,
required_one_of=[('host', 'resource_pool', 'cluster')],
required_if=[('state', 'present', ["vm_name"])]
)

result = {'failed': False, 'changed': False}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
port: "{{ vcenter_port }}"
template: "{{ template_name }}"
library: "{{ library }}"
vm_name: "{{ vm }}"
host: "{{ template_host }}"
state: absent
when: not run_on_simulator
Expand Down
Loading