MCPcopy Create free account
hub / github.com/Keeper-Security/Commander / save_server_keys

Function save_server_keys

keepercommander/cli.py:279–293  ·  view source on GitHub ↗

Write only the "server_keys" property, leaving the rest of the file as it is.

(params)

Source from the content-addressed store, hash-verified

277
278
279def save_server_keys(params): # type: (KeeperParams) -> None
280 """Write only the "server_keys" property, leaving the rest of the file as it is."""
281 if not params.config_filename:
282 return
283 config = {}
284 if os.path.isfile(params.config_filename):
285 with open(params.config_filename) as fd:
286 config = json.load(fd)
287 if params.config.get('server_keys'):
288 config['server_keys'] = params.config['server_keys']
289 else:
290 config.pop('server_keys', None)
291 with open(params.config_filename, 'w') as fd:
292 json.dump(config, fd, ensure_ascii=False, indent=2)
293 utils.set_file_permissions(params.config_filename)
294
295
296def server_command(params, args): # type: (KeeperParams, str) -> None

Callers 1

server_commandFunction · 0.85

Calls 2

loadMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected