From 382c0c71fa6415ce9aa21a02c8c275e592c44262 Mon Sep 17 00:00:00 2001 From: Bilal Baqar Date: Sat, 26 Mar 2016 20:07:37 +0100 Subject: [PATCH] Removed package removal in stop hook --- hooks/pg_dir_hooks.py | 8 +++----- hooks/pg_dir_utils.py | 5 +---- unit_tests/test_pg_dir_context.py | 2 +- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/hooks/pg_dir_hooks.py b/hooks/pg_dir_hooks.py index e25770d..2476136 100755 --- a/hooks/pg_dir_hooks.py +++ b/hooks/pg_dir_hooks.py @@ -77,10 +77,8 @@ def plumgrid_joined(relation_id=None): This hook is run when relation with edge or gateway is created. ''' opsvm_ip = config('opsvm-ip') - if opsvm_ip == '127.0.0.1': - pass - elif not is_ip(opsvm_ip): - raise ValueError('Incorrect IP specified') + if not is_ip(opsvm_ip): + raise ValueError('Incorrect OPSVM IP specified') else: relation_set(relation_id=relation_id, opsvm_ip=opsvm_ip) @@ -137,7 +135,7 @@ def start(): while (count < 10): if post_pg_license(): break - count = count + 1 + count += 1 time.sleep(15) diff --git a/hooks/pg_dir_utils.py b/hooks/pg_dir_utils.py index 6a4324d..7f7d988 100644 --- a/hooks/pg_dir_utils.py +++ b/hooks/pg_dir_utils.py @@ -412,10 +412,7 @@ def get_cidr_from_iface(interface): def director_cluster_ready(): dirs_count = len(pg_dir_context._pg_dir_ips()) log('DIR COUNT: %s' % dirs_count) - if dirs_count == 2: - return True - else: - return False + return True if dirs_count == 2 else False def restart_on_change(restart_map): diff --git a/unit_tests/test_pg_dir_context.py b/unit_tests/test_pg_dir_context.py index baac434..84a29b2 100644 --- a/unit_tests/test_pg_dir_context.py +++ b/unit_tests/test_pg_dir_context.py @@ -60,7 +60,7 @@ class PGDirContextTest(CharmTestCase): return "neutron.randomconfig" config = {'plumgrid-virtual-ip': "192.168.100.250", - 'opsvm-ip':'127.0.0.1'} + 'opsvm-ip': '127.0.0.1'} def mock_config(key=None): if key: