'Update the config file with the authorization.'

@staticmethod
@conductor_only
def _update_config_file(username, password, email, url, config_path):

    try:
        config = json.load(open(config_path, 'r'))
    except ValueError:
        config = dict()
    if (not config.get('auths')):
        config['auths'] = dict()
    if (not config['auths'].get(url)):
        config['auths'][url] = dict()
    encoded_credentials = dict(auth=base64.b64encode(((username + ':') + password)), email=email)
    config['auths'][url] = encoded_credentials
    try:
        json.dump(config, open(config_path, 'w'), indent=5, sort_keys=True)
    except Exception as exc:
        raise exceptions.AnsibleContainerConductorException(u'Failed    to    write    registry    config    to    {0}    -    {1}'.format(config_path, exc))
