mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-26 04:11:25 -07:00
cloud: ovirt: logout if token is not used (#21517)
This commit is contained in:
parent
b2d4eeb293
commit
9fe0ae082a
39 changed files with 117 additions and 78 deletions
|
@ -293,7 +293,8 @@ def main():
|
||||||
)
|
)
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
# Check if unsupported parameters were passed:
|
# Check if unsupported parameters were passed:
|
||||||
supported_41 = ('host_enforcing', 'host_rule', 'hosts')
|
supported_41 = ('host_enforcing', 'host_rule', 'hosts')
|
||||||
if not check_support(
|
if not check_support(
|
||||||
|
@ -346,7 +347,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -181,7 +181,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
affinity_labels_service = connection.system_service().affinity_labels_service()
|
affinity_labels_service = connection.system_service().affinity_labels_service()
|
||||||
affinity_labels_module = AffinityLabelsModule(
|
affinity_labels_module = AffinityLabelsModule(
|
||||||
connection=connection,
|
connection=connection,
|
||||||
|
@ -199,7 +200,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -110,7 +110,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
affinity_labels_service = connection.system_service().affinity_labels_service()
|
affinity_labels_service = connection.system_service().affinity_labels_service()
|
||||||
labels = []
|
labels = []
|
||||||
all_labels = affinity_labels_service.list()
|
all_labels = affinity_labels_service.list()
|
||||||
|
@ -155,7 +156,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -540,7 +540,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
clusters_service = connection.system_service().clusters_service()
|
clusters_service = connection.system_service().clusters_service()
|
||||||
clusters_module = ClustersModule(
|
clusters_module = ClustersModule(
|
||||||
connection=connection,
|
connection=connection,
|
||||||
|
@ -558,7 +559,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -81,7 +81,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
clusters_service = connection.system_service().clusters_service()
|
clusters_service = connection.system_service().clusters_service()
|
||||||
clusters = clusters_service.list(search=module.params['pattern'])
|
clusters = clusters_service.list(search=module.params['pattern'])
|
||||||
module.exit_json(
|
module.exit_json(
|
||||||
|
@ -100,7 +101,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -195,7 +195,8 @@ def main():
|
||||||
check_params(module)
|
check_params(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
data_centers_service = connection.system_service().data_centers_service()
|
data_centers_service = connection.system_service().data_centers_service()
|
||||||
clusters_module = DatacentersModule(
|
clusters_module = DatacentersModule(
|
||||||
connection=connection,
|
connection=connection,
|
||||||
|
@ -213,7 +214,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -80,7 +80,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
datacenters_service = connection.system_service().data_centers_service()
|
datacenters_service = connection.system_service().data_centers_service()
|
||||||
datacenters = datacenters_service.list(search=module.params['pattern'])
|
datacenters = datacenters_service.list(search=module.params['pattern'])
|
||||||
module.exit_json(
|
module.exit_json(
|
||||||
|
@ -99,7 +100,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -448,7 +448,8 @@ def main():
|
||||||
try:
|
try:
|
||||||
disk = None
|
disk = None
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
connection = create_connection(module.params.get('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
disks_service = connection.system_service().disks_service()
|
disks_service = connection.system_service().disks_service()
|
||||||
disks_module = DisksModule(
|
disks_module = DisksModule(
|
||||||
connection=connection,
|
connection=connection,
|
||||||
|
@ -518,7 +519,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -247,7 +247,8 @@ def main():
|
||||||
check_params(module)
|
check_params(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
provider_type, external_providers_service = _external_provider_service(
|
provider_type, external_providers_service = _external_provider_service(
|
||||||
provider_type=module.params.get('type'),
|
provider_type=module.params.get('type'),
|
||||||
system_service=connection.system_service(),
|
system_service=connection.system_service(),
|
||||||
|
@ -269,7 +270,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -119,7 +119,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
external_providers_service = _external_provider_service(
|
external_providers_service = _external_provider_service(
|
||||||
provider_type=module.params.pop('type'),
|
provider_type=module.params.pop('type'),
|
||||||
system_service=connection.system_service(),
|
system_service=connection.system_service(),
|
||||||
|
@ -148,7 +149,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -156,7 +156,8 @@ def main():
|
||||||
check_params(module)
|
check_params(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
groups_service = connection.system_service().groups_service()
|
groups_service = connection.system_service().groups_service()
|
||||||
groups_module = GroupsModule(
|
groups_module = GroupsModule(
|
||||||
connection=connection,
|
connection=connection,
|
||||||
|
@ -174,7 +175,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -80,7 +80,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
groups_service = connection.system_service().groups_service()
|
groups_service = connection.system_service().groups_service()
|
||||||
groups = groups_service.list(search=module.params['pattern'])
|
groups = groups_service.list(search=module.params['pattern'])
|
||||||
module.exit_json(
|
module.exit_json(
|
||||||
|
@ -99,7 +100,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -255,7 +255,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
hosts_service = connection.system_service().hosts_service()
|
hosts_service = connection.system_service().hosts_service()
|
||||||
host_networks_module = HostNetworksModule(
|
host_networks_module = HostNetworksModule(
|
||||||
connection=connection,
|
connection=connection,
|
||||||
|
@ -373,7 +374,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -196,7 +196,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
hosts_service = connection.system_service().hosts_service()
|
hosts_service = connection.system_service().hosts_service()
|
||||||
host = search_by_name(hosts_service, module.params['name'])
|
host = search_by_name(hosts_service, module.params['name'])
|
||||||
fence_agents_service = hosts_service.host_service(host.id).fence_agents_service()
|
fence_agents_service = hosts_service.host_service(host.id).fence_agents_service()
|
||||||
|
@ -237,7 +238,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -339,7 +339,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
hosts_service = connection.system_service().hosts_service()
|
hosts_service = connection.system_service().hosts_service()
|
||||||
hosts_module = HostsModule(
|
hosts_module = HostsModule(
|
||||||
connection=connection,
|
connection=connection,
|
||||||
|
@ -449,7 +450,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -82,7 +82,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
hosts_service = connection.system_service().hosts_service()
|
hosts_service = connection.system_service().hosts_service()
|
||||||
hosts = hosts_service.list(search=module.params['pattern'])
|
hosts = hosts_service.list(search=module.params['pattern'])
|
||||||
module.exit_json(
|
module.exit_json(
|
||||||
|
@ -101,7 +102,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -154,7 +154,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
mac_pools_service = connection.system_service().mac_pools_service()
|
mac_pools_service = connection.system_service().mac_pools_service()
|
||||||
mac_pools_module = MACPoolModule(
|
mac_pools_module = MACPoolModule(
|
||||||
connection=connection,
|
connection=connection,
|
||||||
|
@ -172,7 +173,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -217,7 +217,8 @@ def main():
|
||||||
check_params(module)
|
check_params(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
clusters_service = connection.system_service().clusters_service()
|
clusters_service = connection.system_service().clusters_service()
|
||||||
networks_service = connection.system_service().networks_service()
|
networks_service = connection.system_service().networks_service()
|
||||||
networks_module = NetworksModule(
|
networks_module = NetworksModule(
|
||||||
|
@ -261,7 +262,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -82,7 +82,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
networks_service = connection.system_service().networks_service()
|
networks_service = connection.system_service().networks_service()
|
||||||
networks = networks_service.list(search=module.params['pattern'])
|
networks = networks_service.list(search=module.params['pattern'])
|
||||||
module.exit_json(
|
module.exit_json(
|
||||||
|
@ -101,7 +102,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -185,7 +185,8 @@ def main():
|
||||||
try:
|
try:
|
||||||
# Locate the service that manages the virtual machines and use it to
|
# Locate the service that manages the virtual machines and use it to
|
||||||
# search for the NIC:
|
# search for the NIC:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
vms_service = connection.system_service().vms_service()
|
vms_service = connection.system_service().vms_service()
|
||||||
|
|
||||||
# Locate the VM, where we will manage NICs:
|
# Locate the VM, where we will manage NICs:
|
||||||
|
@ -240,7 +241,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -87,7 +87,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
vms_service = connection.system_service().vms_service()
|
vms_service = connection.system_service().vms_service()
|
||||||
vm_name = module.params['vm']
|
vm_name = module.params['vm']
|
||||||
vm = search_by_name(vms_service, vm_name)
|
vm = search_by_name(vms_service, vm_name)
|
||||||
|
@ -119,7 +120,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -285,7 +285,8 @@ def main():
|
||||||
module.fail_json(msg='"user_name" or "group_name" is required')
|
module.fail_json(msg='"user_name" or "group_name" is required')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
permissions_service = _object_service(connection, module).permissions_service()
|
permissions_service = _object_service(connection, module).permissions_service()
|
||||||
permissions_module = PermissionsModule(
|
permissions_module = PermissionsModule(
|
||||||
connection=connection,
|
connection=connection,
|
||||||
|
@ -304,7 +305,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -115,7 +115,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
permissions_service = _permissions_service(connection, module)
|
permissions_service = _permissions_service(connection, module)
|
||||||
permissions = []
|
permissions = []
|
||||||
for p in permissions_service.list():
|
for p in permissions_service.list():
|
||||||
|
@ -132,7 +133,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -238,7 +238,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
datacenters_service = connection.system_service().data_centers_service()
|
datacenters_service = connection.system_service().data_centers_service()
|
||||||
dc_name = module.params['datacenter']
|
dc_name = module.params['datacenter']
|
||||||
dc_id = getattr(search_by_name(datacenters_service, dc_name), 'id', None)
|
dc_id = getattr(search_by_name(datacenters_service, dc_name), 'id', None)
|
||||||
|
@ -290,7 +291,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -86,7 +86,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
datacenters_service = connection.system_service().data_centers_service()
|
datacenters_service = connection.system_service().data_centers_service()
|
||||||
dc_name = module.params['datacenter']
|
dc_name = module.params['datacenter']
|
||||||
dc = search_by_name(datacenters_service, dc_name)
|
dc = search_by_name(datacenters_service, dc_name)
|
||||||
|
@ -118,7 +119,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -242,7 +242,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
vm_name = module.params.get('vm_name')
|
vm_name = module.params.get('vm_name')
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
vms_service = connection.system_service().vms_service()
|
vms_service = connection.system_service().vms_service()
|
||||||
vm = search_by_name(vms_service, vm_name)
|
vm = search_by_name(vms_service, vm_name)
|
||||||
if not vm:
|
if not vm:
|
||||||
|
@ -264,7 +265,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -93,7 +93,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
vms_service = connection.system_service().vms_service()
|
vms_service = connection.system_service().vms_service()
|
||||||
vm_name = module.params['vm']
|
vm_name = module.params['vm']
|
||||||
vm = search_by_name(vms_service, vm_name)
|
vm = search_by_name(vms_service, vm_name)
|
||||||
|
@ -129,7 +130,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -425,7 +425,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
storage_domains_service = connection.system_service().storage_domains_service()
|
storage_domains_service = connection.system_service().storage_domains_service()
|
||||||
storage_domains_module = StorageDomainModule(
|
storage_domains_module = StorageDomainModule(
|
||||||
connection=connection,
|
connection=connection,
|
||||||
|
@ -470,7 +471,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -82,7 +82,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
storage_domains_service = connection.system_service().storage_domains_service()
|
storage_domains_service = connection.system_service().storage_domains_service()
|
||||||
storage_domains = storage_domains_service.list(search=module.params['pattern'])
|
storage_domains = storage_domains_service.list(search=module.params['pattern'])
|
||||||
module.exit_json(
|
module.exit_json(
|
||||||
|
@ -101,7 +102,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -187,7 +187,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
tags_service = connection.system_service().tags_service()
|
tags_service = connection.system_service().tags_service()
|
||||||
tags_module = TagsModule(
|
tags_module = TagsModule(
|
||||||
connection=connection,
|
connection=connection,
|
||||||
|
@ -205,7 +206,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -101,7 +101,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
tags_service = connection.system_service().tags_service()
|
tags_service = connection.system_service().tags_service()
|
||||||
tags = []
|
tags = []
|
||||||
all_tags = tags_service.list()
|
all_tags = tags_service.list()
|
||||||
|
@ -146,7 +147,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -223,7 +223,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
templates_service = connection.system_service().templates_service()
|
templates_service = connection.system_service().templates_service()
|
||||||
templates_module = TemplatesModule(
|
templates_module = TemplatesModule(
|
||||||
connection=connection,
|
connection=connection,
|
||||||
|
@ -306,7 +307,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -82,7 +82,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
templates_service = connection.system_service().templates_service()
|
templates_service = connection.system_service().templates_service()
|
||||||
templates = templates_service.list(search=module.params['pattern'])
|
templates = templates_service.list(search=module.params['pattern'])
|
||||||
module.exit_json(
|
module.exit_json(
|
||||||
|
@ -101,7 +102,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -135,7 +135,8 @@ def main():
|
||||||
check_params(module)
|
check_params(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
users_service = connection.system_service().users_service()
|
users_service = connection.system_service().users_service()
|
||||||
users_module = UsersModule(
|
users_module = UsersModule(
|
||||||
connection=connection,
|
connection=connection,
|
||||||
|
@ -161,7 +162,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -80,7 +80,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
users_service = connection.system_service().users_service()
|
users_service = connection.system_service().users_service()
|
||||||
users = users_service.list(search=module.params['pattern'])
|
users = users_service.list(search=module.params['pattern'])
|
||||||
module.exit_json(
|
module.exit_json(
|
||||||
|
@ -99,7 +100,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
@ -183,7 +183,8 @@ def main():
|
||||||
check_params(module)
|
check_params(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
vm_pools_service = connection.system_service().vm_pools_service()
|
vm_pools_service = connection.system_service().vm_pools_service()
|
||||||
vm_pools_module = VmPoolsModule(
|
vm_pools_module = VmPoolsModule(
|
||||||
connection=connection,
|
connection=connection,
|
||||||
|
@ -212,7 +213,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -80,7 +80,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
vmpools_service = connection.system_service().vm_pools_service()
|
vmpools_service = connection.system_service().vm_pools_service()
|
||||||
vmpools = vmpools_service.list(search=module.params['pattern'])
|
vmpools = vmpools_service.list(search=module.params['pattern'])
|
||||||
module.exit_json(
|
module.exit_json(
|
||||||
|
@ -99,7 +100,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
|
@ -937,7 +937,8 @@ def main():
|
||||||
|
|
||||||
try:
|
try:
|
||||||
state = module.params['state']
|
state = module.params['state']
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
vms_service = connection.system_service().vms_service()
|
vms_service = connection.system_service().vms_service()
|
||||||
vms_module = VmsModule(
|
vms_module = VmsModule(
|
||||||
connection=connection,
|
connection=connection,
|
||||||
|
@ -1053,7 +1054,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout='token' not in module.params['auth'])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -95,7 +95,8 @@ def main():
|
||||||
check_sdk(module)
|
check_sdk(module)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection = create_connection(module.params.pop('auth'))
|
auth = module.params.pop('auth')
|
||||||
|
connection = create_connection(auth)
|
||||||
vms_service = connection.system_service().vms_service()
|
vms_service = connection.system_service().vms_service()
|
||||||
vms = vms_service.list(
|
vms = vms_service.list(
|
||||||
search=module.params['pattern'],
|
search=module.params['pattern'],
|
||||||
|
@ -119,7 +120,7 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
module.fail_json(msg=str(e), exception=traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
connection.close(logout=False)
|
connection.close(logout=auth.get('token') is None)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue