Example #1
0
    def finish(self, credentials=None, region=None, back=False):
        if region:
            app.current_region = region

        if back:
            return controllers.use('clouds').render()

        if credentials is not None:
            cloud_type = juju.get_cloud_types_by_name()[app.current_cloud]
            if cloud_type == 'maas':
                # Now that we are passed the selection of a cloud we create a
                # new cloud name for the remainder of the deployment and make
                # sure this cloud is saved for future use.
                app.current_cloud = utils.gen_cloud()

                # Save credentials for new cloud
                common.save_creds(app.current_cloud, credentials)

                try:
                    juju.get_cloud(app.current_cloud)
                except LookupError:
                    juju.add_cloud(app.current_cloud,
                                   credentials.cloud_config())
            else:
                common.save_creds(app.current_cloud, credentials)
        credentials_key = common.try_get_creds(app.current_cloud)
        app.loop.create_task(
            common.do_bootstrap(credentials_key,
                                msg_cb=app.ui.set_footer,
                                fail_msg_cb=lambda e: None))
        controllers.use('deploy').render()
Example #2
0
    def finish(self, cloud):
        """Save the selected cloud and move on to the region selection screen.

        """
        if cloud == 'maas':
            app.current_cloud_type = 'maas'
            app.current_cloud = utils.gen_cloud()
        else:
            app.current_cloud_type = juju.get_cloud_types_by_name()[cloud]
            app.current_cloud = cloud

        if app.current_model is None:
            app.current_model = utils.gen_model()

        track_event("Cloud selection", app.current_cloud, "")
        return controllers.use('regions').render()
Example #3
0
    def finish(self, cloud):
        """ Load the selected cloud provider
        """
        self.cancel_monitor.set()

        if cloud in CUSTOM_PROVIDERS:
            app.provider = load_schema(cloud)
        else:
            app.provider = load_schema(juju.get_cloud_types_by_name()[cloud])

        try:
            app.provider.load(cloud)
        except SchemaErrorUnknownCloud:
            app.provider.cloud = utils.gen_cloud()

        if app.provider.model is None:
            app.provider.model = utils.gen_model()

        track_event("Cloud selection", app.provider.cloud, "")

        return controllers.use('credentials').render()
Example #4
0
    def finish(self, schema=None, region=None, back=False):
        if region:
            app.current_region = region

        if back:
            return controllers.use('clouds').render()

        if schema is not None:
            # Attempt to setup LXD with our selected interface
            if self.cloud_type == 'localhost':
                try:
                    common.lxd_init(schema.network_interface.value)

                    # Store LXD setup completion so we dont reconfigure on
                    # subsequent runs
                    common.get_lxd_setup_path().touch()
                except Exception:
                    raise

            elif self.cloud_type == 'maas':
                # Now that we are passed the selection of a cloud we create a
                # new cloud name for the remainder of the deployment and make
                # sure this cloud is saved for future use.
                app.current_cloud = utils.gen_cloud()

                # Save credentials for new cloud
                common.save_creds(app.current_cloud, schema)

                try:
                    juju.get_cloud(app.current_cloud)
                except LookupError:
                    juju.add_cloud(app.current_cloud,
                                   schema.cloud_config())
            else:
                common.save_creds(app.current_cloud, schema)
        credentials_key = common.try_get_creds(app.current_cloud)
        app.loop.create_task(common.do_bootstrap(credentials_key,
                                                 msg_cb=app.ui.set_footer,
                                                 fail_msg_cb=lambda e: None))
        controllers.use('deploy').render()