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

Function check_pack_content_directory_exists

st2common/st2common/content/utils.py:113–132  ·  view source on GitHub ↗

Check if a provided pack exists in one of the pack paths. :param pack: Pack name. :type pack: ``str`` :param content_type: Content type (actions, sensors, rules). :type content_type: ``str`` :rtype: ``bool``

(pack, content_type)

Source from the content-addressed store, hash-verified

111
112
113def check_pack_content_directory_exists(pack, content_type):
114 """
115 Check if a provided pack exists in one of the pack paths.
116
117 :param pack: Pack name.
118 :type pack: ``str``
119
120 :param content_type: Content type (actions, sensors, rules).
121 :type content_type: ``str``
122
123 :rtype: ``bool``
124 """
125 packs_base_paths = get_packs_base_paths()
126
127 for base_dir in packs_base_paths:
128 pack_content_pack = os.path.join(base_dir, pack, content_type)
129 if os.path.exists(pack_content_pack):
130 return True
131
132 return False
133
134
135def get_pack_base_path(pack_name, include_trailing_slash=False, use_pack_cache=False):

Callers 1

_is_valid_packFunction · 0.90

Calls 2

get_packs_base_pathsFunction · 0.85
existsMethod · 0.80

Tested by

no test coverage detected