diff --git a/registries_conf_ctl/cli.py b/registries_conf_ctl/cli.py index 060d8b5..fe55cec 100644 --- a/registries_conf_ctl/cli.py +++ b/registries_conf_ctl/cli.py @@ -86,7 +86,7 @@ def _extend(d, key, what): if key not in d: d[key] = [what] else: - d[key].add(what) + d[key] = list(set(d[key] + [what])) class DockerDaemonJson(Fmt): diff --git a/tests/test_add_mirror.py b/tests/test_add_mirror.py index 285eb27..17254bc 100644 --- a/tests/test_add_mirror.py +++ b/tests/test_add_mirror.py @@ -95,9 +95,14 @@ def test_add_mirror(test_input, expected, cls, tmpdir): fmt.add_mirror('docker.io', 'vossi04.front.sepia.ceph.com:5000', True, True) assert fmt.config == expected + p = tmpdir.join("conf.conf") p.write(test_input) subprocess.check_call('registries-conf-ctl --conf {p} add-mirror docker.io vossi04.front.sepia.ceph.com:5000 --insecure --http'.format(p=p), shell=True) assert cls(p).config == expected + + subprocess.check_call('registries-conf-ctl --conf {p} add-mirror docker.io vossi04.front.sepia.ceph.com:5000 --insecure --http'.format(p=p), shell=True) + + assert cls(p).config == expected