Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the zone parameter to create_subnet #101

Merged
merged 11 commits into from Aug 2, 2018
4 changes: 2 additions & 2 deletions cloudbridge/cloud/interfaces/services.py
Expand Up @@ -740,7 +740,7 @@ def find(self, name, limit=None, marker=None):
pass

@abstractmethod
def create(self, name, network_id, cidr_block, zone=None):
def create(self, name, network_id, cidr_block, zone=zone):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should just be a required parameter, with no default value, as follows:

def create(self, name, network_id, cidr_block, zone):

"""
Create a new subnet within the supplied network.

Expand All @@ -756,7 +756,7 @@ def create(self, name, network_id, cidr_block, zone=None):
subnet.

:type zone: ``str``
:param zone: An optional placement zone for the subnet. Some providers
:param zone: A placement zone for the subnet. Some providers
may not support this, in which case the value is ignored.

:rtype: ``object`` of :class:`.Subnet`
Expand Down
3 changes: 2 additions & 1 deletion test/test_network_service.py
Expand Up @@ -76,7 +76,8 @@ def test_crud_subnet(self):

def create_subnet(name):
return self.provider.networking.subnets.create(
network=net, cidr_block="10.0.0.1/24", name=name)
network=net, cidr_block="10.0.0.1/24", name=name,
zone=helpers.get_provider_test_data(self.provider, 'placement'))

def cleanup_subnet(subnet):
self.provider.networking.subnets.delete(subnet=subnet)
Expand Down