Exemplo n.º 1
0
def create_instances(values_list):
    for values in values_list:
        vals = values.copy()
        session = get_session()
        with session.begin():
            minstance = models.MaintenanceInstance()
            minstance.update(vals)
            try:
                minstance.save(session=session)
            except common_db_exc.DBDuplicateEntry as e:
                # raise exception about duplicated columns (e.columns)
                raise db_exc.FenixDBDuplicateEntry(
                    model=minstance.__class__.__name__, columns=e.columns)

    return instances_get(minstance.session_id)
Exemplo n.º 2
0
def create_project(values):
    values = values.copy()
    mproject = models.MaintenanceProject()
    mproject.update(values)

    session = get_session()
    with session.begin():
        try:
            mproject.save(session=session)
        except common_db_exc.DBDuplicateEntry as e:
            # raise exception about duplicated columns (e.columns)
            raise db_exc.FenixDBDuplicateEntry(
                model=mproject.__class__.__name__, columns=e.columns)

    return project_get(mproject.session_id, mproject.project_id)
Exemplo n.º 3
0
def create_action_plugins(values_list):
    for values in values_list:
        vals = values.copy()
        session = get_session()
        with session.begin():
            ap = models.MaintenanceActionPlugin()
            ap.update(vals)
            try:
                ap.save(session=session)
            except common_db_exc.DBDuplicateEntry as e:
                # raise exception about duplicated columns (e.columns)
                raise db_exc.FenixDBDuplicateEntry(
                    model=ap.__class__.__name__, columns=e.columns)

    return action_plugins_get_all(ap.session_id)
Exemplo n.º 4
0
def create_action_plugin_instance(values):
    values = values.copy()
    ap_instance = models.MaintenanceActionPluginInstance()
    ap_instance.update(values)

    session = get_session()
    with session.begin():
        try:
            ap_instance.save(session=session)
        except common_db_exc.DBDuplicateEntry as e:
            # raise exception about duplicated columns (e.columns)
            raise db_exc.FenixDBDuplicateEntry(
                model=ap_instance.__class__.__name__, columns=e.columns)

    return action_plugin_instance_get(ap_instance.session_id,
                                      ap_instance.plugin,
                                      ap_instance.hostname)