summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common.py5
-rw-r--r--unit_tests/test_common.py8
2 files changed, 11 insertions, 2 deletions
diff --git a/common.py b/common.py
index fc2ed5c..626f0da 100644
--- a/common.py
+++ b/common.py
@@ -338,8 +338,9 @@ class CRM(dict):
338 -------- 338 --------
339 http://crmsh.github.io/man/#cmdhelp_configure_delete 339 http://crmsh.github.io/man/#cmdhelp_configure_delete
340 """ 340 """
341 self['delete_resources'] = (*self['delete_resources'], resource) 341 if resource not in self['delete_resources']:
342 self.remove_deleted_resources() 342 self['delete_resources'] = (*self['delete_resources'], resource)
343 self.remove_deleted_resources()
343 344
344 def init_services(self, *resources): 345 def init_services(self, *resources):
345 """Specifies that the service(s) is an init or upstart service. 346 """Specifies that the service(s) is an init or upstart service.
diff --git a/unit_tests/test_common.py b/unit_tests/test_common.py
index 426ca8a..497bb34 100644
--- a/unit_tests/test_common.py
+++ b/unit_tests/test_common.py
@@ -213,6 +213,14 @@ class TestHAClusterCommonCRM(unittest.TestCase):
213 crm['delete_resources'], 213 crm['delete_resources'],
214 ('grp_mysql', 'res_mysql_vip')) 214 ('grp_mysql', 'res_mysql_vip'))
215 215
216 def test_add_delete_resource_dupe(self):
217 crm = common.CRM()
218 crm.add_delete_resource('res_mysql_vip')
219 crm.add_delete_resource('res_mysql_vip')
220 self.assertEqual(
221 crm['delete_resources'],
222 ('res_mysql_vip',))
223
216 def test_init_services(self): 224 def test_init_services(self):
217 crm = common.CRM() 225 crm = common.CRM()
218 crm.init_services('haproxy') 226 crm.init_services('haproxy')