@@ -378,7 +378,7 @@ def _get_package(self):
378378 if len (packages ) != 1 :
379379 raise SoftLayer .SoftLayerError ("Ordering package not found" )
380380
381- return packages . pop ()
381+ return packages [ 0 ]
382382
383383 def _generate_create_dict (self ,
384384 size = None ,
@@ -412,7 +412,6 @@ def _generate_create_dict(self,
412412 prices .append (_get_bandwidth_price_id (package ['items' ],
413413 hourly = hourly ,
414414 no_public = no_public ))
415-
416415 prices .append (_get_port_speed_price_id (package ['items' ],
417416 port_speed ,
418417 no_public ))
@@ -566,14 +565,12 @@ def _get_bandwidth_price_id(items, hourly=True, no_public=False):
566565 # Prefer pay-for-use data transfer with hourly
567566 for item in items :
568567
569- if not utils .lookup (item ,
570- 'itemCategory' ,
571- 'categoryCode' ) == 'bandwidth' :
572- continue
573-
574568 capacity = float (item .get ('capacity' , 0 ))
575569 # Hourly and private only do pay-as-you-go bandwidth
576- if any ([(hourly or no_public ) and capacity != 0.0 ,
570+ if any ([not utils .lookup (item ,
571+ 'itemCategory' ,
572+ 'categoryCode' ) == 'bandwidth' ,
573+ (hourly or no_public ) and capacity != 0.0 ,
577574 not (hourly or no_public ) and capacity == 0.0 ]):
578575 continue
579576
@@ -589,8 +586,8 @@ def _get_bandwidth_price_id(items, hourly=True, no_public=False):
589586
590587def _get_os_price_id (items , os ):
591588 """Returns the price id matching."""
592- for item in items :
593589
590+ for item in items :
594591 if not utils .lookup (item , 'itemCategory' , 'categoryCode' ) == 'os' :
595592 continue
596593
@@ -610,19 +607,12 @@ def _get_port_speed_price_id(items, port_speed, no_public):
610607 """Choose a valid price id for port speed."""
611608
612609 for item in items :
613-
614- if not utils .lookup (item ,
615- 'itemCategory' ,
616- 'categoryCode' ) == 'port_speed' :
617- continue
618-
619- for item in items :
620-
621610 if not utils .lookup (item ,
622611 'itemCategory' ,
623612 'categoryCode' ) == 'port_speed' :
624613 continue
625614
615+ # Check for correct capacity and if the item matches private only
626616 if any ([int (utils .lookup (item , 'capacity' )) != port_speed ,
627617 _is_private_port_speed_item (item ) != no_public ]):
628618 continue
0 commit comments