Skip to content

Commit

Permalink
Merge pull request #965 from allmightyspiff/issues904
Browse files Browse the repository at this point in the history
Issues904 - issues with locationGroupId
  • Loading branch information
allmightyspiff authored Apr 16, 2018
2 parents 5988805 + 5925e61 commit fea6048
Show file tree
Hide file tree
Showing 9 changed files with 428 additions and 255 deletions.
18 changes: 5 additions & 13 deletions SoftLayer/CLI/hardware/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@
column_helper.Column(
'action',
lambda server: formatting.active_txn(server),
mask='''
mask(SoftLayer_Hardware_Server)[activeTransaction[
id,transactionStatus[name,friendlyName]
]]'''),
mask='activeTransaction[id, transactionStatus[name, friendlyName]]'),
column_helper.Column('power_state', ('powerState', 'name')),
column_helper.Column(
'created_by',
Expand Down Expand Up @@ -52,30 +49,25 @@
@click.option('--memory', '-m', help='Filter by memory in gigabytes')
@click.option('--network', '-n', help='Filter by network port speed in Mbps')
@helpers.multi_option('--tag', help='Filter by tags')
@click.option('--sortby', help='Column to sort by',
default='hostname',
show_default=True)
@click.option('--sortby', help='Column to sort by', default='hostname', show_default=True)
@click.option('--columns',
callback=column_helper.get_formatter(COLUMNS),
help='Columns to display. [options: %s]'
% ', '.join(column.name for column in COLUMNS),
help='Columns to display. [options: %s]' % ', '.join(column.name for column in COLUMNS),
default=','.join(DEFAULT_COLUMNS),
show_default=True)
@environment.pass_env
def cli(env, sortby, cpu, domain, datacenter, hostname, memory, network, tag,
columns):
def cli(env, sortby, cpu, domain, datacenter, hostname, memory, network, tag, columns):
"""List hardware servers."""

manager = SoftLayer.HardwareManager(env.client)

servers = manager.list_hardware(hostname=hostname,
domain=domain,
cpus=cpu,
memory=memory,
datacenter=datacenter,
nic_speed=network,
tags=tag,
mask=columns.mask())
mask="mask(SoftLayer_Hardware_Server)[%s]" % columns.mask())

table = formatting.Table(columns.columns)
table.sortby = sortby
Expand Down
4 changes: 0 additions & 4 deletions SoftLayer/fixtures/SoftLayer_Location_Datacenter.py

This file was deleted.

10 changes: 9 additions & 1 deletion SoftLayer/fixtures/SoftLayer_Network_Vlan.py
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
getObject = {'primaryRouter': {'datacenter': {'id': 1234}}}
getObject = {
'primaryRouter': {
'datacenter': {'id': 1234, 'longName': 'TestDC'},
'fullyQualifiedDomainName': 'fcr01.TestDC'
},
'id': 1234,
'vlanNumber': 4444,
'firewallInterfaces': None
}
84 changes: 84 additions & 0 deletions SoftLayer/fixtures/SoftLayer_Product_Package.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,90 @@
]
}


SAAS_REST_PACKAGE = {
'categories': [
{'categoryCode': 'storage_as_a_service'}
],
'id': 759,
'name': 'Storage As A Service (StaaS)',
'items': [
{
'capacity': '0',
'keyName': '',
'prices': [
{
'id': 189433,
'categories': [
{'categoryCode': 'storage_as_a_service'}
],
'locationGroupId': None
}
]
}, {
'capacity': '20',
'keyName': '',
'prices': [
{
'capacityRestrictionMaximum': '200',
'capacityRestrictionMinimum': '200',
'capacityRestrictionType': 'STORAGE_TIER_LEVEL',
'categories': [
{'categoryCode': 'storage_snapshot_space'}
],
'id': 193853,
'locationGroupId': None
}
]
}, {
'capacity': '0',
'capacityMaximum': '1999',
'capacityMinimum': '1000',
'itemCategory': {'categoryCode': 'performance_storage_space'},
'keyName': '1000_1999_GBS',
'prices': [
{
'id': 190113,
'categories': [
{'categoryCode': 'performance_storage_space'}
],
'locationGroupId': None
}
]
}, {
'capacity': '0',
'capacityMaximum': '20000',
'capacityMinimum': '100',
'keyName': '',
'itemCategory': {'categoryCode': 'performance_storage_iops'},
'prices': [
{
'capacityRestrictionMaximum': '1999',
'capacityRestrictionMinimum': '1000',
'capacityRestrictionType': 'STORAGE_SPACE',
'categories': [
{'categoryCode': 'performance_storage_iops'}
],
'id': 190173,
'locationGroupId': None
}
]
}, {
'capacity': '0',
'keyName': '',
'prices': [
{
'categories': [
{'categoryCode': 'storage_file'}
],
'id': 189453,
'locationGroupId': None
}
]
}
]
}

activePreset1 = {
'description': 'Single Xeon 1270, 8GB Ram, 2x1TB SATA disks, Non-RAID',
'id': 64,
Expand Down
2 changes: 1 addition & 1 deletion SoftLayer/managers/ordering.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ def get_price_id_list(self, package_keyname, item_keynames):
# can take that ID and create the proper price for us in the location
# in which the order is made
price_id = [p['id'] for p in matching_item['prices']
if p['locationGroupId'] is None][0]
if not p['locationGroupId']][0]
prices.append(price_id)

return prices
Expand Down
Loading

0 comments on commit fea6048

Please sign in to comment.