MCPcopy
hub / github.com/docker/docker-py / _load_legacy_config

Function _load_legacy_config

docker/auth.py:352–378  ·  view source on GitHub ↗
(config_file)

Source from the content-addressed store, hash-verified

350
351
352def _load_legacy_config(config_file):
353 log.debug("Attempting to parse legacy auth file format")
354 try:
355 data = []
356 with open(config_file) as f:
357 for line in f.readlines():
358 data.append(line.strip().split(' = ')[1])
359 if len(data) < 2:
360 # Not enough data
361 raise errors.InvalidConfigFile(
362 'Invalid or empty configuration file!'
363 )
364
365 username, password = decode_auth(data[0])
366 return {'auths': {
367 INDEX_NAME: {
368 'username': username,
369 'password': password,
370 'email': data[1],
371 'serveraddress': INDEX_URL,
372 }
373 }}
374 except Exception as e:
375 log.debug(e)
376
377 log.debug("All parsing attempts failed - returning empty config")
378 return {}

Callers 1

load_configMethod · 0.85

Calls 1

decode_authFunction · 0.85

Tested by

no test coverage detected