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

sys.exit removal for cloud/xenserver_facts.py

This commit is contained in:
Matt Martz 2015-10-05 13:22:32 -05:00 committed by Matt Clay
parent 766ad0ace2
commit 950c951e06

View file

@ -28,7 +28,6 @@ author:
''' '''
import platform import platform
import sys
import XenAPI import XenAPI
EXAMPLES = ''' EXAMPLES = '''
@ -75,12 +74,9 @@ class XenServerFacts:
def get_xenapi_session(): def get_xenapi_session():
try:
session = XenAPI.xapi_local() session = XenAPI.xapi_local()
session.xenapi.login_with_password('', '') session.xenapi.login_with_password('', '')
return session return session
except XenAPI.Failure:
sys.exit(1)
def get_networks(session): def get_networks(session):
@ -163,8 +159,10 @@ def main():
module = AnsibleModule({}) module = AnsibleModule({})
obj = XenServerFacts() obj = XenServerFacts()
try:
session = get_xenapi_session() session = get_xenapi_session()
except XenAPI.Failure, e:
module.fail_json(msg='%s' % e)
data = { data = {
'xenserver_version': obj.version, 'xenserver_version': obj.version,