예제 #1
0
    def run(self, **kwargs):
        repo_id = kwargs[options.OPTION_REPO_ID.keyword]
        background = kwargs[NAME_BACKGROUND]

        self.prompt.render_title(_("Synchronizing Repository [%(r)s]") % {"r": repo_id})

        # See if an existing sync is running for the repo. If it is, resume
        # progress tracking.
        existing_sync_tasks = self.context.server.tasks.get_repo_sync_tasks(repo_id).response_body
        task_group_id = tasks.relevant_existing_task_group_id(existing_sync_tasks)

        if task_group_id is not None:
            msg = _("A sync task is already in progress for this repository. ")
            if not background:
                msg += _("Its progress will be tracked below.")
            self.context.prompt.render_paragraph(msg, tag="in-progress")

        else:
            # Trigger the actual sync
            response = self.context.server.repo_actions.sync(repo_id, None)
            sync_task = tasks.sync_task_in_sync_task_group(response.response_body)
            task_group_id = sync_task.task_group_id

        if not background:
            status.display_group_status(self.context, self.renderer, task_group_id)
        else:
            msg = _("The status of this sync can be displayed using the status command.")
            self.context.prompt.render_paragraph(msg, "background")
예제 #2
0
    def run(self, **kwargs):
        repo_id = kwargs[options.OPTION_REPO_ID.keyword]
        background = kwargs[NAME_BACKGROUND]

        self.prompt.render_title(
            _('Synchronizing Repository [%(r)s]') % {'r': repo_id})

        # See if an existing sync is running for the repo. If it is, resume
        # progress tracking.
        existing_sync_tasks = self.context.server.tasks.get_repo_sync_tasks(
            repo_id).response_body
        task_group_id = tasks.relevant_existing_task_group_id(
            existing_sync_tasks)

        if task_group_id is not None:
            msg = _('A sync task is already in progress for this repository. ')
            if not background:
                msg += _('Its progress will be tracked below.')
            self.context.prompt.render_paragraph(msg, tag='in-progress')

        else:
            # Trigger the actual sync
            response = self.context.server.repo_actions.sync(repo_id, None)
            sync_task = tasks.sync_task_in_sync_task_group(
                response.response_body)
            task_group_id = sync_task.task_group_id

        if not background:
            status.display_group_status(self.context, self.renderer,
                                        task_group_id)
        else:
            msg = _(
                'The status of this sync can be displayed using the status command.'
            )
            self.context.prompt.render_paragraph(msg, 'background')
예제 #3
0
    def run(self, **kwargs):
        repo_id = kwargs[options.OPTION_REPO_ID.keyword]
        self.prompt.render_title(_('Repository Status [%(r)s]') % {'r' : repo_id})

        # Load the relevant task group
        existing_sync_tasks = self.context.server.tasks.get_repo_publish_tasks(repo_id).response_body
        task_group_id = tasks.relevant_existing_task_group_id(existing_sync_tasks)

        if task_group_id is None:
            msg = _('The repository is not performing any operations')
            self.prompt.render_paragraph(msg, tag='no-tasks')
        else:
            status.display_group_status(self.context, self.renderer, task_group_id)
예제 #4
0
    def run(self, **kwargs):
        repo_id = kwargs[options.OPTION_REPO_ID.keyword]
        self.prompt.render_title(
            _('Repository Status [%(r)s]') % {'r': repo_id})

        # Load the relevant task group
        existing_sync_tasks = self.context.server.tasks.get_repo_publish_tasks(
            repo_id).response_body
        task_group_id = tasks.relevant_existing_task_group_id(
            existing_sync_tasks)

        if task_group_id is None:
            msg = _('The repository is not performing any operations')
            self.prompt.render_paragraph(msg, tag='no-tasks')
        else:
            status.display_group_status(self.context, self.renderer,
                                        task_group_id)