diff --git a/magnumclient/common/utils.py b/magnumclient/common/utils.py index 4c40bc3..9c26ac7 100644 --- a/magnumclient/common/utils.py +++ b/magnumclient/common/utils.py @@ -112,9 +112,7 @@ def format_labels(lbls, parse_comma=True): if k not in labels: labels[k] = v else: - if not isinstance(labels[k], list): - labels[k] = [labels[k]] - labels[k].append(v) + labels[k] += ",%s" % v return labels diff --git a/magnumclient/tests/test_utils.py b/magnumclient/tests/test_utils.py index d263201..7bef020 100644 --- a/magnumclient/tests/test_utils.py +++ b/magnumclient/tests/test_utils.py @@ -191,9 +191,7 @@ class FormatLabelsTest(test_utils.BaseTestCase): l = utils.format_labels([ 'K1=V1', 'K1=V2']) - self.assertIn('K1', l) - self.assertIn('V1', l['K1']) - self.assertIn('V2', l['K1']) + self.assertEqual({'K1': 'V1,V2'}, l) def test_format_label_special_label(self): labels = ['K1=V1,K22.2.2.2']