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

list vapps module #380

Merged
merged 1 commit into from
Jun 2, 2023
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
29 changes: 29 additions & 0 deletions src/saltext/vmware/modules/vsphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,32 @@ def list_networks(
config=__opts__, profile=profile
)
return utils_vsphere.list_networks(service_instance)


def list_vapps(
service_instance=None,
profile=None,
):
"""
.. versionadded:: <<VERSION>>

Returns a list of vApps for the specified host.

service_instance
Use this vCenter service connection instance instead of creating a new one. (optional).

profile
Profile to use (optional)

CLI Example:

.. code-block:: bash

# List vapps from all minions
salt '*' vmware_vsphere.list_vapps
"""
log.debug("Running vmware_vsphere.list_vapps")
service_instance = service_instance or utils_connect.get_service_instance(
config=__opts__, profile=profile
)
return utils_vsphere.list_vapps(service_instance)
9 changes: 9 additions & 0 deletions tests/integration/modules/test_vsphere.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,12 @@ def test_list_networks(service_instance):
assert ret
for network in ret:
assert isinstance(network, str)


def test_list_vapps(service_instance):
ret = vsphere.list_vapps(
service_instance=service_instance,
)
assert ret
for app in ret:
assert isinstance(app, str)