Ejemplo n.º 1
0
    def render(self, session, room, building, fullname, comments, **arguments):
        dbbuilding = Building.get_unique(session, building, compel=True)
        add_location(session, Room, room, dbbuilding, fullname=fullname,
                     comments=comments)

        session.flush()

        return
Ejemplo n.º 2
0
    def render(self, session, country, continent, fullname, comments, **arguments):
        dbcontinent = Continent.get_unique(session, continent, compel=True)
        add_location(session, Country, country, dbcontinent, fullname=fullname,
                     comments=comments)

        session.flush()

        return
Ejemplo n.º 3
0
    def render(self, session, continent, hub, fullname, comments, **arguments):
        dbhub = Hub.get_unique(session, hub, compel=True)
        add_location(session, Continent, continent, dbhub, fullname=fullname,
                     comments=comments)

        session.flush()

        return
Ejemplo n.º 4
0
    def render(self, session, logger, campus, country, fullname, comments, **arguments):
        dbcountry = Country.get_unique(session, country, compel=True)
        add_location(session, Campus, campus, dbcountry, fullname=fullname, comments=comments)

        session.flush()

        dsdb_runner = DSDBRunner(logger=logger)
        dsdb_runner.add_campus(campus, comments)
        dsdb_runner.commit_or_rollback()

        return
Ejemplo n.º 5
0
    def render(self, session, room, building, fullname, comments, **arguments):
        dbbuilding = Building.get_unique(session, building, compel=True)
        add_location(session,
                     Room,
                     room,
                     dbbuilding,
                     fullname=fullname,
                     comments=comments)

        session.flush()

        return
Ejemplo n.º 6
0
    def render(self, session, country, continent, fullname, comments,
               **arguments):
        dbcontinent = Continent.get_unique(session, continent, compel=True)
        add_location(session,
                     Country,
                     country,
                     dbcontinent,
                     fullname=fullname,
                     comments=comments)

        session.flush()

        return
Ejemplo n.º 7
0
    def render(self, session, organization, hub, fullname, comments, **arguments):
        organization = organization or self.config.get("broker",
                                                       "default_organization")
        if not organization:
            raise ArgumentError("Please specify --organization, since no "
                                "default is available.")

        dborg = Company.get_unique(session, organization, compel=True)
        add_location(session, Hub, hub, dborg, fullname=fullname,
                     comments=comments)

        session.flush()

        return
Ejemplo n.º 8
0
    def render(self, session, bunker, room, building, fullname, comments,
               **arguments):
        if room:
            dbparent = Room.get_unique(session, room, compel=True)
        elif building:
            dbparent = Building.get_unique(session, building, compel=True)
        else:  # pragma: no cover
            raise ArgumentError("Please specify either --room or --building.")

        add_location(session, Bunker, bunker, dbparent, fullname=fullname,
                     comments=comments)

        session.flush()

        return
Ejemplo n.º 9
0
    def render(self, session, logger, building, city, fullname, comments,
               address, **arguments):
        dbcity = City.get_unique(session, city, compel=True)
        add_location(session, Building, building, dbcity, fullname=fullname,
                     address=address, comments=comments)

        session.flush()

        dsdb_runner = DSDBRunner(logger=logger)
        dsdb_runner.add_building(building, city, address)
        if dbcity.campus:
            dsdb_runner.add_campus_building(dbcity.campus, building)
        dsdb_runner.commit_or_rollback()

        return
Ejemplo n.º 10
0
    def render(self, session, logger, city, country, fullname, comments,
               timezone, campus,
               **arguments):
        if country:
            dbparent = Country.get_unique(session, country, compel=True)
        else:
            dbparent = Campus.get_unique(session, campus, compel=True)

        dbcity = add_location(session, City, city, dbparent, fullname=fullname,
                              comments=comments, timezone=timezone)

        session.flush()

        plenary = Plenary.get_plenary(dbcity, logger=logger)
        with plenary.get_key():
            try:
                plenary.write(locked=True)

                dsdb_runner = DSDBRunner(logger=logger)
                dsdb_runner.add_city(city, dbcity.country.name, fullname)
                dsdb_runner.commit_or_rollback()

            except:
                plenary.restore_stash()
                raise
        return
Ejemplo n.º 11
0
    def render(self, session, logger, city, country, fullname, comments,
               timezone, campus, **arguments):
        if country:
            dbparent = Country.get_unique(session, country, compel=True)
        else:
            dbparent = Campus.get_unique(session, campus, compel=True)

        dbcity = add_location(session,
                              City,
                              city,
                              dbparent,
                              fullname=fullname,
                              comments=comments,
                              timezone=timezone)

        session.flush()

        plenary = PlenaryCity(dbcity, logger=logger)
        key = plenary.get_write_key()
        try:
            lock_queue.acquire(key)
            plenary.write(locked=True)

            dsdb_runner = DSDBRunner(logger=logger)
            dsdb_runner.add_city(city, dbcity.country.name, fullname)
            dsdb_runner.commit_or_rollback()

        except:
            plenary.restore_stash()
            raise
        finally:
            lock_queue.release(key)
Ejemplo n.º 12
0
    def render(self, session, logger, campus, country, fullname, comments,
               **arguments):
        dbcountry = Country.get_unique(session, country, compel=True)
        add_location(session,
                     Campus,
                     campus,
                     dbcountry,
                     fullname=fullname,
                     comments=comments)

        session.flush()

        dsdb_runner = DSDBRunner(logger=logger)
        dsdb_runner.add_campus(campus, comments)
        dsdb_runner.commit_or_rollback()

        return
Ejemplo n.º 13
0
    def render(self, session, desk, room, building, fullname, comments,
               **arguments):
        if room:
            dbparent = Room.get_unique(session, room, compel=True)
        elif building:
            dbparent = Building.get_unique(session, building, compel=True)
        else:  # pragma: no cover
            raise ArgumentError("Please specify either --room or --building.")

        add_location(session,
                     Desk,
                     desk,
                     dbparent,
                     fullname=fullname,
                     comments=comments)

        session.flush()

        return
Ejemplo n.º 14
0
    def render(self, session, logger, building, city, fullname, comments,
               address, **arguments):
        dbcity = City.get_unique(session, city, compel=True)
        add_location(session,
                     Building,
                     building,
                     dbcity,
                     fullname=fullname,
                     address=address,
                     comments=comments)

        session.flush()

        dsdb_runner = DSDBRunner(logger=logger)
        dsdb_runner.add_building(building, city, address)
        if dbcity.campus:
            dsdb_runner.add_campus_building(dbcity.campus, building)
        dsdb_runner.commit_or_rollback()

        return