Comment 4 for bug 1854172

Revision history for this message
Ovidiu Poncea (ovidiuponcea) wrote :

This was introduced in: https://review.opendev.org/#/c/693213/

Code that creates localhost_override_backup.yml will take the no_proxy list from the DB:
        for docker in docker_list:
            # Get the docker no-proxy info if it exists
            if docker.name == constants.SERVICE_PARAM_NAME_DOCKER_NO_PROXY:
                # Remove the open and close parenthesis if address is IPV6
                _value = docker.value.strip("[]")
                no_proxy_list = _value.split(',')
                data.update({'docker_no_proxy': no_proxy_list})

and write it in localhost_override_backup.yml:

docker_no_proxy:
- localhost
- 127.0.0.1
- registry.local
- '[abcd:204::1]'
- '[abcd:204::2]'
- '[2620:10a:a001:a103::1237]'
- '[2620:10a:a001:a103::1235]'
- '[abcd:204::3]'
- '[2620:10a:a001:a103::1236]'
- tis-lab-registry.cumulus.wrs.com

Problem is that the original list of custom no_proxy registries used at configuration in localhost.yml is:
docker_no_proxy:
- registry.local
- tis-lab-registry.cumulus.wrs.com

Which ansible bootstrap writes to sysinv as:
localhost,127.0.0.1,registry.local,[abcd:204::1],[abcd:204::2],[2620:10a:a001:a103::1237],[2620:10a:a001:a103::1235],[abcd:204::3],[2620:10a:a001:a103::1236],tis-lab-registry.cumulus.wrs.com

That's because ansible appends the two custom ones to a default list in:
    - name: Add user defined no-proxy address list to default
      set_fact:
        docker_no_proxy_combined: "{{ default_no_proxy | union(docker_no_proxy) | unique | ipwrap }}"

This means that at restore the list of defaults entries will be doubled, which leads to a string that is too long (hence the "The service parameter value is restricted to at most 255 characters." error).

Two possible solutions here:
A. Do not write the default values to localhost_override_backup.yml or
B. Do not append the default values to the docker_no_proxy_combined list whne mode == 'restore' with something like:
    - name: Add user defined no-proxy address list to default
      set_fact:
        docker_no_proxy_combined: "{{ default_no_proxy | union(docker_no_proxy) | unique | ipwrap }}"
    when: mode != 'restore'

    - name: Add user defined no-proxy address list to default
      set_fact:
        docker_no_proxy_combined: "{{ union(docker_no_proxy) | unique }}"
    when: mode != 'restore'

What I don't understant is why "unique" doesn't remove duplicates, probably the syntax of IPv6 ip's is sligthly different?