예제 #1
0
def service_get(service_id, session=None):
    result = model_query(service_models.Service, session=session). \
        filter_by(id=service_id). \
        first()
    if not result:
        raise exception.ServiceNotFound(service_id=service_id)
    return result
예제 #2
0
def count_insert_or_update(name, url):
    print name, url
    session = get_session()
    result = model_query(APICount, session=session). \
        filter_by(name=name). \
        filter_by(url=url). \
        first()
    if not result:
        with session.begin():
            result = APICount()
            result.update({'name': name, 'url': url, 'count': 1})
            result.save()
    else:
        result.count += 1
        result.save(session=session)
    return result
예제 #3
0
def service_get_by_args(host, binary):
    return model_query(service_models.Service). \
        filter_by(host=host). \
        filter_by(binary=binary). \
        first()
예제 #4
0
def count_list():
    return model_query(APICount).all()
예제 #5
0
def service_list():
    return model_query(service_models.Service).all()
예제 #6
0
def P_machine_get_undelete(deleted=False, session=None):
    return model_query(PhysicalMachine, session=session). \
        filter_by(deleted=deleted). \
        all()
예제 #7
0
def P_machine_get_by_id(id, deleted=False, session=None):
    return model_query(PhysicalMachine, session=session). \
        filter_by(id=id). \
        filter_by(deleted=deleted). \
        first()
예제 #8
0
def P_machine_list():
    return model_query(PhysicalMachine).all()
예제 #9
0
def P_machine_get_by_userid_(user_id, cb_sysname, deleted=False, session=None):
    return model_query(PhysicalMachine, session=session). \
        filter_by(user_id=user_id). \
        filter_by(cobbler_sysname=cb_sysname). \
        filter_by(deleted=deleted). \
        first()
예제 #10
0
def P_machine_get_by_user_id(user_id, deleted=False, session=None):
    return model_query(PhysicalMachine, session=session). \
        filter_by(user_id=user_id). \
        filter_by(deleted=deleted). \
        all()