slapos-request : Add help when requesting and resource is not ready

parent f8011935
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
############################################################################## ##############################################################################
import slapos.slap.slap import slapos.slap.slap
from slapos.slap import ResourceNotReady
import sys import sys
from optparse import OptionParser, Option from optparse import OptionParser, Option
...@@ -127,10 +128,16 @@ slapos-request allows you to request slapos instances.""" % sys.argv[0] ...@@ -127,10 +128,16 @@ slapos-request allows you to request slapos instances.""" % sys.argv[0]
print("Requesting %s..." % software_url) print("Requesting %s..." % software_url)
if software_url in local: if software_url in local:
software_url = local[software_url] software_url = local[software_url]
try:
partition = local['slap'].registerOpenOrder().request(software_url, partition = local['slap'].registerOpenOrder().request(software_url,
partition_reference) partition_reference)
# XXX-Cedric : provide a way to get informations about instance print("Instance requested.\nState is : %s.\nYou can "
print("Instance requested.") "rerun to get up-to-date informations." % (
partition.getState()))
except ResourceNotReady:
print("Instance requested. Master is provisionning it. Please rerun in a "
"couple of minutes to get connection informations")
exit(2)
def run(): def run():
"""Ran when invoking slapconsole""" """Ran when invoking slapconsole"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment