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

Function fetch_pack_index

st2common/st2common/services/packs.py:168–194  ·  view source on GitHub ↗

Fetch the pack indexes (either from the config or provided as an argument) and return the object.

(index_url=None, logger=None, allow_empty=False, proxy_config=None)

Source from the content-addressed store, hash-verified

166
167
168def fetch_pack_index(index_url=None, logger=None, allow_empty=False, proxy_config=None):
169 """
170 Fetch the pack indexes (either from the config or provided as an argument)
171 and return the object.
172 """
173 logger = logger or LOG
174
175 index_urls = _build_index_list(index_url)
176 index, status = _fetch_and_compile_index(
177 index_urls=index_urls, logger=logger, proxy_config=proxy_config
178 )
179
180 # If one of the indexes on the list is unresponsive, we do not throw
181 # immediately. The only case where an exception is raised is when no
182 # results could be obtained from all listed indexes.
183 # This behavior allows for mirrors / backups and handling connection
184 # or network issues in one of the indexes.
185 if not index and not allow_empty:
186 raise ValueError(
187 "No results from the %s: tried %s.\nStatus: %s"
188 % (
189 ("index" if len(index_urls) == 1 else "indexes"),
190 ", ".join(index_urls),
191 json_encode(status, indent=4),
192 )
193 )
194 return (index, status)
195
196
197def get_pack_from_index(pack, proxy_config=None):

Callers 2

get_pack_from_indexFunction · 0.85
search_pack_indexFunction · 0.85

Calls 3

json_encodeFunction · 0.90
_build_index_listFunction · 0.85
_fetch_and_compile_indexFunction · 0.85

Tested by

no test coverage detected