Skip to content

Commit ffcab67

Browse files
committed
add-get-blueprint-dir
1 parent 85b5709 commit ffcab67

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

CHANGELOG.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
releases:
2+
v0.0.127: Support get_blueprint_directory.
23
v0.0.126: Support ECR auth.
34
v0.0.125: Bump cfy lint package version for upstream networkx dependency.
45
v0.0.124: modify iso support

cloudify_common_sdk/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version = '0.0.126'
1+
version = '0.0.127'

cloudify_common_sdk/utils.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,29 @@ def get_deployment_dir(deployment_name=None, deployment_id=None):
110110
raise SDKNonRecoverableError("No deployment directory found!")
111111

112112

113+
def get_blueprint_dir(blueprint_id=None):
114+
""" Get the blueprint directory.
115+
:param blueprint_id: The blueprint ID.
116+
:type blueprint_id: str
117+
:return: Return path to blueprint directory.
118+
:rtype: str
119+
"""
120+
blueprint_dir = os.path.join('/opt', 'manager',
121+
'resources',
122+
'blueprints',
123+
get_tenant_name(),
124+
blueprint_id)
125+
126+
if os.path.isdir(blueprint_dir):
127+
return blueprint_dir
128+
else:
129+
ctx_from_import._context['blueprint_id'] = blueprint_id
130+
blueprint_dir = ctx_from_import.download_directory()
131+
if blueprint_dir and os.path.isdir(blueprint_dir):
132+
return blueprint_dir
133+
raise SDKNonRecoverableError("No blueprint directory found!")
134+
135+
113136
def with_rest_client(func):
114137
""" Add a Cloudify Rest Client into the kwargs of func.
115138
:param func: The wrapped function.

0 commit comments

Comments
 (0)