Repository: softlayer/softlayer-python (python)

Issue:
Errors with order place
```
$>  slcli order place --verify --billing monthly SINGLE_E3_1270_V6_CL FRANKFURT02 DISK_CONTROLLER_NONRAID BANDWIDTH_0_GB 1_GBPS_PRIVATE_NETWORK_UPLINK REBOOT_KVM_OVER_IP 1_IP_ADDRESS UNLIMITED_SSL_VPN_USERS_1_PPTP_VPN_USER_PER_ACCOUNT OS_UBUNTU_20_04_LTS_FOCAL_FOSSA_64_BIT INTEL_INTEL_XEON_3_80 RAM_16_GB_DDR4_2666_ECC_NON_REG HARD_DRIVE_1_00_TB_SATA_2 AUTOMATED_NOTIFICATION NESSUS_VULNERABILITY_ASSESSMENT_REPORTING MONITORING_HOST_PING  NOTIFICATION_EMAIL_AND_TICKET  --complex-type SoftLayer_Container_Product_Order_Hardware_Server
An unexpected error has occured:
Traceback (most recent call last):
  File "C:\Users\allmi\Code\py311\Lib\site-packages\SoftLayer\CLI\core.py", line 182, in main
    cli.main(**kwargs)
  File "C:\Users\allmi\Code\py311\Lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "C:\Users\allmi\Code\py311\Lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\allmi\Code\py311\Lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\allmi\Code\py311\Lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\allmi\Code\py311\Lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\allmi\Code\py311\Lib\site-packages\click\decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\allmi\Code\py311\Lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\allmi\Code\py311\Lib\site-packages\SoftLayer\CLI\order\place.py", line 68, in cli
    if location_dc.get('name') in pod.get('name'):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'in <string>' requires string as left operand, not NoneType

Feel free to report this error as it is likely a bug:
    https://github.com/softlayer/softlayer-python/issues
The following snippet should be able to reproduce the error
```

Pull request description:
fixed an issue when placing an order doesn't find the correct datacenter
fixed #2114 

Patch:
diff --git a/SoftLayer/CLI/order/place.py b/SoftLayer/CLI/order/place.py
index 97c41784..eb6c45e9 100644
--- a/SoftLayer/CLI/order/place.py
+++ b/SoftLayer/CLI/order/place.py
@@ -65,7 +65,7 @@ def cli(env, package_keyname, location, preset, verify, billing, complex_type,
     pods = network.get_closed_pods()
     location_dc = network.get_datacenter_by_keyname(location)
     for pod in pods:
-        if location_dc.get('name') in pod.get('name'):
+        if location_dc and location_dc.get('name') in pod.get('name'):
             click.secho(f"Warning: Closed soon: {pod.get('name')}", fg='yellow')
 
     if extras:


Test patch:
diff --git a/tests/CLI/modules/order_tests.py b/tests/CLI/modules/order_tests.py
index dc2c892a..29beca5a 100644
--- a/tests/CLI/modules/order_tests.py
+++ b/tests/CLI/modules/order_tests.py
@@ -10,6 +10,7 @@
 from unittest import mock as mock
 
 from SoftLayer.CLI import exceptions
+from SoftLayer.exceptions import SoftLayerError as SoftLayerError
 from SoftLayer import testing
 
 
@@ -452,6 +453,15 @@ def test_quote_delete(self):
         self.assert_no_fail(result)
         self.assert_called_with('SoftLayer_Billing_Order_Quote', 'deleteQuote', identifier='12345')
 
+    def test_empty_get_datacenter(self):
+        """https://github.com/softlayer/softlayer-python/issues/2114 """
+        dc_mock = self.set_mock('SoftLayer_Location', 'getDatacenters')
+        dc_mock.side_effect = [[], [{'name': 'dal13', 'id': 123}]]
+        result = self.run_command(['--really', 'order', 'place', 'SOFTWARE_LICENSE_PACKAGE', 'dal13', 'SOMETHING'])
+        self.assertEqual(result.exit_code, 1)
+        self.assertIsInstance(result.exception, SoftLayerError)
+        self.assertEqual(str(result.exception), "A complex type must be specified with the order")
+
 
 def _get_all_packages():
     package_type = {'keyName': 'BARE_METAL_CPU'}