Ejemplo n.º 1
0
    def for_instance(self, instance):
        instance_config = self.config.get_instance_config(instance)
        db = get_db()   # pylint: disable=invalid-name

        auth_type = db.get_active_auth_method()
        auth_config = db.get_rucio_auth_credentials(instance, auth_type)

        return RucioAPI(instance_config=instance_config, auth_type=auth_type, auth_config=auth_config)
Ejemplo n.º 2
0
 def get(self):
     db = get_db()  # pylint: disable=invalid-name
     active_instance = db.get_active_instance()
     auth_type = db.get_active_auth_method()
     instances = self.rucio_config.list_instances()
     self.finish(json.dumps({
         'active_instance': active_instance,
         'auth_type': auth_type,
         'instances': instances
     }))
Ejemplo n.º 3
0
    def put(self):
        json_body = self.get_json_body()
        picked_instance = json_body['instance']
        picked_auth_type = json_body['auth']

        db = get_db()  # pylint: disable=invalid-name
        db.set_active_instance(picked_instance)
        db.set_active_auth_method(picked_auth_type)

        RucioAPI.clear_auth_token_cache()

        self.finish(json.dumps({'success': True}))
Ejemplo n.º 4
0
    def put(self):
        json_body = self.get_json_body()
        namespace = json_body['namespace']
        auth_type = json_body['type']
        params = json_body['params']

        db = get_db()  # pylint: disable=invalid-name
        db.set_rucio_auth_credentials(namespace=namespace,
                                      auth_type=auth_type,
                                      params=params)

        RucioAPI.clear_auth_token_cache()

        self.finish(json.dumps({'success': True}))
Ejemplo n.º 5
0
    def get(self):
        namespace = self.get_query_argument('namespace')
        auth_type = self.get_query_argument('type')

        db = get_db()  # pylint: disable=invalid-name
        auth_credentials = db.get_rucio_auth_credentials(namespace=namespace,
                                                         auth_type=auth_type)

        if auth_credentials:
            self.finish(json.dumps(auth_credentials))
        else:
            self.set_status(404)
            self.finish({
                'success': False,
                'error': 'Auth credentials not set'
            })
Ejemplo n.º 6
0
 def __init__(self, namespace, rucio):
     self.namespace = namespace
     self.rucio = rucio
     self.db = get_db()  # pylint: disable=invalid-name
Ejemplo n.º 7
0
 def post(self):
     db = get_db()  # pylint: disable=invalid-name
     db.purge_cache()
     self.finish(json.dumps({'success': True}))