]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
Add multiple labels in single command to host
authorAnuradha Gadge <anuradha.gadge@ibm.com>
Wed, 13 Nov 2024 09:39:27 +0000 (15:09 +0530)
committerAnuradha Gadge <anuradha.gadge@ibm.com>
Wed, 13 Nov 2024 09:39:27 +0000 (15:09 +0530)
Signed-off-by: Anuradha Gadge <anuradha.gadge@ibm.com>
src/pybind/mgr/cephadm/inventory.py

index 8a16ef8ae80c53cd2b3f2d3694f8d1d8c9f014e4..00410c1bc3899c6924fa6982151f50d758dd1987 100644 (file)
@@ -187,11 +187,12 @@ class Inventory:
 
     def add_label(self, host: str, label: str) -> None:
         host = self._get_stored_name(host)
-
+        labels = label.split(',') if ',' in label else [label]
         if 'labels' not in self._inventory[host]:
             self._inventory[host]['labels'] = list()
-        if label not in self._inventory[host]['labels']:
-            self._inventory[host]['labels'].append(label)
+        for label in labels:
+            if label not in self._inventory[host]['labels']:
+                self._inventory[host]['labels'].append(label)
         self.save()
 
     def rm_label(self, host: str, label: str) -> None: