Store a key value.
(bank, key, data)
| 265 | |
| 266 | |
| 267 | def 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 | |
| 284 | def fetch(bank, key): |
nothing calls this directly
no test coverage detected