def _resolve_authconfig_credstore(authconfig, registry, credstore_name): if not registry or registry == INDEX_NAME: # The ecosystem is a little schizophrenic with index.dockers.io VS # dockers.io - in that case, it seems the full URL is necessary. registry = 'https://index.docker.io/v1/' log.debug("Looking for auth entry for {0}".format(repr(registry))) store = dockerpycreds.Store(credstore_name) try: data = store.get(registry) res = { 'ServerAddress': registry, } if data['Username'] == TOKEN_USERNAME: res['IdentityToken'] = data['Secret'] else: res.update({ 'Username': data['Username'], 'Password': data['Secret'], }) return res except dockerpycreds.CredentialsNotFound as e: log.debug('No entry found') return None except dockerpycreds.StoreError as e: raise errors.DockerException( 'Credentials store error: {0}'.format(repr(e)) )
def _get_store_instance(self, name): if name not in self._stores: self._stores[name] = dockerpycreds.Store( name, environment=self._credstore_env) return self._stores[name]