Skip to content

Commit f160be6

Browse files
Merge pull request #1356 from allmightyspiff/issues1038
Allow orders without a location if needed
2 parents 94076a4 + 481c9e5 commit f160be6

File tree

8 files changed

+41
-50
lines changed

8 files changed

+41
-50
lines changed

SoftLayer/CLI/order/place.py

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -42,40 +42,26 @@ def cli(env, package_keyname, location, preset, verify, billing, complex_type,
4242
quantity, extras, order_items):
4343
"""Place or verify an order.
4444
45-
This CLI command is used for placing/verifying an order of the specified package in
46-
the given location (denoted by a datacenter's long name). Orders made via the CLI
47-
can then be converted to be made programmatically by calling
48-
SoftLayer.OrderingManager.place_order() with the same keynames.
49-
50-
Packages for ordering can be retrieved from `slcli order package-list`
51-
Presets for ordering can be retrieved from `slcli order preset-list` (not all packages
52-
have presets)
53-
54-
Items can be retrieved from `slcli order item-list`. In order to find required
55-
items for the order, use `slcli order category-list`, and then provide the
56-
--category option for each category code in `slcli order item-list`.
57-
45+
\b
46+
1. Find the package keyName from `slcli order package-list`
47+
2. Find the location from `slcli order package-locations PUBLIC_CLOUD_SERVER`
48+
If the package does not require a location, use 'NONE' instead.
49+
3. Find the needed items `slcli order item-list PUBLIC_CLOUD_SERVER`
50+
Some packages, like PUBLIC_CLOUD_SERVER need presets, `slcli order preset-list PUBLIC_CLOUD_SERVER`
51+
4. Find the complex type from https://sldn.softlayer.com/reference
52+
5. Use that complex type to fill out any --extras
5853
5954
Example::
6055
61-
# Order an hourly VSI with 4 CPU, 16 GB RAM, 100 GB SAN disk,
62-
# Ubuntu 16.04, and 1 Gbps public & private uplink in dal13
63-
slcli order place --billing hourly CLOUD_SERVER DALLAS13 \\
64-
GUEST_CORES_4 \\
65-
RAM_16_GB \\
66-
REBOOT_REMOTE_CONSOLE \\
67-
1_GBPS_PUBLIC_PRIVATE_NETWORK_UPLINKS \\
68-
BANDWIDTH_0_GB_2 \\
69-
1_IP_ADDRESS \\
70-
GUEST_DISK_100_GB_SAN \\
71-
OS_UBUNTU_16_04_LTS_XENIAL_XERUS_MINIMAL_64_BIT_FOR_VSI \\
72-
MONITORING_HOST_PING \\
73-
NOTIFICATION_EMAIL_AND_TICKET \\
74-
AUTOMATED_NOTIFICATION \\
75-
UNLIMITED_SSL_VPN_USERS_1_PPTP_VPN_USER_PER_ACCOUNT \\
76-
NESSUS_VULNERABILITY_ASSESSMENT_REPORTING \\
77-
--extras '{"virtualGuests": [{"hostname": "test", "domain": "softlayer.com"}]}' \\
78-
--complex-type SoftLayer_Container_Product_Order_Virtual_Guest
56+
slcli order place --verify --preset B1_2X8X100 --billing hourly
57+
--complex-type SoftLayer_Container_Product_Order_Virtual_Guest
58+
--extras '{"virtualGuests": [{"hostname": "test", "domain": "ibm.com"}]}'
59+
PUBLIC_CLOUD_SERVER DALLAS13
60+
BANDWIDTH_0_GB_2 MONITORING_HOST_PING NOTIFICATION_EMAIL_AND_TICKET
61+
OS_DEBIAN_9_X_STRETCH_LAMP_64_BIT 1_IP_ADDRESS 1_IPV6_ADDRESS
62+
1_GBPS_PUBLIC_PRIVATE_NETWORK_UPLINKS REBOOT_REMOTE_CONSOLE
63+
AUTOMATED_NOTIFICATION UNLIMITED_SSL_VPN_USERS_1_PPTP_VPN_USER_PER_ACCOUNT
64+
NESSUS_VULNERABILITY_ASSESSMENT_REPORTING
7965
8066
"""
8167
manager = ordering.OrderingManager(env.client)

SoftLayer/CLI/ticket/create.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,18 @@
2525
def cli(env, title, subject_id, body, hardware_identifier, virtual_identifier, priority):
2626
"""Create a Infrastructure support ticket.
2727
28-
Example::
29-
30-
Will create the ticket with `Some text`.
28+
Will create the ticket with `Some text`.::
3129
3230
slcli ticket create --body="Some text" --subject-id 1522 --hardware 12345 --title "My New Ticket"
3331
34-
Will create the ticket with text from STDIN
32+
Will create the ticket with text from STDIN::
3533
3634
cat sometfile.txt | slcli ticket create --subject-id 1003 --virtual 111111 --title "Reboot Me"
3735
38-
Will open the default text editor, and once closed, use that text to create the ticket
36+
Will open the default text editor, and once closed, use that text to create the ticket::
3937
4038
slcli ticket create --subject-id 1482 --title "Vyatta Questions..."
39+
4140
"""
4241
ticket_mgr = SoftLayer.TicketManager(env.client)
4342
if body is None:

SoftLayer/CLI/ticket/update.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,15 @@
1616
def cli(env, identifier, body):
1717
"""Adds an update to an existing ticket.
1818
19-
Example::
20-
21-
Will update the ticket with `Some text`.
19+
Will update the ticket with `Some text`.::
2220
2321
slcli ticket update 123456 --body="Some text"
2422
25-
Will update the ticket with text from STDIN
23+
Will update the ticket with text from STDIN::
2624
2725
cat sometfile.txt | slcli ticket update 123456
2826
29-
Will open the default text editor, and once closed, use that text to update the ticket
27+
Will open the default text editor, and once closed, use that text to update the ticket::
3028
3129
slcli ticket update 123456
3230
"""

SoftLayer/managers/ordering.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,9 @@ def get_location_id(self, location):
634634

635635
if isinstance(location, int):
636636
return location
637+
# Some orders dont require a location, just use 0
638+
if location.upper() == "NONE":
639+
return 0
637640
mask = "mask[id,name,regions[keyname]]"
638641
if match(r'[a-zA-Z]{3}[0-9]{2}', location) is not None:
639642
search = {'name': {'operation': location}}

docs/cli/block.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,11 @@ Block Commands
112112
:show-nested:
113113

114114
.. click:: SoftLayer.CLI.block.refresh:cli
115-
:prog block volume-refresh
115+
:prog: block volume-refresh
116116
:show-nested:
117117

118118
.. click:: SoftLayer.CLI.block.convert:cli
119-
:prog block volume-convert
119+
:prog: block volume-convert
120120
:show-nested:
121121

122122
.. click:: SoftLayer.CLI.block.subnets.list:cli

docs/cli/file.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,11 +100,11 @@ File Commands
100100
:show-nested:
101101

102102
.. click:: SoftLayer.CLI.file.refresh:cli
103-
:prog file volume-refresh
103+
:prog: file volume-refresh
104104
:show-nested:
105105

106106
.. click:: SoftLayer.CLI.file.convert:cli
107-
:prog file volume-convert
107+
:prog: file volume-convert
108108
:show-nested:
109109

110110
.. click:: SoftLayer.CLI.file.snapshot.schedule_list:cli

docs/cli/tickets.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
.. _cli_tickets:
22

33
Support Tickets
4-
===============
4+
=================
55

6-
The SoftLayer ticket API is used to create "classic" or Infrastructure Support cases.
7-
These tickets will still show up in your web portal, but for the more unified case management API,
8-
see the `Case Management API <https://cloud.ibm.com/apidocs/case-management#introduction>`_
6+
The SoftLayer ticket API is used to create "classic" or Infrastructure Support cases. These tickets will still show up in your web portal, but for the more unified case management API, see the `Case Management API <https://cloud.ibm.com/apidocs/case-management#introduction>`_
7+
8+
.. note::
9+
10+
Windows Git-Bash users might run into issues with `ticket create` and `ticket update` if --body isn't used, as it doesn't report that it is a real TTY to python, so the default editor can not be launched.
911

10-
.. note:: Windows Git-Bash users might run into issues with `ticket create` and `ticket update` if --body isn't used, as it doesn't report that it is a real TTY to python, so the default editor can not be launched.
1112

1213
.. click:: SoftLayer.CLI.ticket.create:cli
1314
:prog: ticket create

tests/managers/ordering_tests.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,10 @@ def test_get_location_id_int(self):
594594
dc_id = self.ordering.get_location_id(1234)
595595
self.assertEqual(1234, dc_id)
596596

597+
def test_get_location_id_NONE(self):
598+
dc_id = self.ordering.get_location_id("NONE")
599+
self.assertEqual(0, dc_id)
600+
597601
def test_location_group_id_none(self):
598602
# RestTransport uses None for empty locationGroupId
599603
category1 = {'categoryCode': 'cat1'}

0 commit comments

Comments
 (0)