summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam King <47704447+adk3798@users.noreply.github.com>2024-11-27 21:10:19 +0100
committerGitHub <noreply@github.com>2024-11-27 21:10:19 +0100
commit67f1905d9ab89f4245a7c4b08b88df4374f4f5a4 (patch)
tree2cdfb313c0d1b695cb5cc07ecfefcafaae45dd3d /src
parentMerge pull request #60856 from ceph/uadk_version (diff)
parentAdd multiple labels in single command to host (diff)
downloadceph-67f1905d9ab89f4245a7c4b08b88df4374f4f5a4.tar.xz
ceph-67f1905d9ab89f4245a7c4b08b88df4374f4f5a4.zip
Merge pull request #60721 from anuradhagadge/fix_issue_68748_add_multiple_lable
cephadm: Add multiple labels in single command to host Reviewed-by: Adam King <adking@redhat.com>
Diffstat (limited to 'src')
-rw-r--r--src/pybind/mgr/cephadm/inventory.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/pybind/mgr/cephadm/inventory.py b/src/pybind/mgr/cephadm/inventory.py
index c3051240713..d3681cbe60a 100644
--- a/src/pybind/mgr/cephadm/inventory.py
+++ b/src/pybind/mgr/cephadm/inventory.py
@@ -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: