diff --git a/src/lib/charm/openstack/cinder_netapp.py b/src/lib/charm/openstack/cinder_netapp.py index 464e87a..8016c65 100644 --- a/src/lib/charm/openstack/cinder_netapp.py +++ b/src/lib/charm/openstack/cinder_netapp.py @@ -51,10 +51,11 @@ class CinderNetAppCharm( ('netapp_password', cget('netapp-password')), ('volume_driver', volumedriver), ('volume_backend_name', service), - ('netapp_pool_name_search_pattern', cget( - 'netapp-pool-name-search-pattern')) ] - + pool_name_search_pattern = cget('netapp-pool-name-search-pattern') + if pool_name_search_pattern: + driver_options_common += [ + ('netapp_pool_name_search_pattern', pool_name_search_pattern)] if cget('netapp-server-port') == 443: driver_transport = [ ('netapp_transport_type', "https")] diff --git a/unit_tests/test_lib_charm_openstack_cinder_netapp.py b/unit_tests/test_lib_charm_openstack_cinder_netapp.py index ab01d20..f93f4f7 100644 --- a/unit_tests/test_lib_charm_openstack_cinder_netapp.py +++ b/unit_tests/test_lib_charm_openstack_cinder_netapp.py @@ -79,6 +79,16 @@ class TestCinderNetAppCharm(test_utils.PatchHelper): self.assertIn(('nfs_shares_config', econfig['netapp-nfs-shares-config']), config) + def test_cinder_unset_var(self): + econfig = {'netapp-storage-family': 'eseries', + 'netapp-controller-ips': '10.0.0.1', + 'netapp-array-password': 'abc123', + 'use-multipath': True} + charm = self._patch_config_and_charm(econfig) + config = charm.cinder_configuration() + keys = [c[0] for c in config] + self.assertNotIn('netapp_pool_name_search_pattern', keys) + def test_cinder_iscsi_options(self): econfig = {'netapp-pool-name-search-pattern': 'foo.*bar', 'netapp-lun-space-reservation': True,