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

Handle special service where package is not available (#45155)

There are several services e.g. vmware-fdm, which does not have package name and
package description which will raise a error if queried for.

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2018-09-04 17:03:44 +05:30 committed by GitHub
parent 885ee25375
commit b3b65d16b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -108,16 +108,18 @@ class VmwareServiceManager(PyVmomi):
if host_service_system: if host_service_system:
services = host_service_system.serviceInfo.service services = host_service_system.serviceInfo.service
for service in services: for service in services:
host_service_facts.append(dict(key=service.key, host_service_facts.append(
label=service.label, dict(
required=service.required, key=service.key,
uninstallable=service.uninstallable, label=service.label,
running=service.running, required=service.required,
policy=service.policy, uninstallable=service.uninstallable,
source_package_name=service.sourcePackage.sourcePackageName, running=service.running,
source_package_desc=service.sourcePackage.description, policy=service.policy,
) source_package_name=service.sourcePackage.sourcePackageName if service.sourcePackage else 'NA',
) source_package_desc=service.sourcePackage.description if service.sourcePackage else 'NA',
)
)
hosts_facts[host.name] = host_service_facts hosts_facts[host.name] = host_service_facts
return hosts_facts return hosts_facts
@ -133,7 +135,8 @@ def main():
argument_spec=argument_spec, argument_spec=argument_spec,
required_one_of=[ required_one_of=[
['cluster_name', 'esxi_hostname'], ['cluster_name', 'esxi_hostname'],
] ],
supports_check_mode=True,
) )
vmware_host_service_config = VmwareServiceManager(module) vmware_host_service_config = VmwareServiceManager(module)