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

Method get_packs

st2common/st2common/content/loader.py:54–76  ·  view source on GitHub ↗

Retrieve a list of packs in the provided directories. :return: Dictionary where the key is pack name and the value is full path to the pack directory. :rtype: ``dict``

(self, base_dirs)

Source from the content-addressed store, hash-verified

52 ]
53
54 def get_packs(self, base_dirs):
55 """
56 Retrieve a list of packs in the provided directories.
57
58 :return: Dictionary where the key is pack name and the value is full path to the pack
59 directory.
60 :rtype: ``dict``
61 """
62 if not isinstance(base_dirs, list):
63 raise TypeError(
64 "The base dirs has a value that is not a list"
65 f" (was {type(base_dirs)})."
66 )
67
68 result = {}
69 for base_dir in base_dirs:
70 if not os.path.isdir(base_dir):
71 raise ValueError('Directory "%s" doesn\'t exist' % (base_dir))
72
73 packs_in_dir = self._get_packs_from_dir(base_dir=base_dir)
74 result.update(packs_in_dir)
75
76 return result
77
78 def get_content(self, base_dirs, content_type):
79 """

Callers 2

register_from_packsMethod · 0.80
register_packsMethod · 0.80

Calls 2

_get_packs_from_dirMethod · 0.95
updateMethod · 0.45

Tested by

no test coverage detected