示例#1
0
文件: dispatch.py 项目: crobby/sahara
def get_raw_binary(job_binary, proxy_configs=None,
                   with_context=False, remote=None):
    '''Get the raw data for a job binary

    This will retrieve the raw data for a job binary from it's source. In the
    case of Swift based binaries there is a precedence of credentials for
    authenticating the client. Requesting a context based authentication takes
    precendence over proxy user which takes precendence over embedded
    credentials.

    :param job_binary: The job binary to retrieve
    :param proxy_configs: Proxy user configuration to use as credentials
    :param with_context: Use the current context as credentials
    :param remote: The remote contains node group and cluster information
    :returns: The raw data from a job binary

    '''
    url = job_binary.url
    if url.startswith("internal-db://"):
        res = db.get_raw_data(context.ctx(), job_binary)

    if url.startswith(su.SWIFT_INTERNAL_PREFIX):
        if with_context:
            res = i_swift.get_raw_data_with_context(job_binary)
        else:
            res = i_swift.get_raw_data(job_binary, proxy_configs)

    if url.startswith(m.MANILA_PREFIX):
        res = manila.get_file_info(job_binary, remote)

    return res
示例#2
0
def get_raw_binary(job_binary,
                   proxy_configs=None,
                   with_context=False,
                   remote=None):
    '''Get the raw data for a job binary

    This will retrieve the raw data for a job binary from it's source. In the
    case of Swift based binaries there is a precedence of credentials for
    authenticating the client. Requesting a context based authentication takes
    precedence over proxy user which takes precedence over embedded
    credentials.

    :param job_binary: The job binary to retrieve
    :param proxy_configs: Proxy user configuration to use as credentials
    :param with_context: Use the current context as credentials
    :param remote: The remote contains node group and cluster information
    :returns: The raw data from a job binary

    '''
    url = job_binary.url
    if url.startswith("internal-db://"):
        res = db.get_raw_data(context.ctx(), job_binary)

    if url.startswith(su.SWIFT_INTERNAL_PREFIX):
        if with_context:
            res = i_swift.get_raw_data_with_context(job_binary)
        else:
            res = i_swift.get_raw_data(job_binary, proxy_configs)

    if url.startswith(m.MANILA_PREFIX):
        res = manila.get_file_info(job_binary, remote)

    return res
示例#3
0
def get_raw_binary(job_binary, proxy_configs=None):
    url = job_binary.url
    if url.startswith("internal-db://"):
        res = db.get_raw_data(context.ctx(), job_binary)

    if url.startswith(su.SWIFT_INTERNAL_PREFIX):
        res = i_swift.get_raw_data(context.ctx(), job_binary, proxy_configs)

    return res
示例#4
0
def get_raw_binary(job_binary, proxy_configs=None):
    url = job_binary.url
    if url.startswith("internal-db://"):
        res = db.get_raw_data(context.ctx(), job_binary)

    if url.startswith(su.SWIFT_INTERNAL_PREFIX):
        res = i_swift.get_raw_data(job_binary, proxy_configs)

    return res
示例#5
0
def get_raw_binary(job_binary):
    url = job_binary.url
    if url.startswith("internal-db://"):
        res = db.get_raw_data(context.ctx(), job_binary)

    # TODO(mattf): remove support for OLD_SWIFT_INTERNAL_PREFIX
    if url.startswith(su.SWIFT_INTERNAL_PREFIX) or (
            url.startswith(su.OLD_SWIFT_INTERNAL_PREFIX)):
        res = i_swift.get_raw_data(context.ctx(), job_binary)

    return res
示例#6
0
def get_raw_binary(job_binary):
    url = job_binary.url
    if url.startswith("internal-db://"):
        res = db.get_raw_data(context.ctx(), job_binary)

    # TODO(mattf): remove support for OLD_SWIFT_INTERNAL_PREFIX
    if url.startswith(su.SWIFT_INTERNAL_PREFIX) or (url.startswith(
            su.OLD_SWIFT_INTERNAL_PREFIX)):
        res = i_swift.get_raw_data(context.ctx(), job_binary)

    return res