本文整理匯總了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)