Load the "server_keys" property of config.json: {" ": {"key_id": 7, "public_key": "...", "insecure": true}}, every field optional.
(config)
| 259 | |
| 260 | |
| 261 | def load_server_keys(config): # type: (dict) -> None |
| 262 | """Load the "server_keys" property of config.json: |
| 263 | {"<host>": {"key_id": 7, "public_key": "...", "insecure": true}}, every field optional.""" |
| 264 | server_keys = config.get('server_keys') if isinstance(config, dict) else None |
| 265 | if not isinstance(server_keys, dict): |
| 266 | return |
| 267 | for host, entry in server_keys.items(): |
| 268 | if not isinstance(entry, dict): |
| 269 | logging.warning('config.json: server key for "%s" is ignored: not an object', host) |
| 270 | continue |
| 271 | if entry.get('insecure') is True: |
| 272 | try: |
| 273 | set_server_insecure(host, True) |
| 274 | except ValueError as e: |
| 275 | logging.warning('config.json: "insecure" for "%s" is ignored: %s', host, e) |
| 276 | if 'key_id' in entry or 'public_key' in entry: |
| 277 | try: |
| 278 | set_server_public_key(host, entry['key_id'], entry['public_key']) |
| 279 | except Exception as e: |
| 280 | logging.warning('config.json: server key for "%s" is ignored: %s', host, e) |
| 281 | |
| 282 | |
| 283 | def _unverified_reason(context): # type: (RestApiContext) -> Optional[str] |
nothing calls this directly
no test coverage detected