Exemplo n.º 1
0
Arquivo: sync.py Projeto: jrha/aquilon
    def render(self, session, logger, domain, **arguments):
        dbdomain = Domain.get_unique(session, domain, compel=True)
        if not dbdomain.tracked_branch:
            # Could check dbdomain.trackers and sync all of them...
            raise ArgumentError("sync requires a tracking domain")
        if not dbdomain.tracked_branch.is_sync_valid:
            raise ArgumentError("Tracked branch %s is set to not allow sync.  "
                                "Run aq validate to mark it as valid." %
                                dbdomain.tracked_branch.name)

        try:
            sync_domain(dbdomain, logger=logger)
        except ProcessException, e:
            raise ArgumentError("Problem encountered updating templates for "
                                "domain %s: %s", dbdomain.name, e)
Exemplo n.º 2
0
            if dryrun:
                session.rollback()
                return

            run_git(["push", "origin", dbtarget.name],
                    path=temprepo,
                    logger=logger)
        finally:
            remove_dir(tempdir, logger=logger)

        # What to do about errors here and below... rolling back
        # doesn't seem appropriate as there's something more
        # fundamentally wrong with the repos.
        try:
            sync_domain(dbtarget, logger=logger)
        except ProcessException, e:
            logger.warn("Error syncing domain %s: %s" % (dbtarget.name, e))

        if not sync or not dbtarget.autosync:
            return

        for domain in dbtarget.trackers:
            if not domain.autosync:
                continue
            try:
                sync_domain(domain, logger=logger)
            except ProcessException, e:
                logger.warn("Error syncing domain %s: %s" % (domain.name, e))

        return
Exemplo n.º 3
0
                    path=temprepo,
                    logger=logger,
                    loglevel=CLIENT_INFO)
            # FIXME: Run tests before pushing back to template-king
            if rebase:
                target_ref = "+" + dbsandbox.name
            else:
                target_ref = dbsandbox.name
            run_git(["push", "origin", target_ref],
                    path=temprepo,
                    logger=logger)
        except ProcessException, e:
            raise ArgumentError("\n%s%s" % (e.out, e.err))
        finally:
            remove_file(filename, logger=logger)
            remove_dir(tempdir, logger=logger)

        client_command = "git fetch"
        if not sync or not dbsandbox.autosync:
            return client_command

        for domain in dbsandbox.trackers:
            if not domain.autosync:
                continue
            try:
                sync_domain(domain, logger=logger)
            except ProcessException, e:
                logger.warn("Error syncing domain %s: %s" % (domain.name, e))

        return client_command
Exemplo n.º 4
0
            # Use a different try/except and a specific error message.

            if dryrun:
                session.rollback()
                return

            run_git(["push", "origin", dbtarget.name],
                    path=temprepo, logger=logger)
        finally:
            remove_dir(tempdir, logger=logger)

        # What to do about errors here and below... rolling back
        # doesn't seem appropriate as there's something more
        # fundamentally wrong with the repos.
        try:
            sync_domain(dbtarget, logger=logger)
        except ProcessException, e:
            logger.warn("Error syncing domain %s: %s" % (dbtarget.name, e))

        if not sync or not dbtarget.autosync:
            return

        for domain in dbtarget.trackers:
            if not domain.autosync:
                continue
            try:
                sync_domain(domain, logger=logger)
            except ProcessException, e:
                logger.warn("Error syncing domain %s: %s" % (domain.name, e))

        return
Exemplo n.º 5
0
            command = ["pull", filename, ref]
            if rebase:
                command.append("--force")
            run_git(command, path=temprepo, logger=logger, loglevel=CLIENT_INFO)
            # FIXME: Run tests before pushing back to template-king
            if rebase:
                target_ref = "+" + dbsandbox.name
            else:
                target_ref = dbsandbox.name
            run_git(["push", "origin", target_ref],
                    path=temprepo, logger=logger)
        except ProcessException, e:
            raise ArgumentError("\n%s%s" % (e.out, e.err))
        finally:
            remove_file(filename, logger=logger)
            remove_dir(tempdir, logger=logger)

        client_command = "git fetch"
        if not sync or not dbsandbox.autosync:
            return client_command

        for domain in dbsandbox.trackers:
            if not domain.autosync:
                continue
            try:
                sync_domain(domain, logger=logger)
            except ProcessException, e:
                logger.warn("Error syncing domain %s: %s" % (domain.name, e))

        return client_command