Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions SoftLayer/CLI/virt/create_options.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Virtual server order options."""
# :license: MIT, see LICENSE for more details.
# pylint: disable=too-many-statements
import os
import os.path

Expand Down
2 changes: 0 additions & 2 deletions SoftLayer/CLI/vpn/ipsec/translation/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@

@click.command()
@click.argument('context_id', type=int)
# todo: Update to utilize custom IP address type
@click.option('-s',
'--static-ip',
required=True,
help='Static IP address value')
# todo: Update to utilize custom IP address type
@click.option('-r',
'--remote-ip',
required=True,
Expand Down
2 changes: 0 additions & 2 deletions SoftLayer/CLI/vpn/ipsec/translation/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@
required=True,
type=int,
help='Translation identifier to update')
# todo: Update to utilize custom IP address type
@click.option('-s',
'--static-ip',
default=None,
help='Static IP address value')
# todo: Update to utilize custom IP address type
@click.option('-r',
'--remote-ip',
default=None,
Expand Down
1 change: 0 additions & 1 deletion SoftLayer/CLI/vpn/ipsec/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
@click.option('--friendly-name',
default=None,
help='Friendly name value')
# todo: Update to utilize custom IP address type
@click.option('--remote-peer',
default=None,
help='Remote peer IP address value')
Expand Down
2 changes: 1 addition & 1 deletion SoftLayer/managers/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def cancel_hardware(self, hardware_id, reason='unneeded', comment='', immediate=
billing_id = hw_billing['billingItem']['id']

if immediate and not hw_billing['hourlyBillingFlag']:
LOGGER.warning("Immediate cancelation of montly servers is not guaranteed. " +
LOGGER.warning("Immediate cancelation of montly servers is not guaranteed."
"Please check the cancelation ticket for updates.")

result = self.client.call('Billing_Item', 'cancelItem',
Expand Down
4 changes: 0 additions & 4 deletions SoftLayer/managers/ipsec.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,6 @@ def update_translation(self, context_id, translation_id, static_ip=None,
translation.pop('customerIpAddressId', None)
if notes is not None:
translation['notes'] = notes
# todo: Update this signature to return the updated translation
# once internal and customer IP addresses can be fetched
# and set on the translation object, i.e. that which is
# currently being handled in get_translations
self.context.editAddressTranslation(translation, id=context_id)
return True

Expand Down
4 changes: 3 additions & 1 deletion SoftLayer/managers/ordering.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,10 @@ def get_item_price_id(core, prices):
if not price['locationGroupId']:
capacity_min = int(price.get('capacityRestrictionMinimum', -1))
capacity_max = int(price.get('capacityRestrictionMaximum', -1))
if capacity_min == -1:
# return first match if no restirction, or no core to check
if capacity_min == -1 or core is None:
price_id = price['id']
# this check is mostly to work nicely with preset configs
elif capacity_min <= int(core) <= capacity_max:
price_id = price['id']
return price_id
Expand Down
28 changes: 28 additions & 0 deletions tests/managers/ordering_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,3 +569,31 @@ def test_get_item_price_id_with_capacity_restriction(self):
price_id = self.ordering.get_item_price_id("8", price1)

self.assertEqual(1234, price_id)

def test_issues1067(self):
# https://github.com/softlayer/softlayer-python/issues/1067
item_mock = self.set_mock('SoftLayer_Product_Package', 'getItems')
item_mock_return = [
{
'id': 10453,
'itemCategory': {'categoryCode': 'server'},
'keyName': 'INTEL_INTEL_XEON_4110_2_10',
'prices': [
{
'capacityRestrictionMaximum': '2',
'capacityRestrictionMinimum': '2',
'capacityRestrictionType': 'PROCESSOR',
'categories': [{'categoryCode': 'os'}],
'id': 201161,
'locationGroupId': None,
'recurringFee': '250',
'setupFee': '0'
}
]
}
]
item_mock.return_value = item_mock_return
item_keynames = ['INTEL_INTEL_XEON_4110_2_10']
package = 'DUAL_INTEL_XEON_PROCESSOR_SCALABLE_FAMILY_4_DRIVES'
result = self.ordering.get_price_id_list(package, item_keynames, None)
self.assertIn(201161, result)
4 changes: 4 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ commands =
-d locally-disabled \
-d no-else-return \
-d len-as-condition \
-d useless-object-inheritance \
-d consider-using-in \
-d consider-using-dict-comprehension \
-d useless-import-alias \
--max-args=25 \
--max-branches=20 \
--max-statements=65 \
Expand Down