MCPcopy Create free account
hub / github.com/StackStorm/st2 / get_entry_point_abs_path

Function get_entry_point_abs_path

st2common/st2common/content/utils.py:212–244  ·  view source on GitHub ↗

Return full absolute path of an action entry point in a pack. :param pack: Content pack reference. :type pack: ``str`` :param entry_point: Action entry point. :type entry_point: ``str`` :rtype: ``str``

(pack=None, entry_point=None, use_pack_cache=False)

Source from the content-addressed store, hash-verified

210
211
212def get_entry_point_abs_path(pack=None, entry_point=None, use_pack_cache=False):
213 """
214 Return full absolute path of an action entry point in a pack.
215
216 :param pack: Content pack reference.
217 :type pack: ``str``
218
219 :param entry_point: Action entry point.
220 :type entry_point: ``str``
221
222 :rtype: ``str``
223 """
224 if not entry_point:
225 return None
226
227 if os.path.isabs(entry_point):
228 pack_base_path = get_pack_base_path(
229 pack_name=pack, use_pack_cache=use_pack_cache
230 )
231 common_prefix = os.path.commonprefix([pack_base_path, entry_point])
232
233 if common_prefix != pack_base_path:
234 raise ValueError(
235 'Entry point file "%s" is located outside of the pack directory'
236 % (entry_point)
237 )
238
239 return entry_point
240
241 entry_point_abs_path = get_pack_resource_file_abs_path(
242 pack_ref=pack, resource_type="action", file_path=entry_point
243 )
244 return entry_point_abs_path
245
246
247def get_pack_file_abs_path(

Calls 2

get_pack_base_pathFunction · 0.85