本文整理汇总了Python中dpa.ptask.area.PTaskArea.provision方法的典型用法代码示例。如果您正苦于以下问题:Python PTaskArea.provision方法的具体用法?Python PTaskArea.provision怎么用?Python PTaskArea.provision使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dpa.ptask.area.PTaskArea
的用法示例。
在下文中一共展示了PTaskArea.provision方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _link_sub
# 需要导入模块: from dpa.ptask.area import PTaskArea [as 别名]
# 或者: from dpa.ptask.area.PTaskArea import provision [as 别名]
def _link_sub(self, sub, app):
area = PTaskArea(self.ptask.spec, version=self.version)
product_ver = sub.product_version
try:
product_ver_area = PTaskArea(product_ver.spec)
except PTaskAreaError as e:
raise ActionError(
"Unable to locate product directory for: " + product_ver.spec
)
product_ver_path = product_ver_area.path
product = product_ver.product
product_ver_import_dir = os.path.join('import', app, product.name)
try:
area.provision(product_ver_import_dir)
except PTaskAreaError as e:
raise ActionError(
"Failed to provision product import dir: " + str(e))
link_name = os.path.join(area.path,
product_ver_import_dir, product.category)
print "Creating subscription {a} link for: {pv}".format(
a=app, pv=product_ver.spec)
os.symlink(product_ver_path, link_name)
product_ver_area = PTaskArea(product_ver.spec)
示例2: _prep_import_dir
# 需要导入模块: from dpa.ptask.area import PTaskArea [as 别名]
# 或者: from dpa.ptask.area.PTaskArea import provision [as 别名]
def _prep_import_dir(self):
area = PTaskArea(self.ptask.spec, version=self.version)
import_dir = area.dir(dir_name="import", verify=False, path=True)
if os.path.exists(import_dir):
print "Cleaning up existing import directory."
try:
shutil.rmtree(import_dir)
except Exception as e:
raise ActionError("Failed to remove old import dir: " + str(e))
global_import_dir = os.path.join('import', 'global')
try:
print "Provisioning new import directory."
area.provision('import')
area.provision(global_import_dir)
except PTaskAreaError as e:
raise ActionError(
"Failed to provision global import directory: " + str(e))
return area.dir(dir_name=global_import_dir, path=True)