Skip to content

Commit fea6048

Browse files
Merge pull request #965 from allmightyspiff/issues904
Issues904 - issues with locationGroupId
2 parents 5988805 + 5925e61 commit fea6048

File tree

9 files changed

+428
-255
lines changed

9 files changed

+428
-255
lines changed

SoftLayer/CLI/hardware/list.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@
2020
column_helper.Column(
2121
'action',
2222
lambda server: formatting.active_txn(server),
23-
mask='''
24-
mask(SoftLayer_Hardware_Server)[activeTransaction[
25-
id,transactionStatus[name,friendlyName]
26-
]]'''),
23+
mask='activeTransaction[id, transactionStatus[name, friendlyName]]'),
2724
column_helper.Column('power_state', ('powerState', 'name')),
2825
column_helper.Column(
2926
'created_by',
@@ -52,30 +49,25 @@
5249
@click.option('--memory', '-m', help='Filter by memory in gigabytes')
5350
@click.option('--network', '-n', help='Filter by network port speed in Mbps')
5451
@helpers.multi_option('--tag', help='Filter by tags')
55-
@click.option('--sortby', help='Column to sort by',
56-
default='hostname',
57-
show_default=True)
52+
@click.option('--sortby', help='Column to sort by', default='hostname', show_default=True)
5853
@click.option('--columns',
5954
callback=column_helper.get_formatter(COLUMNS),
60-
help='Columns to display. [options: %s]'
61-
% ', '.join(column.name for column in COLUMNS),
55+
help='Columns to display. [options: %s]' % ', '.join(column.name for column in COLUMNS),
6256
default=','.join(DEFAULT_COLUMNS),
6357
show_default=True)
6458
@environment.pass_env
65-
def cli(env, sortby, cpu, domain, datacenter, hostname, memory, network, tag,
66-
columns):
59+
def cli(env, sortby, cpu, domain, datacenter, hostname, memory, network, tag, columns):
6760
"""List hardware servers."""
6861

6962
manager = SoftLayer.HardwareManager(env.client)
70-
7163
servers = manager.list_hardware(hostname=hostname,
7264
domain=domain,
7365
cpus=cpu,
7466
memory=memory,
7567
datacenter=datacenter,
7668
nic_speed=network,
7769
tags=tag,
78-
mask=columns.mask())
70+
mask="mask(SoftLayer_Hardware_Server)[%s]" % columns.mask())
7971

8072
table = formatting.Table(columns.columns)
8173
table.sortby = sortby

SoftLayer/fixtures/SoftLayer_Location_Datacenter.py

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
getObject = {'primaryRouter': {'datacenter': {'id': 1234}}}
1+
getObject = {
2+
'primaryRouter': {
3+
'datacenter': {'id': 1234, 'longName': 'TestDC'},
4+
'fullyQualifiedDomainName': 'fcr01.TestDC'
5+
},
6+
'id': 1234,
7+
'vlanNumber': 4444,
8+
'firewallInterfaces': None
9+
}

SoftLayer/fixtures/SoftLayer_Product_Package.py

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,90 @@
666666
]
667667
}
668668

669+
670+
SAAS_REST_PACKAGE = {
671+
'categories': [
672+
{'categoryCode': 'storage_as_a_service'}
673+
],
674+
'id': 759,
675+
'name': 'Storage As A Service (StaaS)',
676+
'items': [
677+
{
678+
'capacity': '0',
679+
'keyName': '',
680+
'prices': [
681+
{
682+
'id': 189433,
683+
'categories': [
684+
{'categoryCode': 'storage_as_a_service'}
685+
],
686+
'locationGroupId': None
687+
}
688+
]
689+
}, {
690+
'capacity': '20',
691+
'keyName': '',
692+
'prices': [
693+
{
694+
'capacityRestrictionMaximum': '200',
695+
'capacityRestrictionMinimum': '200',
696+
'capacityRestrictionType': 'STORAGE_TIER_LEVEL',
697+
'categories': [
698+
{'categoryCode': 'storage_snapshot_space'}
699+
],
700+
'id': 193853,
701+
'locationGroupId': None
702+
}
703+
]
704+
}, {
705+
'capacity': '0',
706+
'capacityMaximum': '1999',
707+
'capacityMinimum': '1000',
708+
'itemCategory': {'categoryCode': 'performance_storage_space'},
709+
'keyName': '1000_1999_GBS',
710+
'prices': [
711+
{
712+
'id': 190113,
713+
'categories': [
714+
{'categoryCode': 'performance_storage_space'}
715+
],
716+
'locationGroupId': None
717+
}
718+
]
719+
}, {
720+
'capacity': '0',
721+
'capacityMaximum': '20000',
722+
'capacityMinimum': '100',
723+
'keyName': '',
724+
'itemCategory': {'categoryCode': 'performance_storage_iops'},
725+
'prices': [
726+
{
727+
'capacityRestrictionMaximum': '1999',
728+
'capacityRestrictionMinimum': '1000',
729+
'capacityRestrictionType': 'STORAGE_SPACE',
730+
'categories': [
731+
{'categoryCode': 'performance_storage_iops'}
732+
],
733+
'id': 190173,
734+
'locationGroupId': None
735+
}
736+
]
737+
}, {
738+
'capacity': '0',
739+
'keyName': '',
740+
'prices': [
741+
{
742+
'categories': [
743+
{'categoryCode': 'storage_file'}
744+
],
745+
'id': 189453,
746+
'locationGroupId': None
747+
}
748+
]
749+
}
750+
]
751+
}
752+
669753
activePreset1 = {
670754
'description': 'Single Xeon 1270, 8GB Ram, 2x1TB SATA disks, Non-RAID',
671755
'id': 64,

SoftLayer/managers/ordering.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ def get_price_id_list(self, package_keyname, item_keynames):
354354
# can take that ID and create the proper price for us in the location
355355
# in which the order is made
356356
price_id = [p['id'] for p in matching_item['prices']
357-
if p['locationGroupId'] is None][0]
357+
if not p['locationGroupId']][0]
358358
prices.append(price_id)
359359

360360
return prices

0 commit comments

Comments
 (0)