Skip to content

Commit 9a0f48a

Browse files
author
Fernando Ojeda
committed
Fix tox analysis.
1 parent b66b563 commit 9a0f48a

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

SoftLayer/managers/vs.py

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -533,20 +533,7 @@ def _generate_create_dict(
533533
if datacenter:
534534
data["datacenter"] = {"name": datacenter}
535535

536-
if kwargs.get('private_router') or kwargs.get('public_router'):
537-
if private_vlan or public_vlan or private_subnet or public_subnet:
538-
raise exceptions.SoftLayerError("You have to select network vlan or network vlan with a subnet or "
539-
"only router, not all options")
540-
network_components = self._create_network_components(public_vlan, private_vlan,
541-
private_subnet, public_subnet,
542-
kwargs.get('private_router'),
543-
kwargs.get('public_router'))
544-
data.update(network_components)
545-
546-
if private_vlan or public_vlan or private_subnet or public_subnet:
547-
network_components = self._create_network_components(public_vlan, private_vlan,
548-
private_subnet, public_subnet)
549-
data.update(network_components)
536+
self.get_network_components(data, kwargs, private_subnet, private_vlan, public_subnet, public_vlan)
550537

551538
if public_security_groups:
552539
secgroups = [{'securityGroup': {'id': int(sg)}}
@@ -589,6 +576,21 @@ def _generate_create_dict(
589576

590577
return data
591578

579+
def get_network_components(self, data, kwargs, private_subnet, private_vlan, public_subnet, public_vlan):
580+
if kwargs.get('private_router') or kwargs.get('public_router'):
581+
if private_vlan or public_vlan or private_subnet or public_subnet:
582+
raise exceptions.SoftLayerError("You have to select network vlan or network vlan with a subnet or "
583+
"only router, not all options")
584+
network_components = self._create_network_components(public_vlan, private_vlan,
585+
private_subnet, public_subnet,
586+
kwargs.get('private_router'),
587+
kwargs.get('public_router'))
588+
data.update(network_components)
589+
if private_vlan or public_vlan or private_subnet or public_subnet:
590+
network_components = self._create_network_components(public_vlan, private_vlan,
591+
private_subnet, public_subnet)
592+
data.update(network_components)
593+
592594
def _create_network_components(
593595
self, public_vlan=None, private_vlan=None,
594596
private_subnet=None, public_subnet=None,
@@ -724,9 +726,6 @@ def verify_create_instance(self, **kwargs):
724726
kwargs.get('public_subnet', None))
725727
vsi.update(network_components)
726728

727-
print("template")
728-
print(template)
729-
730729
return template
731730

732731
def create_instance(self, **kwargs):
@@ -1155,7 +1154,6 @@ def order_guest(self, guest_object, test=False):
11551154
if guest_object.get('placement_id'):
11561155
template['virtualGuests'][0]['placementGroupId'] = guest_object.get('placement_id')
11571156

1158-
print(template)
11591157
if test:
11601158
result = self.client.call('Product_Order', 'verifyOrder', template)
11611159
else:

0 commit comments

Comments
 (0)