def cldls(ctx, debug, profile): """ The cloudless command line. Use this to interact with networks and services deployed with cloudless, and to run the testing framework. If the "profile" option is not set, the value of "CLOUDLESS_PROFILE" will be used. If neither option is set, the default profile is "default". """ if not ctx.obj: ctx.obj = {} if debug: click.echo('Enabling debug logging.') cloudless.set_level(logging.DEBUG) ctx.obj['PROFILE'] = cloudless.profile.select_profile(profile)
""" import os import logging import click from click_repl import register_repl from cloudless.cli.init import add_init_group from cloudless.cli.network import add_network_group from cloudless.cli.service import add_service_group from cloudless.cli.service_test import add_service_test_group from cloudless.cli.paths import add_paths_group from cloudless.cli.image import add_image_group from cloudless.cli.image_build import add_image_build_group from cloudless.cli.utils import NaturalOrderGroup import cloudless cloudless.set_level(logging.INFO) cloudless.set_global_level(logging.WARN) def get_cldls(): """ Does all the work to initialize the cldls command line and subcommands. """ @click.group(name='cldls', cls=NaturalOrderGroup) @click.option('--debug/--no-debug', default=False) @click.option('--profile', help="The profile to use.") @click.pass_context def cldls(ctx, debug, profile): """ The cloudless command line. Use this to interact with networks and services deployed with cloudless, and to run the testing framework.
import logging import os import pytest import cloudless from cloudless.types.common import Service from cloudless.testutils.blueprint_tester import generate_unique_name EXAMPLES_DIR = os.path.join(os.path.dirname(__file__), "..", "examples") NETWORK_BLUEPRINT = os.path.join(EXAMPLES_DIR, "network", "blueprint.yml") AWS_SERVICE_BLUEPRINT = os.path.join(EXAMPLES_DIR, "base-image", "aws_blueprint.yml") GCE_SERVICE_BLUEPRINT = os.path.join(EXAMPLES_DIR, "base-image", "gce_blueprint.yml") # Set debug logging cloudless.set_level(logging.DEBUG) # pylint: disable=too-many-locals,too-many-statements def run_image_test(provider, credentials): """ Test that the instance management works against the given provider. """ # Get the client for this test client = cloudless.Client(provider, credentials) # Get a somewhat unique network name network_name = generate_unique_name("unittest") image_name = generate_unique_name("unittest")