예제 #1
0
    def render(self, going_back=False):
        existing_controllers = juju.get_controllers()['controllers']
        self.check_jaas()

        filtered_controllers = {
            n: d
            for n, d in existing_controllers.items()
            if d['cloud'] == app.provider.cloud
        }

        if not app.jaas_ok and len(filtered_controllers) == 0:
            return self.finish(None)
        view = ControllerListView(app, filtered_controllers, self.finish,
                                  self.back)
        view.show()
예제 #2
0
파일: gui.py 프로젝트: mnama/conjure-up
    def render(self):
        existing_controllers = juju.get_controllers()['controllers']
        if len(existing_controllers) == 0:
            return controllers.use('clouds').render()

        metadata = app.config['metadata']
        whitelisted_clouds = [c for c in metadata.get('cloud-whitelist', [])]
        blacklisted_clouds = [c for c in metadata.get('cloud-blacklist', [])]
        if len(whitelisted_clouds) > 0:
            filtered_controllers = {
                n: d
                for n, d in existing_controllers.items()
                if d['cloud'] in whitelisted_clouds
            }
        elif len(blacklisted_clouds) > 0:
            filtered_controllers = {
                n: d
                for n, d in existing_controllers.items()
                if d['cloud'] not in blacklisted_clouds
            }
        else:
            filtered_controllers = existing_controllers

        if len(filtered_controllers) == 0:
            return controllers.use('clouds').render()

        excerpt = app.config.get(
            'description', "Please select an existing controller,"
            " or choose to bootstrap a new one.")
        view = ControllerListView(app, filtered_controllers, self.finish)

        app.ui.set_header(title="Choose a Controller or Create new",
                          excerpt=excerpt)
        app.ui.set_body(view)
예제 #3
0
파일: gui.py 프로젝트: ops-sandy/conjure-up
    def render(self):
        existing_controllers = juju.get_controllers()['controllers']
        clouds = juju.get_compatible_clouds()
        cloud_types = juju.get_cloud_types_by_name()

        app.jaas_ok = set(clouds) & JAAS_CLOUDS
        jaas_controller = {
            n
            for n, c in existing_controllers.items()
            if JAAS_ENDPOINT in c['api-endpoints']
        }
        if jaas_controller:
            app.jaas_controller = jaas_controller.pop()

        filtered_controllers = {
            n: d
            for n, d in existing_controllers.items()
            if cloud_types.get(d['cloud']) in clouds
        }

        if not app.jaas_ok and len(filtered_controllers) == 0:
            return controllers.use('clouds').render()

        track_screen("Controller Picker")
        excerpt = app.config.get(
            'description', "Please select an existing controller,"
            " or choose to bootstrap a new one.")
        view = ControllerListView(app, filtered_controllers, self.finish)

        app.ui.set_header(title="Choose a Controller or Create new",
                          excerpt=excerpt)
        app.ui.set_body(view)
예제 #4
0
    def render(self):
        existing_controllers = juju.get_controllers()['controllers']
        self.check_jaas()

        filtered_controllers = {
            n: d
            for n, d in existing_controllers.items()
            if d['cloud'] == app.provider.cloud
        }

        if not app.jaas_ok and len(filtered_controllers) == 0:
            return self.finish(None)

        track_screen("Controller Picker")
        excerpt = app.config.get(
            'description', "Please select an existing controller,"
            " or choose to bootstrap a new one.")
        view = ControllerListView(app, filtered_controllers, self.finish)

        app.ui.set_header(title="Controller", excerpt=excerpt)
        app.ui.set_body(view)