def health_check(self, cancellation_context):
"""
Checks if the device is up and connectable
:return: None
:exception Exception: Raises an error if cannot connect
"""
The context parameter is missing
The return value should be "Health check on resource ___ passed." and not None
The template should include sample code for setting the live status which is part of the standard:
from cloudshell.api.cloudshell_api import CloudShellAPISession
api = CloudShellAPISession(context.connectivity.server_address,
token_id=context.connectivity.admin_auth_token,
port=context.connectivity.cloudshell_api_port)
rv = 'Health check on resource %s passed' % context.resource.fullname
api.SetResourceLiveStatus(context.resource.fullname, 'Online', rv)
return rv
This is what you get today:
from cloudshell.api.cloudshell_api import CloudShellAPISession