예제 #1
0
def process(sid, params):

    #删除pod
    pod = DBSession.query(model.podModel).filter_by(pid=params['pid']).first()
    if not pod:
        return dict(errors={'pod': 'pod not found'})
    DBSession.delete(pod)

    #podspecs = DBSession.query(model.podspec).filter_by(pid=55).all()
    return ({}, 'success.')
예제 #2
0
def process(sid, params):

    podModels = DBSession.query(model.podModel).all()
    for podInfo in podModels:
        #创建对应tag的二进制库
        pod = DBSession.query(
            model.podModel).filter_by(pid=podInfo.pid).first()
        try:
            cloneMirror.podCloneAndMirror(copy.deepcopy(pod))
        except Exception, e:
            status, message = e.args
            if status == 4:
                raise APIError(4, message)
            else:
                raise APIError(1, traceback.format_exc())
예제 #3
0
def process(sid, params):
    print params['pid']
    pod = DBSession.query(model.podModel).get(params['pid'])
    if not pod:
        raise APIError(1,'pod is not existed')

    if params.has_key('podName'):
        pod.podName = params['podName']

    if params.has_key('sourceHttpUrl'):
        pod.sourceHttpUrl = params['sourceHttpUrl']

    if params.has_key('specSourceHttpUrl'):
        pod.specSourceHttpUrl = params['specSourceHttpUrl']

    if params.has_key('mirrorSSHUrl'):
        pod.mirrorSSHUrl = params['mirrorSSHUrl']

    if params.has_key('mirrorHttpUrl'):
        pod.mirrorHttpUrl = params['mirrorHttpUrl']

    if params.has_key('noReplaceSource'):
        pod.noReplaceSource = params['noReplaceSource']
        print "######" + params['noReplaceSource']

    #podspecs = DBSession.query(model.podspec).filter_by(pid=55).all()
    return (pod, 'success.')
예제 #4
0
def process(sid, params):
    podone = DBSession.query(
        model.podModel).filter_by(podName=params['podName']).first()
    if podone:
        raise APIError(1, 'podName: ' + params['podName'] + '已存在')

    newPod = model.podModel(podName=params['podName'],
                            sourceHttpUrl=params['sourceHttpUrl'],
                            specSourceHttpUrl=params['specSourceHttpUrl'],
                            mirrorSSHUrl=params['mirrorSSHUrl'],
                            mirrorHttpUrl=params['mirrorHttpUrl'],
                            noReplaceSource=params['noReplaceSource'])

    DBSession.add(newPod)
    DBSession.flush()

    #podspecs = DBSession.query(model.podspec).filter_by(pid=55).all()
    return (newPod, 'success.')
예제 #5
0
 def setUp(self):
     """Setup test fixture for each model test method."""
     try:
         new_attrs = {}
         new_attrs.update(self.attrs)
         new_attrs.update(self.do_get_dependencies())
         self.obj = self.klass(**new_attrs)
         DBSession.add(self.obj)
         DBSession.flush()
         return self.obj
     except:
         DBSession.rollback()
         raise
예제 #6
0
def process(sid, params):
    podModels = DBSession.query(model.podModel).all()
    #podspecs = DBSession.query(model.podspec).filter_by(pid=55).all()
    return (podModels, 'success.')
예제 #7
0
 def by_user_name(cls, username):
     """Return the user object whose user name is ``username``."""
     return DBSession.query(cls).filter_by(user_name=username).first()
예제 #8
0
 def by_email_address(cls, email):
     """Return the user object whose email address is ``email``."""
     return DBSession.query(cls).filter_by(email_address=email).first()
예제 #9
0
 def test_query_obj(self):
     """Model objects can be queried"""
     obj = DBSession.query(self.klass).one()
     for key, value in self.attrs.items():
         eq_(getattr(obj, key), value)
예제 #10
0
 def tearDown(self):
     """Tear down test fixture for each model test method."""
     DBSession.rollback()