Commit 5e5cd6a8 authored by Giorgos Korfiatis's avatar Giorgos Korfiatis

Merge pull request #105 from saxtouri/hotfix-0.13.2

Hotfix 0.13.2
parents b9e32039 c48a8897
......@@ -14,6 +14,7 @@ Bug Fixes
* Fix delimiter handling when uploading/downloading in windows systems
* Introduce a new command "kamaki scripts verifyfs" to verify and
repair affected containers
* Create subnets without gateway IPs
v0.13.1
=======
......
......@@ -367,6 +367,7 @@ class subnet_create(_NetworkInit, OptionalOutput):
' e.g., --alloc-pool=123.45.67.1,123.45.67.8',
'--alloc-pool'),
gateway=ValueArgument('Gateway IP', '--gateway'),
no_gateway=FlagArgument('Do not assign a gateway IP', '--no-gateway'),
subnet_id=ValueArgument('The id for the subnet', '--id'),
ipv6=FlagArgument('If set, IP version is set to 6, else 4', '--ipv6'),
enable_dhcp=FlagArgument('Enable dhcp (default: off)', '--with-dhcp'),
......@@ -378,10 +379,11 @@ class subnet_create(_NetworkInit, OptionalOutput):
@errors.Generic.all
@errors.Cyclades.connection
def _run(self):
gateway = '' if self['no_gateway'] else self['gateway']
try:
net = self.client.create_subnet(
self['network_id'], self['cidr'],
self['name'], self['allocation_pools'], self['gateway'],
self['name'], self['allocation_pools'], gateway,
self['subnet_id'], self['ipv6'], self['enable_dhcp'])
except ClientError as ce:
if ce.status in (404, 400):
......@@ -391,6 +393,11 @@ class subnet_create(_NetworkInit, OptionalOutput):
def main(self):
super(self.__class__, self)._run()
if self['gateway'] and self['no_gateway']:
raise CLIInvalidArgument('Conflicting arguments', details=[
'Arguments %s and %s cannot be used together' % (
self.arguments['gateway'].lvalue,
self.arguments['no_gateway'].lvalue)])
self._run()
......
......@@ -123,8 +123,9 @@ class NetworkClient(NetworkRestClient, Waiter):
:param name: (str) The subnet name
:param allocation_pools: (list of dicts) start/end addresses of
allocation pools: [{'start': ..., 'end': ...}, ...]
:param gateway_ip: (str)
:param subnet_id: (str)
:param gateway_ip: (str) Special cases:
None: server applies the default policy
empty iterable: no gateway IP on this subnet
:param ipv6: (bool) ip_version == 6 if true else 4 (default)
:param enable_dhcp: (bool)
"""
......@@ -134,8 +135,8 @@ class NetworkClient(NetworkRestClient, Waiter):
subnet['name'] = name
if allocation_pools:
subnet['allocation_pools'] = allocation_pools
if gateway_ip:
subnet['gateway_ip'] = gateway_ip
if gateway_ip is not None:
subnet['gateway_ip'] = gateway_ip or None
if subnet_id:
subnet['id'] = subnet_id
if enable_dhcp not in (None, ):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment