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

Function store

salt/cache/mysql_cache.py:267–281  ·  view source on GitHub ↗

Store a key value.

(bank, key, data)

Source from the content-addressed store, hash-verified

265
266
267def store(bank, key, data):
268 """
269 Store a key value.
270 """
271 _init_client()
272 data = salt.payload.dumps(data)
273 query = "REPLACE INTO {} (bank, etcd_key, data) values(%s,%s,%s)".format(
274 __context__["mysql_table_name"]
275 )
276 args = (bank, key, data)
277
278 cur, cnt = run_query(__context__.get("mysql_client"), query, args=args)
279 cur.close()
280 if cnt not in (1, 2):
281 raise SaltCacheError(f"Error storing {bank} {key} returned {cnt}")
282
283
284def fetch(bank, key):

Callers

nothing calls this directly

Calls 7

SaltCacheErrorClass · 0.90
formatMethod · 0.80
_init_clientFunction · 0.70
run_queryFunction · 0.70
dumpsMethod · 0.45
getMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected