def run(self): repo = self.get_repo() task = AsyncTask(self.api.sync(repo['id'])) run_async_task_with_status(task, ProgressBar()) return evaluate_task_status(task, failed = _("Repo [ %s ] failed to sync") % repo["name"], canceled = _("Repo [ %s ] synchronization canceled") % repo["name"], ok = _("Repo [ %s ] synchronized") % repo["name"] )
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()) return evaluate_task_status(task, failed = _("Provider [ %s ] failed to sync") % providerName, canceled = _("Provider [ %s ] synchronization canceled") % providerName, ok = _("Provider [ %s ] synchronized") % providerName )
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()) return evaluate_task_status( task, failed=_("Provider [ %s ] failed to sync") % providerName, canceled=_("Provider [ %s ] synchronization canceled") % providerName, ok=_("Provider [ %s ] synchronized") % providerName)
def run(self): orgName = self.get_option('org') prodName = self.get_option('name') prodLabel = self.get_option('label') prodId = self.get_option('id') prod = get_product(orgName, prodName, prodLabel, prodId) task = AsyncTask(self.api.sync(orgName, prod["id"])) run_async_task_with_status(task, ProgressBar()) return evaluate_task_status(task, failed = _("Product [ %s ] failed to sync") % prod["name"], canceled = _("Product [ %s ] synchronization canceled") % prod["name"], ok = _("Product [ %s ] synchronized") % prod["name"] )
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 canceled" % repo['name']) return os.EX_OK else: print _("Repo [ %(repo_name)s ] failed to sync: %(sync_errors)s") \ % {'repo_name':repo['name'], 'sync_errors':format_sync_errors(task)} return os.EX_DATAERR
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 [ %(providerName)s ] failed to sync: %(errors)s" % {"providerName": providerName, "errors": 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
def run(self): orgName = self.get_option('org') prodName = self.get_option('name') prodLabel = self.get_option('label') prodId = self.get_option('id') prod = get_product(orgName, prodName, prodLabel, prodId) 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 [ %(prod_name)s ] failed to sync: %(errors)s" \ % {'prod_name':prod["name"], 'errors':errors}) return os.EX_DATAERR elif task.cancelled(): print _("Product [ %s ] synchronization canceled" % prod["name"]) return os.EX_DATAERR print _("Product [ %s ] synchronized" % prod["name"]) return os.EX_OK