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

Function save_server_keys

keepercommander/cli.py:293–307  ·  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

291
292
293def save_server_keys(params): # type: (KeeperParams) -> None
294 """Write only the "server_keys" property, leaving the rest of the file as it is."""
295 if not params.config_filename:
296 return
297 config = {}
298 if os.path.isfile(params.config_filename):
299 with open(params.config_filename) as fd:
300 config = json.load(fd)
301 if params.config.get('server_keys'):
302 config['server_keys'] = params.config['server_keys']
303 else:
304 config.pop('server_keys', None)
305 with open(params.config_filename, 'w') as fd:
306 json.dump(config, fd, ensure_ascii=False, indent=2)
307 utils.set_file_permissions(params.config_filename)
308
309
310def 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