Merge pull request from adk3798/dup-labels

mgr/cephadm: remove duplicate labels when adding a host

Reviewed-by: Juan Miguel Olmo Martínez <jolmomar@redhat.com>
Reviewed-by: Michael Fritch <mfritch@suse.com>
Reviewed-by: Sebastian Wagner <sebastian.wagner@suse.com>
This commit is contained in:
Sebastian Wagner 2021-03-12 12:04:54 +01:00 committed by GitHub
commit 515feee667
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -32,7 +32,7 @@ class HostSpec(object):
return {
'hostname': self.hostname,
'addr': self.addr,
'labels': self.labels,
'labels': list(set((self.labels))),
'status': self.status,
}
@ -40,7 +40,7 @@ class HostSpec(object):
def from_json(cls, host_spec: dict) -> 'HostSpec':
_cls = cls(host_spec['hostname'],
host_spec['addr'] if 'addr' in host_spec else None,
host_spec['labels'] if 'labels' in host_spec else None,
list(set(host_spec['labels'])) if 'labels' in host_spec else None,
host_spec['status'] if 'status' in host_spec else None)
return _cls