Repository: infobloxopen/infoblox-client

Issue:
Need to return Zone if it was created
Currentry None is returned from create_dns_zone:
https://github.com/infobloxopen/infoblox-client/blob/master/infoblox_client/object_manager.py#L249

Need to return created DnsZone object.

Discussion:

Patch:
diff --git a/infoblox_client/object_manager.py b/infoblox_client/object_manager.py
index d61987c..3a19fdd 100644
--- a/infoblox_client/object_manager.py
+++ b/infoblox_client/object_manager.py
@@ -246,15 +246,15 @@ class InfobloxObjectManager(object):
                         zone_format=None, ns_group=None, prefix=None,
                         extattrs=None):
         try:
-            obj.DNSZone.create(self.connector,
-                               fqdn=dns_zone,
-                               view=dns_view,
-                               extattrs=extattrs,
-                               zone_format=zone_format,
-                               ns_group=ns_group,
-                               prefix=prefix,
-                               grid_primary=grid_primary,
-                               grid_secondaries=grid_secondaries)
+            return obj.DNSZone.create(self.connector,
+                                      fqdn=dns_zone,
+                                      view=dns_view,
+                                      extattrs=extattrs,
+                                      zone_format=zone_format,
+                                      ns_group=ns_group,
+                                      prefix=prefix,
+                                      grid_primary=grid_primary,
+                                      grid_secondaries=grid_secondaries)
         except ib_ex.InfobloxCannotCreateObject:
             LOG.warning('Unable to create DNS zone %(dns_zone_fqdn)s '
                         'for %(dns_view)s',


Test patch:
diff --git a/infoblox_client/tests/unit/test_object_manager.py b/infoblox_client/tests/unit/test_object_manager.py
index b24897d..73d43ed 100644
--- a/infoblox_client/tests/unit/test_object_manager.py
+++ b/infoblox_client/tests/unit/test_object_manager.py
@@ -591,8 +591,9 @@ class ObjectManipulatorTestCase(base.TestCase):
 
         ibom = om.InfobloxObjectManager(connector)
 
-        ibom.create_dns_zone(dns_view_name, fqdn, primary_dns_members,
-                             secondary_dns_members, zone_format=zone_format)
+        zone = ibom.create_dns_zone(dns_view_name, fqdn, primary_dns_members,
+                                    secondary_dns_members,
+                                    zone_format=zone_format)
 
         matcher = PayloadMatcher({'view': dns_view_name,
                                   'fqdn': fqdn})
@@ -610,6 +611,7 @@ class ObjectManipulatorTestCase(base.TestCase):
                    }
         connector.create_object.assert_called_once_with('zone_auth', payload,
                                                         mock.ANY)
+        self.assertIsInstance(zone, objects.DNSZone)
 
     def test_create_dns_zone_creates_zone_auth_object(self):
         dns_view_name = 'dns-view-name'