本文整理汇总了Python中katello.client.core.utils.AsyncTask.succeeded方法的典型用法代码示例。如果您正苦于以下问题:Python AsyncTask.succeeded方法的具体用法?Python AsyncTask.succeeded怎么用?Python AsyncTask.succeeded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类katello.client.core.utils.AsyncTask
的用法示例。
在下文中一共展示了AsyncTask.succeeded方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: from katello.client.core.utils import AsyncTask [as 别名]
# 或者: from katello.client.core.utils.AsyncTask import succeeded [as 别名]
def run(self):
orgName = self.get_option('org')
prodName = self.get_option('name')
envName = self.get_option('env')
env = get_environment(orgName, envName)
prod = get_product(orgName, prodName)
returnCode = os.EX_OK
cset = self.csapi.create(orgName, env["id"], self.create_cs_name())
try:
self.csapi.add_content(cset["id"], "products", {'product_id': prod['id']})
task = self.csapi.promote(cset["id"])
task = AsyncTask(task)
run_spinner_in_bg(wait_for_async_task, [task], message=_("Promoting the product, please wait... "))
if task.succeeded():
print _("Product [ %s ] promoted to environment [ %s ] " % (prodName, envName))
returnCode = os.EX_OK
else:
print _("Product [ %s ] promotion failed: %s" % (prodName, format_task_errors(task.errors())) )
returnCode = os.EX_DATAERR
except Exception as e:
#exception message is printed from action's main method
raise e
return returnCode
示例2: run
# 需要导入模块: from katello.client.core.utils import AsyncTask [as 别名]
# 或者: from katello.client.core.utils.AsyncTask import succeeded [as 别名]
def run(self):
orgName = self.get_option('org')
prodName = self.get_option('name')
prodLabel = self.get_option('label')
prodId = self.get_option('id')
envName = self.get_option('environment')
env = get_environment(orgName, envName)
prod = get_product(orgName, prodName, prodLabel, prodId)
returnCode = os.EX_OK
cset = self.csapi.create(orgName, env["id"], self.create_cs_name(), constants.PROMOTION)
try:
self.csapi.add_content(cset["id"], "products", {'product_id': prod['id']})
task = self.csapi.apply(cset["id"])
task = AsyncTask(task)
run_spinner_in_bg(wait_for_async_task, [task], message=_("Promoting the product, please wait... "))
if task.succeeded():
print _("Product [ %(prod_name)s ] promoted to environment [ %(envName)s ] " \
% {'prod_name':prod["name"], 'envName':envName})
returnCode = os.EX_OK
else:
print _("Product [ %(prod_name)s ] promotion failed: %(task_errors)s" \
% {'prod_name':prod["name"], 'task_errors':format_task_errors(task.errors())} )
returnCode = os.EX_DATAERR
except Exception:
#exception message is printed from action's main method
raise
return returnCode
示例3: run
# 需要导入模块: from katello.client.core.utils import AsyncTask [as 别名]
# 或者: from katello.client.core.utils.AsyncTask import succeeded [as 别名]
def run(self):
name = self.get_option('name')
task = self.api.delete(name)
task = AsyncTask(task)
run_spinner_in_bg(wait_for_async_task, [task], message=_("Deleting the organization, please wait... "))
if task.succeeded():
print _("Successfully deleted org [ %s ]") % name
return os.EX_OK
else:
print _("Organization [ %s ] deletion failed: %s" % (name, format_task_errors(task.errors())) )
return os.EX_DATAERR
示例4: run
# 需要导入模块: from katello.client.core.utils import AsyncTask [as 别名]
# 或者: from katello.client.core.utils.AsyncTask import succeeded [as 别名]
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
示例5: run
# 需要导入模块: from katello.client.core.utils import AsyncTask [as 别名]
# 或者: from katello.client.core.utils.AsyncTask import succeeded [as 别名]
def run(self):
csName = self.get_option('name')
orgName = self.get_option('org')
envName = self.get_option('env')
cset = get_changeset(orgName, envName, csName)
task = self.api.promote(cset["id"])
task = AsyncTask(task)
run_spinner_in_bg(wait_for_async_task, [task], message=_("Promoting the changeset, please wait... "))
if task.succeeded():
print _("Changeset [ %s ] promoted" % csName)
return os.EX_OK
else:
print _("Changeset [ %s ] promotion failed: %s" % (csName, format_task_errors(task.errors())))
return os.EX_DATAERR
示例6: run
# 需要导入模块: from katello.client.core.utils import AsyncTask [as 别名]
# 或者: from katello.client.core.utils.AsyncTask import succeeded [as 别名]
def run(self):
csName = self.get_option('name')
orgName = self.get_option('org')
envName = self.get_option('environment')
cset = get_changeset(orgName, envName, csName)
task = self.api.apply(cset["id"])
task = AsyncTask(task)
run_spinner_in_bg(wait_for_async_task, [task], message=_("Applying the changeset, please wait... "))
if task.succeeded():
print _("Changeset [ %s ] applied" % csName)
return os.EX_OK
else:
print _("Changeset [ %(csName)s ] promotion failed: %(task_errors)s" \
% {'csName':csName, 'task_errors':format_task_errors(task.errors())})
return os.EX_DATAERR