Exemplo n.º 1
0
def _create_command(deployment_id, deploy, settings_dict):
    interactive = not settings_dict.get('non_interactive', False)
    settings = Settings(**settings_dict)
    dep = Deployment.create(deployment_id, settings)
    if not dep.settings.devel_repo:
        if dep.settings.version not in Constant.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()
                if dep.settings.dry_run:
                    click.echo(
                        "Dry run. Stopping now, before creating any VMs.")
                    raise click.Abort()
                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)
Exemplo n.º 2
0
def redeploy(deployment_id, **kwargs):
    """
    Destroys the VMs of the deployment DEPLOYMENT_ID and deploys again the cluster
    from scratch with the same configuration.
    """
    interactive = not (kwargs.get('non_interactive', False)
                       or kwargs.get('force', False))
    if interactive:
        really_want_to = True
        if interactive:
            really_want_to = click.confirm(
                'Do you want to continue with the deployment?',
                default=True,
            )
        if not really_want_to:
            raise click.Abort()
    dep = Deployment.load(deployment_id)
    dep.destroy(_print_log)
    dep = Deployment.create(deployment_id, dep.settings)
    dep.start(_print_log)