Skip to content

Commit 2af5f07

Browse files
caberoscaberos
authored andcommitted
Add a warning if user orders in a POD that is being closed
1 parent 51b594e commit 2af5f07

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

SoftLayer/CLI/hardware/create.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
def cli(env, **args):
4242
"""Order/create a dedicated server."""
4343
mgr = SoftLayer.HardwareManager(env.client)
44+
network = SoftLayer.NetworkManager(env.client)
45+
46+
pods = network.get_closed_pods()
47+
closure = []
4448

4549
# Get the SSH keys
4650
ssh_keys = []
@@ -99,6 +103,10 @@ def cli(env, **args):
99103
return
100104

101105
if do_create:
106+
for pod in pods:
107+
if args.get('datacenter') in str(pod['name']):
108+
closure.append(pod['name'])
109+
click.secho(click.style('Warning: Closed soon: %s' % (', '.join(closure)), fg='yellow'))
102110
if not (env.skip_confirmations or formatting.confirm(
103111
"This action will incur charges on your account. Continue?")):
104112
raise exceptions.CLIAbort('Aborting dedicated server order.')

SoftLayer/CLI/virt/create.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,16 @@ def cli(env, **args):
218218
create_args = _parse_create_args(env.client, args)
219219
test = args.get('test', False)
220220
do_create = not (args.get('export') or test)
221+
network = SoftLayer.NetworkManager(env.client)
222+
223+
pods = network.get_closed_pods()
224+
closure = []
221225

222226
if do_create:
227+
for pod in pods:
228+
if args.get('datacenter') in str(pod['name']):
229+
closure.append(pod['name'])
230+
click.secho(click.style('Warning: Closed soon: %s' % (', '.join(closure)), fg='yellow'))
223231
if not (env.skip_confirmations or formatting.confirm(
224232
"This action will incur charges on your account. Continue?")):
225233
raise exceptions.CLIAbort('Aborting virtual server order.')

0 commit comments

Comments
 (0)