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

Function fetch

salt/cache/mysql_cache.py:284–297  ·  view source on GitHub ↗

Fetch a key value.

(bank, key)

Source from the content-addressed store, hash-verified

282
283
284def fetch(bank, key):
285 """
286 Fetch a key value.
287 """
288 _init_client()
289 query = "SELECT data FROM {} WHERE bank=%s AND etcd_key=%s".format(
290 __context__["mysql_table_name"]
291 )
292 cur, _ = run_query(__context__.get("mysql_client"), query, args=(bank, key))
293 r = cur.fetchone()
294 cur.close()
295 if r is None:
296 return {}
297 return salt.payload.loads(r[0])
298
299
300def flush(bank, key=None):

Callers

nothing calls this directly

Calls 6

formatMethod · 0.80
_init_clientFunction · 0.70
run_queryFunction · 0.70
getMethod · 0.45
closeMethod · 0.45
loadsMethod · 0.45

Tested by

no test coverage detected