def _create_command(deployment_id, deploy, settings_dict): settings = seslib.Settings(**settings_dict) dep = seslib.Deployment.create(deployment_id, settings) click.echo("=== Creating deployment with the following configuration ===") click.echo(dep.status()) if deploy: if click.confirm('Do you want to continue with the deployment?', default=True): dep.start(_print_log) click.echo("=== Deployment Finished ===") click.echo() click.echo("You can login into the cluster with:") click.echo() click.echo(" $ sesdev ssh {}".format(deployment_id)) click.echo() if dep.settings.version == 'ses5': click.echo("Or, access openATTIC with:") click.echo() click.echo( " $ sesdev tunnel {} openattic".format(deployment_id)) else: click.echo("Or, access the Ceph Dashboard with:") click.echo() click.echo( " $ sesdev tunnel {} dashboard".format(deployment_id)) click.echo() else: dep.destroy(_silent_log)
def list_boxes(**kwargs): """ List all Vagrant Boxes installed in the system. """ click.echo("List of all Vagrant Boxes installed in the system") click.echo("-------------------------------------------------") settings_dict = _gen_box_settings_dict(**kwargs) settings = seslib.Settings(**settings_dict) box_obj = seslib.Box(settings) box_obj.list()
def _create_command(deployment_id, deploy, settings_dict): interactive = not settings_dict.get('non_interactive', False) settings = seslib.Settings(**settings_dict) dep = seslib.Deployment.create(deployment_id, settings) if not dep.settings.devel_repo: if dep.settings.version not in seslib.GlobalSettings.CORE_VERSIONS: raise OptionNotSupportedInVersion('--product', dep.settings.version) really_want_to = None click.echo( "=== Creating deployment \"{}\" with the following configuration ===". format(deployment_id)) click.echo(dep.status()) if deploy: really_want_to = True if interactive: really_want_to = click.confirm( 'Do you want to continue with the deployment?', default=True, ) try: if really_want_to: dep.vet_configuration() dep.start(_print_log) click.echo("=== Deployment Finished ===") click.echo() click.echo("You can login into the cluster with:") click.echo() click.echo(" $ sesdev ssh {}".format(deployment_id)) click.echo() if dep.settings.version == 'ses5': click.echo("Or, access openATTIC with:") click.echo() click.echo( " $ sesdev tunnel {} openattic".format(deployment_id)) elif dep.settings.version == 'octopus' and dep.has_suma(): click.echo("Or, access the SUMA WebUI with:") click.echo() click.echo( " $ sesdev tunnel {} suma".format(deployment_id)) click.echo() else: click.echo("Or, access the Ceph Dashboard with:") click.echo() click.echo( " $ sesdev tunnel {} dashboard".format(deployment_id)) click.echo() else: raise click.Abort() except click.Abort: click.echo() click.echo("Exiting...") dep.destroy(_silent_log)
def remove_box(box_name, **kwargs): """ Remove a Vagrant Box installed in the system by sesdev. This involves first removing the corresponding image from the libvirt storage pool, and then running 'vagrant box remove' on it. """ settings_dict = _gen_box_settings_dict(**kwargs) settings = seslib.Settings(**settings_dict) # # existing deployments might be using this box deps = seslib.Deployment.list(True) existing_deployments = [] for dep in deps: if box_name == dep.settings.os: existing_deployments.append(dep.dep_id) if existing_deployments: if len(existing_deployments) == 1: click.echo( "The following deployment is already using box ->{}<-:".format( box_name)) else: click.echo( "The following deployments are already using box ->{}<-:". format(box_name)) for dep_id in existing_deployments: click.echo(" {}".format(dep_id)) click.echo() if len(existing_deployments) == 1: click.echo("It must be destroyed first!") else: click.echo("These must be destroyed first!") sys.exit(-1) box_obj = seslib.Box(settings) if box_obj.exists(box_name): click.echo("Proceeding to remove Vagrant Box ->{}<-".format(box_name)) else: click.echo("There is no Vagrant Box called ->{}<-".format(box_name)) sys.exit(-1) image_to_remove = box_obj.get_image_by_box(box_name) if image_to_remove: click.echo("Found related image ->{}<- in libvirt storage pool".format( image_to_remove)) box_obj.remove_image(image_to_remove) click.echo("Libvirt image removed.") box_obj.remove_box(box_name) click.echo("Vagrant Box removed.")
def _create_command(deployment_id, deploy, settings_dict): settings = seslib.Settings(**settings_dict) dep = seslib.Deployment.create(deployment_id, settings) really_want_to = None click.echo("=== Creating deployment with the following configuration ===") click.echo(dep.status()) if deploy: if getattr(settings, 'non_interactive', False): really_want_to = True else: really_want_to = click.confirm( 'Do you want to continue with the deployment?', default=True, ) try: if really_want_to: dep.start(_print_log) click.echo("=== Deployment Finished ===") click.echo() click.echo("You can login into the cluster with:") click.echo() click.echo(" $ sesdev ssh {}".format(deployment_id)) click.echo() if dep.settings.version == 'ses5': click.echo("Or, access openATTIC with:") click.echo() click.echo( " $ sesdev tunnel {} openattic".format(deployment_id)) elif dep.settings.version == 'octopus' and dep.has_suma(): click.echo("Or, access the SUMA WebUI with:") click.echo() click.echo( " $ sesdev tunnel {} suma".format(deployment_id)) click.echo() else: click.echo("Or, access the Ceph Dashboard with:") click.echo() click.echo( " $ sesdev tunnel {} dashboard".format(deployment_id)) click.echo() else: raise click.Abort() except click.Abort: click.echo() click.echo("Exiting...") dep.destroy(_silent_log)