def selftest_function(opts):

    options = opts.get(PACKAGE_NAME, {})

    try:
        dxlclient = get_mcafee_client(options)
        tie_client = get_tie_client(dxlclient)
        if dxlclient.connected and tie_client:
            state = 'success'
            reason = None
        else:
            state = 'failure'
            reason = 'authorization failure'

        return {'state': state, 'reason': reason}

    except Exception as exc:
        return {'state': 'failure', 'reason': str(exc)}
 def _reload(self, event, opts):
     """Configuration options have changed, save new values"""
     self.options = opts.get(PACKAGE_NAME, {})
     self.client = get_mcafee_client(self.options)
 def __init__(self, opts):
     """constructor provides access to the configuration options"""
     super(FunctionComponent, self).__init__(opts)
     self.options = opts.get(PACKAGE_NAME, {})
     self.client = get_mcafee_client(self.options)