def _UpdateEnv(manifest, remove_container_env, container_env_file, container_env):
    'Update environment variables in container manifest.'
    current_env = {}
    for env_val in manifest['spec']['containers'][0].get('env', []):
        current_env[env_val['name']] = env_val['value']
    for env in remove_container_env:
        current_env.pop(env, None)
    current_env.update(_ReadDictionary(container_env_file))
    for env_var_dict in container_env:
        for (env, val) in six.iteritems(env_var_dict):
            current_env[env] = val
    if current_env:
        manifest['spec']['containers'][0]['env'] = [{'name': env, 'value': val} for (env, val) in six.iteritems(current_env)]
Update environment variables in container manifest.
def _UpdateEnv(manifest, remove_container_env, container_env_file, container_env):
    
    current_env = {}
    for env_val in manifest['spec']['containers'][0].get('env', []):
        current_env[env_val['name']] = env_val['value']
    for env in remove_container_env:
        current_env.pop(env, None)
    current_env.update(_ReadDictionary(container_env_file))
    for env_var_dict in container_env:
        for (env, val) in six.iteritems(env_var_dict):
            current_env[env] = val
    if current_env:
        manifest['spec']['containers'][0]['env'] = [{'name': env, 'value': val} for (env, val) in six.iteritems(current_env)]