Skip to content

Commit 54e441d

Browse files
author
Nathan Beittenmiller
committed
Changes based on peer review notes
1 parent c04bec7 commit 54e441d

File tree

3 files changed

+37
-37
lines changed

3 files changed

+37
-37
lines changed

SoftLayer/CLI/modules/bmetal.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -429,18 +429,18 @@ def _get_cpu_and_memory_price_ids(cls, bmi_options, cpu_value,
429429

430430
@classmethod
431431
def _get_default_value(cls, bmi_options, option):
432-
if bmi_options['categories'].get(option):
433-
for item in bmi_options['categories'][option]['items']:
434-
if not any([
435-
float(item['prices'][0].get('setupFee', 0)),
436-
float(item['prices'][0].get('recurringFee', 0)),
437-
float(item['prices'][0].get('hourlyRecurringFee', 0)),
438-
float(item['prices'][0].get('oneTimeFee', 0)),
439-
float(item['prices'][0].get('laborFee', 0)),
440-
]):
441-
return item['price_id']
442-
443-
return None
432+
if option not in bmi_options['categories']:
433+
return
434+
435+
for item in bmi_options['categories'][option]['items']:
436+
if not any([
437+
float(item['prices'][0].get('setupFee', 0)),
438+
float(item['prices'][0].get('recurringFee', 0)),
439+
float(item['prices'][0].get('hourlyRecurringFee', 0)),
440+
float(item['prices'][0].get('oneTimeFee', 0)),
441+
float(item['prices'][0].get('laborFee', 0)),
442+
]):
443+
return item['price_id']
444444

445445
@classmethod
446446
def _get_price_id_from_options(cls, bmi_options, option, value):

SoftLayer/CLI/modules/hardware.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -717,18 +717,18 @@ def execute(cls, client, args):
717717

718718
@classmethod
719719
def _get_default_value(cls, ds_options, option):
720-
if ds_options['categories'].get(option):
721-
for item in ds_options['categories'][option]['items']:
722-
if not any([
723-
float(item['prices'][0].get('setupFee', 0)),
724-
float(item['prices'][0].get('recurringFee', 0)),
725-
float(item['prices'][0].get('hourlyRecurringFee', 0)),
726-
float(item['prices'][0].get('oneTimeFee', 0)),
727-
float(item['prices'][0].get('laborFee', 0)),
728-
]):
729-
return item['price_id']
730-
731-
return None
720+
if option not in ds_options['categories']:
721+
return
722+
723+
for item in ds_options['categories'][option]['items']:
724+
if not any([
725+
float(item['prices'][0].get('setupFee', 0)),
726+
float(item['prices'][0].get('recurringFee', 0)),
727+
float(item['prices'][0].get('hourlyRecurringFee', 0)),
728+
float(item['prices'][0].get('oneTimeFee', 0)),
729+
float(item['prices'][0].get('laborFee', 0)),
730+
]):
731+
return item['price_id']
732732

733733
@classmethod
734734
def _get_price_id_from_options(cls, ds_options, option, value):

SoftLayer/managers/hardware.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -347,18 +347,18 @@ def _get_bare_metal_package_id(self):
347347
return hw_id
348348

349349
def _get_default_value(self, package_options, category):
350-
if package_options['categories'].get(category):
351-
for item in package_options['categories'][category]['items']:
352-
if not any([
353-
float(item['prices'][0].get('setupFee', 0)),
354-
float(item['prices'][0].get('recurringFee', 0)),
355-
float(item['prices'][0].get('hourlyRecurringFee', 0)),
356-
float(item['prices'][0].get('oneTimeFee', 0)),
357-
float(item['prices'][0].get('laborFee', 0)),
358-
]):
359-
return item['price_id']
360-
361-
return None
350+
if category not in package_options['categories']:
351+
return
352+
353+
for item in package_options['categories'][category]['items']:
354+
if not any([
355+
float(item['prices'][0].get('setupFee', 0)),
356+
float(item['prices'][0].get('recurringFee', 0)),
357+
float(item['prices'][0].get('hourlyRecurringFee', 0)),
358+
float(item['prices'][0].get('oneTimeFee', 0)),
359+
float(item['prices'][0].get('laborFee', 0)),
360+
]):
361+
return item['price_id']
362362

363363
def _get_ids_from_hostname(self, hostname):
364364
results = self.list_hardware(hostname=hostname, mask="id")
@@ -432,7 +432,7 @@ def _parse_package_data(self, id):
432432
'price_id': item['prices'][0]['id'],
433433
'recurring_fee': float(item['prices'][0].get('recurringFee',
434434
0)),
435-
'capacity': float(item.get('capacity') or 0),
435+
'capacity': float(item.get('capacity', 0)),
436436
})
437437

438438
return results

0 commit comments

Comments
 (0)