Skip to content

Commit 2e7d1ee

Browse files
author
Anuradha Gadge
committed
Add multiple labels in single command to host
Signed-off-by: Anuradha Gadge <[email protected]>
1 parent 1c93566 commit 2e7d1ee

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/pybind/mgr/cephadm/inventory.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,12 @@ def set_addr(self, host: str, addr: str) -> None:
187187

188188
def add_label(self, host: str, label: str) -> None:
189189
host = self._get_stored_name(host)
190-
190+
labels = label.split(',') if ',' in label else [label]
191191
if 'labels' not in self._inventory[host]:
192192
self._inventory[host]['labels'] = list()
193-
if label not in self._inventory[host]['labels']:
194-
self._inventory[host]['labels'].append(label)
193+
for label in labels:
194+
if label not in self._inventory[host]['labels']:
195+
self._inventory[host]['labels'].append(label)
195196
self.save()
196197

197198
def rm_label(self, host: str, label: str) -> None:

0 commit comments

Comments
 (0)