Beispiel #1
0
    def run(self):
        repo = self.get_repo()

        task = AsyncTask(self.api.sync(repo['id']))
        run_async_task_with_status(task, ProgressBar())

        if task.succeeded():
            print _("Repo [ %s ] synced" % repo['name'])
            return os.EX_OK
        elif task.cancelled():
            print _("Repo [ %s ] synchronization cancelled" % repo['name'])
            return os.EX_OK
        else:
            print _("Repo [ %s ] failed to sync: %s" % (repo['name'], format_sync_errors(task)) )
            return os.EX_DATAERR
Beispiel #2
0
    def run(self):
        repo = self.get_repo()

        task = AsyncTask(self.api.sync(repo['id']))
        run_async_task_with_status(task, ProgressBar())

        if task.succeeded():
            print _("Repo [ %s ] synced" % repo['name'])
            return os.EX_OK
        elif task.cancelled():
            print _("Repo [ %s ] synchronization cancelled" % repo['name'])
            return os.EX_OK
        else:
            print _("Repo [ %s ] failed to sync: %s" % (repo['name'], format_sync_errors(task)) )
            return os.EX_DATAERR
Beispiel #3
0
    def sync_provider(self, providerName, orgName):
        prov = get_provider(orgName, providerName)

        task = AsyncTask(self.api.sync(prov["id"]))
        run_async_task_with_status(task, ProgressBar())

        if task.failed():
            errors = format_sync_errors(task)
            print _("Provider [ %s ] failed to sync: %s" % (providerName, errors))
            return os.EX_DATAERR
        elif task.cancelled():
            print _("Provider [ %s ] synchronization canceled" % providerName)
            return os.EX_DATAERR

        print _("Provider [ %s ] synchronized" % providerName)
        return os.EX_OK
Beispiel #4
0
    def sync_provider(self, providerName, orgName):
        prov = get_provider(orgName, providerName)

        task = AsyncTask(self.api.sync(prov["id"]))
        run_async_task_with_status(task, ProgressBar())

        if task.failed():
            errors = format_sync_errors(task)
            print _("Provider [ %s ] failed to sync: %s" %
                    (providerName, errors))
            return os.EX_DATAERR
        elif task.cancelled():
            print _("Provider [ %s ] synchronization cancelled" % providerName)
            return os.EX_DATAERR

        print _("Provider [ %s ] synchronized" % providerName)
        return os.EX_OK
Beispiel #5
0
    def run(self):
        orgName     = self.get_option('org')
        prodName    = self.get_option('name')

        prod = get_product(orgName, prodName)

        task = AsyncTask(self.api.sync(orgName, prod["id"]))
        run_async_task_with_status(task, ProgressBar())

        if task.failed():
            errors = [t["result"]['errors'][0] for t in task.get_hashes() if t['state'] == 'error' and
                                                                             isinstance(t["result"], dict) and
                                                                             "errors" in t["result"]]
            print _("Product [ %s ] failed to sync: %s" % (prodName, errors))
            return os.EX_DATAERR
        elif task.cancelled():
            print _("Product [ %s ] synchronization cancelled" % prodName)
            return os.EX_DATAERR

        print _("Product [ %s ] synchronized" % prodName)
        return os.EX_OK
Beispiel #6
0
    def run(self):
        orgName     = self.get_option('org')
        prodName    = self.get_option('name')

        prod = get_product(orgName, prodName)

        task = AsyncTask(self.api.sync(orgName, prod["id"]))
        run_async_task_with_status(task, ProgressBar())

        if task.failed():
            errors = [t["result"]['errors'][0] for t in task.get_hashes() if t['state'] == 'error' and
                                                                             isinstance(t["result"], dict) and
                                                                             "errors" in t["result"]]
            print _("Product [ %s ] failed to sync: %s" % (prodName, errors))
            return os.EX_DATAERR
        elif task.cancelled():
            print _("Product [ %s ] synchronization cancelled" % prodName)
            return os.EX_DATAERR

        print _("Product [ %s ] synchronized" % prodName)
        return os.EX_OK