Skip to content

Commit 59db251

Browse files
actually adding the ready cli command
1 parent b5402da commit 59db251

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

SoftLayer/CLI/hardware/ready.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"""Check if a virtual server is ready."""
2+
# :license: MIT, see LICENSE for more details.
3+
4+
import click
5+
6+
import SoftLayer
7+
from SoftLayer.CLI import environment
8+
from SoftLayer.CLI import exceptions
9+
from SoftLayer.CLI import helpers
10+
11+
12+
@click.command()
13+
@click.argument('identifier')
14+
@click.option('--wait', default=0, show_default=True, type=click.INT, help="Seconds to wait")
15+
@environment.pass_env
16+
def cli(env, identifier, wait):
17+
"""Check if a virtual server is ready."""
18+
19+
compute = SoftLayer.HardwareManager(env.client)
20+
compute_id = helpers.resolve_id(compute.resolve_ids, identifier, 'hardware')
21+
ready = compute.wait_for_ready(compute_id, wait)
22+
if ready:
23+
env.fout("READY")
24+
else:
25+
raise exceptions.CLIAbort("Instance %s not ready" % compute_id)

0 commit comments

Comments
 (0)