def create_application(name=None, blueprint=None, vms=None, cloud=None, region=None, wait=True, show_progress=True): """create_application(name=None, blueprint=None, vms=None, cloud=None, \ region=None, wait=True, show_progress=True) Create a new application. If *blueprint* is specified, then it must be the name of a blueprint from which the application is created. If *blueprint* is not specified, then an application will be created from scratch in which case *vms* needs to be specified containing a list of the VM definitions. The VM definitions are dictionaries containing string keys describing the VM. The arguments *cloud* and *region* specify which cloud and region to publish the application to. If these are not specified, the application is published to the lowest cost cloud that fits the VM definitions. If *wait* is nonzero, then this function will wait until the application is started up and its VMs are accessible via ssh. If *show_progress* is nonzero, then a progress bar is shown. The return value of this function is the application definition of the application that was created. In case of an error, an exception is raised. .. seealso:: See :ref:`vm-ref` for the possible keys in a VM definition dictionary. """ if blueprint: bp = cache.get_blueprint(name=blueprint) if bp is None: error.raise_error('Blueprint `{0}` not found.', blueprint) if name is None: name = new_application_name(bp['name']) else: if name is None: name = new_application_name() appdef = { 'name': name } if vms: appdef['vms'] = vms if blueprint: appdef['blueprint'] = blueprint manif = { 'applications': [appdef], 'defaults': { 'vms': { 'smp': 1, 'memory': 2048 } } } manifest.check_manifest(manif) manifest.percolate_defaults(manif) manifest.check_manifest_entities(manif) app = application.create_new_application(appdef, False) app = application.publish_application(app, cloud, region) if wait: vms = set((vm['name'] for vm in app['vms'])) with env.let(quiet=not show_progress): app = application.wait_for_application(app, vms) return application.appdef_from_app(app)
def do_lint(args, env): """The "ravtest lint" command.""" if args.check_entities: login.default_login() console.info('Checking manifest...') manif = manifest.load_manifest() manifest.check_manifest(manif) manifest.add_defaults(manif) manifest.percolate_defaults(manif) manifest.expand_shorthands(manif) manifest.complete_data(manif) if args.check_entities: manifest.check_manifest_entities(manif) console.info('Manifest OK') if args.dump: console.write(util.prettify(manif))