|
19 | 19 | } |
20 | 20 |
|
21 | 21 |
|
22 | | -def populate_host_templates(host_templates, |
23 | | - hardware_ids=None, |
| 22 | +def populate_host_templates(hardware_ids=None, |
24 | 23 | virtual_guest_ids=None, |
25 | 24 | ip_address_ids=None, |
26 | 25 | subnet_ids=None): |
27 | | - """Populate the given host_templates array with the IDs provided |
| 26 | + """Returns a populated array with the IDs provided |
28 | 27 |
|
29 | | - :param host_templates: The array to which host templates will be added |
30 | 28 | :param hardware_ids: A List of SoftLayer_Hardware ids |
31 | 29 | :param virtual_guest_ids: A List of SoftLayer_Virtual_Guest ids |
32 | 30 | :param ip_address_ids: A List of SoftLayer_Network_Subnet_IpAddress ids |
33 | 31 | :param subnet_ids: A List of SoftLayer_Network_Subnet ids |
| 32 | + :return: array of objects formatted for allowAccessFromHostList |
34 | 33 | """ |
| 34 | + host_templates = [] |
35 | 35 | if hardware_ids is not None: |
36 | 36 | for hardware_id in hardware_ids: |
37 | 37 | host_templates.append({ |
@@ -59,6 +59,7 @@ def populate_host_templates(host_templates, |
59 | 59 | 'objectType': 'SoftLayer_Network_Subnet', |
60 | 60 | 'id': subnet_id |
61 | 61 | }) |
| 62 | + return host_templates |
62 | 63 |
|
63 | 64 |
|
64 | 65 | def get_package(manager, category_code): |
@@ -984,6 +985,13 @@ def prepare_modify_order_object(manager, volume, new_iops, new_tier, new_size): |
984 | 985 |
|
985 | 986 | return modify_order |
986 | 987 |
|
| 988 | +def block_or_file(storage_type_keyname): |
| 989 | + """returns either 'block' or 'file' |
| 990 | +
|
| 991 | + :param storage_type_keyname: the Network_Storage['storageType']['keyName'] |
| 992 | + :returns: 'block' or 'file' |
| 993 | + """ |
| 994 | + return 'block' if 'BLOCK_STORAGE' in storage_type_keyname else 'file' |
987 | 995 |
|
988 | 996 | def _has_category(categories, category_code): |
989 | 997 | return any( |
@@ -1014,3 +1022,4 @@ def _find_price_id(prices, category, restriction_type=None, restriction_value=No |
1014 | 1022 | continue |
1015 | 1023 |
|
1016 | 1024 | return {'id': price['id']} |
| 1025 | + |
0 commit comments