Пример #1
0
def initialize_connector(connector_class, job, deployment):
    credential_id = Deployment.credential_id(deployment)
    credential = get_from_context(job, credential_id)
    infrastructure_service = copy.deepcopy(
        get_from_context(job, credential['parent']))
    # if you uncomment this, the pull-mode deployment_* will only work with the NB compute-api.
    # Which means standalone ISs and k8s capable NuvlaBoxes, are not supported
    if job.is_in_pull_mode and infrastructure_service.get('subtype',
                                                          '') == 'swarm':
        infrastructure_service['endpoint'] = 'https://compute-api:5000'
    return connector_class.instantiate_from_cimi(infrastructure_service,
                                                 credential)
Пример #2
0
 def get_hostname(self):
     credential_id = Deployment.credential_id(self.deployment)
     credential = self.get_from_context(credential_id)
     endpoint = self.get_from_context(credential['parent'])['endpoint']
     return re.search('(?:http.*://)?(?P<host>[^:/ ]+)',
                      endpoint).group('host')