Ejemplo n.º 1
0
def _op_src(opspec):
    opdef = op_util.opdef_for_opspec(opspec)
    src = opdef.guildfile.dir
    if src is None:
        return None
    if not os.path.isdir(src):
        raise remotelib.OperationError(
            "cannot find source location for operation '%s'" % opspec)
    if not os.path.exists(os.path.join(src, "guild.yml")):
        raise remotelib.OperationError(
            "source location for operation '%s' (%s) does not "
            "contain guild.yml" % (opspec, src))
    return src
Ejemplo n.º 2
0
def _opdef_for_opspec(opspec):
    try:
        return op_util.opdef_for_opspec(opspec)
    except op_util.InvalidOpSpec:
        _invalid_opspec_error(opspec)
    except op_util.CwdGuildfileError as e:
        _guildfile_error(e.path, str(e))
    except op_util.NoSuchModel as e:
        _no_such_model_op_error(opspec)
    except op_util.MultipleMatchingModels as e:
        _multiple_models_error(e.model_ref, e.matches)
    except op_util.NoSuchOperation as e:
        _no_such_opdef_error(e.model, e.op_name)
    except op_util.ModelOpProxyError as e:
        _model_op_proxy_error(e)