コード例 #1
0
ファイル: bind_pid.py プロジェクト: helrond/archivematica
def _get_bind_pid_config(file_uuid):
    """Return dict to pass to ``bindpid`` function as keyword arguments."""
    _args = {'entity_type': 'file', 'desired_pid': file_uuid}
    _args.update(DashboardSetting.objects.get_dict('handle'))
    _args['pid_request_verify_certs'] = str2bool(
        _args.get('pid_request_verify_certs', 'True'))
    return _args
コード例 #2
0
ファイル: bind_pids.py プロジェクト: IISH/archivematica
def main(job, sip_uuid, shared_path, bind_pids_switch):
    """Bind the UUID ``sip_uuid`` to the appropriate URL(s), given the
    configuration in the dashboard, Do this only if ``bind_pids_switch`` is
    ``True``.
    """
    _exit_if_not_bind_pids(bind_pids_switch)

    # If there are user provided identifiers
    # insert them into the database
    # and skip connecting to the pid server
    try:
        identifiers_loc = File.objects.get(
            sip_id=sip_uuid,
            currentlocation__endswith=bind_third_party_pids.IDENTIFIERS_JSON)
    except File.DoesNotExist:
        logger.info("Custom `identifiers.json` not provided with transfer")
    if identifiers_loc:
        bind_third_party_pids.load_identifiers_json(job, logger, sip_uuid,
                                                    identifiers_loc,
                                                    shared_path)
        return
    handle_config = DashboardSetting.objects.get_dict('handle')
    handle_config['pid_request_verify_certs'] = str2bool(
        handle_config.get('pid_request_verify_certs', 'True'))
    if validate_handle_server_config(handle_config, logger):
        # Given the opportunity, a happy path here would test to see if the
        # handle configuration was set correctly, and then raise an exception
        # if not. We don't want to exit the script this early, however, to we
        # test for the positive existence of a config and run that path
        # instead.
        for mdl in chain([_get_sip(sip_uuid)],
                         Directory.objects.filter(sip_id=sip_uuid).all()):
            _bind_pid_to_model(job, mdl, shared_path, handle_config)
コード例 #3
0
def _get_bind_pid_config(file_uuid):
    """Return dict to pass to ``bindpid`` function as keyword arguments."""
    _args = {"entity_type": "file", "desired_pid": file_uuid}
    _args.update(DashboardSetting.objects.get_dict("handle"))
    bindpid._validate(_args)
    _args["pid_request_verify_certs"] = str2bool(
        _args.get("pid_request_verify_certs", "True"))
    return _args
コード例 #4
0
def main(job, sip_uuid, shared_path, bind_pids_switch):
    """Bind the UUID ``sip_uuid`` to the appropriate URL(s), given the
    configuration in the dashboard, Do this only if ``bind_pids_switch`` is
    ``True``.
    """
    _exit_if_not_bind_pids(bind_pids_switch)
    handle_config = DashboardSetting.objects.get_dict('handle')
    handle_config['pid_request_verify_certs'] = str2bool(
        handle_config.get('pid_request_verify_certs', 'True'))
    for mdl in chain([_get_sip(sip_uuid)],
                     Directory.objects.filter(sip_id=sip_uuid).all()):
        _bind_pid_to_model(job, mdl, shared_path, handle_config)
コード例 #5
0
def main(job, sip_uuid, shared_path):
    """Bind the UUID ``sip_uuid`` to the appropriate URL(s), given the
    configuration in the dashboard, Do this only if ``bind_pids_switch`` is
    ``True``.
    """
    handle_config = DashboardSetting.objects.get_dict("handle")
    handle_config["pid_request_verify_certs"] = str2bool(
        handle_config.get("pid_request_verify_certs", "True"))
    try:
        _validate_handle_server_config(handle_config)
    except BindPIDException as err:
        logger.info(err)
        raise BindPIDsException
    for mdl in chain([_get_sip(sip_uuid)],
                     Directory.objects.filter(sip_id=sip_uuid).all()):
        _bind_pid_to_model(job, mdl, shared_path, handle_config)