예제 #1
0
파일: nodes.py 프로젝트: seryl/Nodetraq
 def destroy_comment(self, id, commentid):
     comment = Session.query(NodeComment)\
             .filter(NodeComment.id == commentid).first()
     Session.delete(comment)
     Session.commit()
     return redirect(url(
         controller='nodes', action='show', id=id))
예제 #2
0
파일: nodes.py 프로젝트: seryl/Nodetraq
    def destroy_game(self, id):
        game = Session.query(Game).filter(Game.id == id).first()
        Session.delete(game)
        Session.commit()

        session['flash'] = "Success"
        session.save()
        return {'success': True}
예제 #3
0
파일: nodes.py 프로젝트: seryl/Nodetraq
    def destroy_studio(self, id):
        studio = Session.query(Studio).filter(Studio.id == id).first()
        Session.delete(studio)
        Session.commit()

        session['flash'] = "Success"
        session.save()
        return {'success': True}
예제 #4
0
    def destroy_game(self, id):
        game = Session.query(Game).filter(Game.id == id).first()
        Session.delete(game)
        Session.commit()

        session['flash'] = "Success"
        session.save()
        return {'success': True}
예제 #5
0
    def destroy_studio(self, id):
        studio = Session.query(Studio).filter(Studio.id == id).first()
        Session.delete(studio)
        Session.commit()

        session['flash'] = "Success"
        session.save()
        return {'success': True}
예제 #6
0
파일: dbbackups.py 프로젝트: seryl/Nodetraq
    def destroy(self, id, backup_id):
        dbbackup = Session.query(NodeDatabaseBackup)\
            .filter(NodeDatabaseBackup.id == backup_id).first()
        Session.delete(dbbackup)
        Session.commit()
        session['flash'] = "Successfully destroyed dbbackup"
        session.save()

        return redirect(url(controller='dbbackups', action='index', id=id))
예제 #7
0
파일: dbbackups.py 프로젝트: seryl/Nodetraq
    def destroy(self, id, backup_id):
        dbbackup = Session.query(NodeDatabaseBackup)\
            .filter(NodeDatabaseBackup.id == backup_id).first()
        Session.delete(dbbackup)
        Session.commit()
        session['flash'] = "Successfully destroyed dbbackup"
        session.save()

        return redirect(url(controller='dbbackups', action='index', id=id))
예제 #8
0
    def delete(self, id):
        if id.isdigit():
            graph = Session.query(Graph)\
                .filter(Graph.id == int(id)).first()
        else:
            graph = Session.query(Graph)\
                .filter(Graph.name == id).first()

        Session.delete(graph)
        Session.commit()
        session['flash'] = "Successfully deleted %s" % graph.name
        session.save()
        return redirect(url(
                controller='graphs', action='index'))
예제 #9
0
파일: nodes.py 프로젝트: seryl/Nodetraq
    def update_disks(self, diskinfo):
        if self.disks:
            current_serials = [d.serial_no for d in self.disks]
            new_serials = [d['serial_no'] for d in diskinfo['disks']]
            diff_serials = list(set(new_serials) - set(current_serials))
            remove_serials = [ serial for serial in current_serials \
                                   if serial not in new_serials ]

            for s in remove_serials:
                for rd in self.disks:
                    if rd.serial_no == s:
                        self.disks.remove(rd)
                        Session.delete(rd)

            for s in diff_serials:
                for disk in diskinfo['disks']:
                    if disk['serial_no'] == s:
                        new_disk = Disk()
                        new_disk.serial_no = disk['serial_no']
                        new_disk.capacity = disk['capacity']
                        new_disk.type = disk['type']
                        new_disk.controller_slot = disk['controller_slot']
                        new_disk.controller_id = DiskController\
                            .grab_controller(disk['controller'])
                        Session.add(new_disk)
                        self.disks.append(new_disk)

        else:
            self.disks = []
            for disk in diskinfo['disks']:
                new_disk = Disk()
                new_disk.serial_no = disk['serial_no']
                new_disk.capacity = disk['capacity']
                new_disk.type = disk['type']
                new_disk.controller_slot = disk['controller_slot']
                new_disk.controller_id = DiskController\
                    .grab_controller(disk['controller'])
                Session.add(new_disk)
                self.disks.append(new_disk)

        Session.add(self)
        Session.commit()
예제 #10
0
파일: nodes.py 프로젝트: seryl/Nodetraq
    def update_disks(self, diskinfo):
        if self.disks:
            current_serials = [d.serial_no for d in self.disks]
            new_serials = [d["serial_no"] for d in diskinfo["disks"]]
            diff_serials = list(set(new_serials) - set(current_serials))
            remove_serials = [serial for serial in current_serials if serial not in new_serials]

            for s in remove_serials:
                for rd in self.disks:
                    if rd.serial_no == s:
                        self.disks.remove(rd)
                        Session.delete(rd)

            for s in diff_serials:
                for disk in diskinfo["disks"]:
                    if disk["serial_no"] == s:
                        new_disk = Disk()
                        new_disk.serial_no = disk["serial_no"]
                        new_disk.capacity = disk["capacity"]
                        new_disk.type = disk["type"]
                        new_disk.controller_slot = disk["controller_slot"]
                        new_disk.controller_id = DiskController.grab_controller(disk["controller"])
                        Session.add(new_disk)
                        self.disks.append(new_disk)

        else:
            self.disks = []
            for disk in diskinfo["disks"]:
                new_disk = Disk()
                new_disk.serial_no = disk["serial_no"]
                new_disk.capacity = disk["capacity"]
                new_disk.type = disk["type"]
                new_disk.controller_slot = disk["controller_slot"]
                new_disk.controller_id = DiskController.grab_controller(disk["controller"])
                Session.add(new_disk)
                self.disks.append(new_disk)

        Session.add(self)
        Session.commit()
예제 #11
0
파일: dbbackups.py 프로젝트: seryl/Nodetraq
 def delete(self, backup_id):
     dbbackup = Session.query(NodeDatabaseBackup)\
         .filter(NodeDatabaseBackup.id == backup_id).first()
     Session.delete(dbbackup)
     Session.commit()
     return {"success": True}
예제 #12
0
 def destroy_comment(self, id, commentid):
     comment = Session.query(NodeComment)\
             .filter(NodeComment.id == commentid).first()
     Session.delete(comment)
     Session.commit()
     return redirect(url(controller='nodes', action='show', id=id))
예제 #13
0
파일: network.py 프로젝트: seryl/Nodetraq
 def destroy(self, id):
     network_device = Session.query(NetworkDevice).filter(
         NetworkDevice.id == id).first()
     Session.delete(network_device)
     Session.commit()
     return {'success': True}
예제 #14
0
파일: dbbackups.py 프로젝트: seryl/Nodetraq
 def delete(self, backup_id):
     dbbackup = Session.query(NodeDatabaseBackup)\
         .filter(NodeDatabaseBackup.id == backup_id).first()
     Session.delete(dbbackup)
     Session.commit()
     return {"success": True}
예제 #15
0
파일: network.py 프로젝트: seryl/Nodetraq
 def destroy(self, id):
     network_device = Session.query(NetworkDevice).filter(
         NetworkDevice.id == id).first()
     Session.delete(network_device)
     Session.commit()
     return {'success': True}