|
1 | 1 | """Virtual server order options.""" |
2 | 2 | # :license: MIT, see LICENSE for more details. |
3 | 3 | # pylint: disable=too-many-statements |
4 | | -import os |
5 | | -import os.path |
6 | | - |
7 | 4 | import click |
8 | 5 |
|
9 | 6 | import SoftLayer |
@@ -128,23 +125,21 @@ def _get_memory_table(create_options): |
128 | 125 |
|
129 | 126 |
|
130 | 127 | def _get_os_table(create_options): |
131 | | - os_table = formatting.Table(['os', 'value'], title='Operating Systems') |
132 | | - os_table.sortby = 'os' |
| 128 | + os_table = formatting.Table(['KeyName', 'Description'], title='Operating Systems') |
| 129 | + os_table.sortby = 'KeyName' |
133 | 130 | os_table.align = 'l' |
134 | | - op_sys = [o['template']['operatingSystemReferenceCode'] for o in |
135 | | - create_options['operatingSystems']] |
136 | | - |
137 | | - op_sys = sorted(op_sys) |
138 | | - os_summary = set() |
| 131 | + op_sys = [] |
| 132 | + for operating_system in create_options['operatingSystems']: |
| 133 | + os_option = { |
| 134 | + 'referenceCode': operating_system['template']['operatingSystemReferenceCode'], |
| 135 | + 'description': operating_system['itemPrice']['item']['description'] |
| 136 | + } |
| 137 | + op_sys.append(os_option) |
139 | 138 |
|
140 | 139 | for operating_system in op_sys: |
141 | | - os_summary.add(operating_system[0:operating_system.find('_')]) |
142 | | - |
143 | | - for summary in sorted(os_summary): |
144 | 140 | os_table.add_row([ |
145 | | - summary, |
146 | | - os.linesep.join(sorted([x for x in op_sys |
147 | | - if x[0:len(summary)] == summary])) |
| 141 | + operating_system['referenceCode'], |
| 142 | + operating_system['description'] |
148 | 143 | ]) |
149 | 144 | return os_table |
150 | 145 |
|
|
0 commit comments