def config(username, password, endpoint): """Initial setup of VCL settings.""" try: cfg.vcl_conf(username, password, endpoint) utils.validate_credentials() except ValueError as error: utils.handle_error(error.message) click.echo("Credentials and endpoint validated and recorded.")
def config(username, password, endpoint): """Initial setup of VCL settings.""" try: cfg.vcl_conf(username, password, endpoint) utils.validate_credentials() except ValueError as error: utils.handle_error(error.message) click.echo('Credentials and endpoint validated and recorded.')
def extend(extend_time, request_id): """Extends the reservation time on a request.""" if not request_id: request_id = utils.choose_active_request() try: api.extend(request_id, extend_time) click.echo("Request %s extended successfully." % request_id) except RuntimeError as error: utils.handle_error(error.message)
def delete(request_id): """Deletes a request.""" if not request_id: request_id = utils.choose_active_request() msg = "Are you sure you want to delete request %s?" % request_id if not click.confirm(msg): return try: api.delete(request_id) click.echo("Request %s deleted successfully." % request_id) except RuntimeError as error: utils.handle_error(error.message)
def request_instance(image, no_status): """Creates a new request for resources.""" try: image_id = utils.get_image_id(image) except ValueError as error: utils.handle_error(error.message) return try: request_id = api.request(image_id) click.echo("Request is starting now.\n") except RuntimeError as error: utils.handle_error(error.message) return if no_status: return # If this doesn't raise an exception, request is ready utils.check_request_status(request_id) utils.print_connection_details(request_id) return
def request_instance(image, no_status): """Creates a new request for resources.""" try: image_id = utils.get_image_id(image) except ValueError as error: utils.handle_error(error.message) return try: request_id = api.request(image_id) click.echo('Request is starting now.\n') except RuntimeError as error: utils.handle_error(error.message) return if no_status: return # If this doesn't raise an exception, request is ready utils.check_request_status(request_id) utils.print_connection_details(request_id) return