예제 #1
0
파일: tui.py 프로젝트: johnsca/conjure-up
 def render(self):
     if app.argv.cloud not in juju.get_clouds().keys():
         formatted_clouds = ", ".join(juju.get_clouds().keys())
         utils.warning("Unknown Cloud: {}, please choose "
                       "from one of the following: {}".format(
                           app.argv.cloud, formatted_clouds))
         sys.exit(1)
     utils.info("Summoning {} to {}".format(app.argv.spell, app.argv.cloud))
     self.finish()
예제 #2
0
 def render(self):
     if app.current_cloud not in juju.get_clouds().keys():
         formatted_clouds = ", ".join(juju.get_clouds().keys())
         utils.error("Unknown Cloud: {}, please choose "
                     "from one of the following: {}".format(
                         app.current_cloud, formatted_clouds))
         events.Shutdown.set(1)
         return
     utils.info("Summoning {} to {}".format(app.argv.spell, app.argv.cloud))
     self.finish()
예제 #3
0
파일: tui.py 프로젝트: graywen24/conjure-up
 def render(self):
     if app.argv.cloud not in juju.get_clouds().keys():
         formatted_clouds = ", ".join(juju.get_clouds().keys())
         utils.warning(
             "Unknown Cloud: {}, please choose "
             "from one of the following: {}".format(app.argv.cloud,
                                                    formatted_clouds))
         sys.exit(1)
     utils.info(
         "Summoning {} to {}".format(app.argv.spell, app.argv.cloud))
     self.finish()
예제 #4
0
    def render(self):
        "Pick or create a cloud to bootstrap a new controller on"
        track_screen("Cloud Select")

        all_clouds = juju.get_clouds()
        compatible_clouds = juju.get_compatible_clouds()
        cloud_types = juju.get_cloud_types_by_name()
        # filter to only public clouds
        public_clouds = sorted(
            name for name, info in all_clouds.items()
            if info['defined'] == 'public' and
            cloud_types[name] in compatible_clouds)
        # filter to custom clouds
        # exclude localhost because we treat that as "configuring a new cloud"
        custom_clouds = sorted(
            name for name, info in all_clouds.items()
            if info['defined'] != 'public' and
            cloud_types[name] != 'localhost' and
            cloud_types[name] in compatible_clouds)

        excerpt = app.config.get(
            'description',
            "Where would you like to deploy?")
        view = CloudView(app,
                         public_clouds,
                         custom_clouds,
                         cb=self.finish)

        app.ui.set_header(
            title="Choose a Cloud",
            excerpt=excerpt
        )
        app.ui.set_body(view)
        app.ui.set_footer('Please press [ENTER] on highlighted '
                          'Cloud to proceed.')
예제 #5
0
    def render(self):
        "Pick or create a cloud to bootstrap a new controller on"
        track_screen("Cloud Select")

        all_clouds = juju.get_clouds()
        compatible_clouds = juju.get_compatible_clouds()
        cloud_types = juju.get_cloud_types_by_name()
        # filter to only public clouds
        public_clouds = sorted(name for name, info in all_clouds.items()
                               if info['defined'] == 'public')
        # filter to custom clouds
        # exclude localhost because we treat that as "configuring a new cloud"
        custom_clouds = sorted(name for name, info in all_clouds.items()
                               if info['defined'] != 'public'
                               and cloud_types[name] != 'localhost')

        excerpt = app.config.get('description',
                                 "Where would you like to deploy?")

        self.view = CloudView(app,
                              public_clouds,
                              custom_clouds,
                              compatible_clouds,
                              cb=self.finish)

        if 'localhost' in compatible_clouds:
            app.log.debug(
                "Starting watcher for verifying LXD server is available.")
            app.loop.create_task(
                self._monitor_localhost(LocalhostProvider(),
                                        self.view._enable_localhost_widget))

        app.ui.set_header(title="Choose a Cloud", excerpt=excerpt)
        app.ui.set_body(self.view)
        app.ui.set_footer('')
예제 #6
0
    def render(self, going_back=False):
        "Pick or create a cloud to bootstrap a new controller on"
        all_clouds = juju.get_clouds()
        compatible_clouds = juju.get_compatible_clouds()
        cloud_types = juju.get_cloud_types_by_name()
        # filter to only public clouds
        public_clouds = sorted(name for name, info in all_clouds.items()
                               if info['defined'] == 'public')
        # filter to custom clouds
        # exclude localhost because we treat that as "configuring a new cloud"
        custom_clouds = sorted(name for name, info in all_clouds.items()
                               if info['defined'] != 'public'
                               and cloud_types[name] != 'localhost')

        prev_screen = self.prev_screen
        if app.alias_given or (app.spell_given and not app.addons):
            # we were given an alias (so spell and addons are locked)
            # or we were given a spell and there are no addons to change
            # so we disable the back button
            prev_screen = None
        self.view = CloudView(app,
                              public_clouds,
                              custom_clouds,
                              compatible_clouds,
                              cb=self.finish,
                              back=prev_screen)

        if 'localhost' in compatible_clouds:
            app.log.debug(
                "Starting watcher for verifying LXD server is available.")
            self.cancel_monitor.clear()
            app.loop.create_task(self._monitor_localhost(LocalhostProvider()))
        self.view.show()
예제 #7
0
def list_clouds():
    """ Returns list of clouds filtering out any results
    """
    clouds = set(juju.get_clouds().keys())

    if len(parse_whitelist()) > 0:
        whitelist = set(parse_whitelist())
        return sorted(list(clouds & whitelist))

    elif len(parse_blacklist()) > 0:
        blacklist = set(parse_blacklist())
        return sorted(list(clouds ^ blacklist))

    return sorted(list(clouds))
예제 #8
0
def list_clouds():
    """ Returns list of clouds filtering out any results
    """
    clouds = set(juju.get_clouds().keys())
    # Add support for maas here since juju doesn't display
    # this as a typical public cloud.
    clouds.add('maas')

    if len(parse_whitelist()) > 0:
        whitelist = set(parse_whitelist())
        return sorted(list(clouds & whitelist))

    elif len(parse_blacklist()) > 0:
        blacklist = set(parse_blacklist())
        return sorted(list(clouds ^ blacklist))

    return sorted(list(clouds))
예제 #9
0
파일: common.py 프로젝트: mnama/conjure-up
def list_clouds():
    """ Returns list of clouds filtering out any results
    """
    clouds = set(juju.get_clouds().keys())

    # Remove localhost as this will be added in the configure a new
    # cloud section.
    clouds.remove('localhost')

    if len(parse_whitelist()) > 0:
        whitelist = set(parse_whitelist())
        return sorted(list(clouds & whitelist))

    elif len(parse_blacklist()) > 0:
        blacklist = set(parse_blacklist())
        return sorted(list(clouds ^ blacklist))

    return sorted(list(clouds))
예제 #10
0
    def render(self):
        "Pick or create a cloud to bootstrap a new controller on"
        track_screen("Cloud Select")

        compatible_clouds = juju.get_compatible_clouds()
        all_clouds = juju.get_clouds()
        clouds = []

        for k, v in all_clouds.items():
            if v['type'] in compatible_clouds:
                clouds.append(k)

        excerpt = app.config.get(
            'description', "Please select from a list of available clouds")
        view = CloudView(app, sorted(clouds), cb=self.finish)

        app.ui.set_header(title="Choose a Cloud", excerpt=excerpt)
        app.ui.set_body(view)
        app.ui.set_footer('Please press [ENTER] on highlighted '
                          'Cloud to proceed.')