def test_instance_links(alias, uri): from rtwo.linktest import test_link if uri is None: return {alias: {'vnc': False, 'shell': False}} shell_address = '%s/shell/%s/' % (settings.SERVER_URL, uri) shell_success = test_link(shell_address) vnc_address = 'http://%s:5904' % uri vnc_success = test_link(vnc_address) return {alias: {'vnc': vnc_success, 'shell': shell_success}}
def test_instance_links(alias, uri): from rtwo.linktest import test_link if uri is None: return {alias: {'vnc': False, 'shell': False}} shell_address = '%s/shell/%s/' % (settings.SERVER_URL, uri) try: shell_success = test_link(shell_address) except Exception, e: logger.exception("Bad shell address: %s" % shell_address) shell_success = False
return tested_instances def test_instance_links(alias, uri): from rtwo.linktest import test_link if uri is None: return {alias: {'vnc': False, 'shell': False}} shell_address = '%s/shell/%s/' % (settings.SERVER_URL, uri) try: shell_success = test_link(shell_address) except Exception, e: logger.exception("Bad shell address: %s" % shell_address) shell_success = False vnc_address = 'http://%s:5904' % uri try: vnc_success = test_link(vnc_address) except Exception, e: logger.exception("Bad vnc address: %s" % vnc_address) vnc_success = False return {alias: {'vnc': vnc_success, 'shell': shell_success}} def update_links(instances): from core.models import Instance updated = [] linktest_results = active_instances(instances) for (instance_id, link_results) in linktest_results.items(): try: update = False instance = Instance.objects.get(provider_alias=instance_id) if link_results['shell'] != instance.shell: