MCPcopy
hub / github.com/saltstack/salt / tagify

Function tagify

salt/utils/event.py:200–229  ·  view source on GitHub ↗

convenience function to build a namespaced event tag string from joining with the TABPART character the base, prefix and suffix If string prefix is a valid key in TAGS Then use the value of key prefix Else use prefix string If suffix is a list Then join all string elements of

(suffix="", prefix="", base=SALT)

Source from the content-addressed store, hash-verified

198
199
200def tagify(suffix="", prefix="", base=SALT):
201 """
202 convenience function to build a namespaced event tag string
203 from joining with the TABPART character the base, prefix and suffix
204
205 If string prefix is a valid key in TAGS Then use the value of key prefix
206 Else use prefix string
207
208 If suffix is a list Then join all string elements of suffix individually
209 Else use string suffix
210
211 """
212 parts = [base, TAGS.get(prefix, prefix)]
213 if isinstance(suffix, Iterable) and not isinstance(
214 suffix, str
215 ): # list so extend parts
216 parts.extend(suffix)
217 else: # string so append
218 parts.append(suffix)
219
220 str_parts = []
221 for part in parts:
222 part_str = None
223 try:
224 part_str = salt.utils.stringutils.to_str(part)
225 except TypeError:
226 part_str = str(part)
227 if part_str:
228 str_parts.append(part_str)
229 return TAGPARTER.join(str_parts)
230
231
232class SaltEvent:

Callers 15

handle_presenceMethod · 0.90
_post_statsMethod · 0.90
_register_resourcesMethod · 0.90
_pillarMethod · 0.90
wheelMethod · 0.90
publishMethod · 0.90
_prep_pubMethod · 0.90
_thread_returnMethod · 0.90
_fire_start_eventMethod · 0.90
_forward_eventsMethod · 0.90

Calls 3

getMethod · 0.45
extendMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected