当前位置: 首页>>代码示例>>Python>>正文


Python Config.save_landscape_creds方法代码示例

本文整理汇总了Python中cloudinstall.config.Config.save_landscape_creds方法的典型用法代码示例。如果您正苦于以下问题:Python Config.save_landscape_creds方法的具体用法?Python Config.save_landscape_creds怎么用?Python Config.save_landscape_creds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cloudinstall.config.Config的用法示例。


在下文中一共展示了Config.save_landscape_creds方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from cloudinstall.config import Config [as 别名]
# 或者: from cloudinstall.config.Config import save_landscape_creds [as 别名]
class LandscapeInstall:

    def __init__(self, opts, display_controller):
        self.config = Config()
        self.opts = opts
        self.display_controller = display_controller
        # Sets install type
        utils.spew(os.path.join(self.config.cfg_path,
                                'landscape'),
                   'auto-generated')

        self.landscape_tasks = ["Preparing Landscape",
                                "Deploying Landscape",
                                "Registering against Landscape"]

    def _do_install_existing_maas(self):
        """ Performs the landscape deployment with existing MAAS
        """
        MultiInstallExistingMaas(
            self.opts, self.display_controller,
            post_tasks=self.landscape_tasks).run()

    def _do_install_new_maas(self):
        """ Prepare new maas environment for landscape
        """
        MultiInstallNewMaas(self.opts, self.display_controller,
                            post_tasks=self.landscape_tasks).run()

    def _save_lds_creds(self, creds):
        admin_name = creds['admin_name'].value
        admin_email = creds['admin_email'].value
        system_email = creds['system_email'].value
        maas_server = creds['maas_server'].value
        maas_apikey = creds['maas_apikey'].value
        self.config.save_landscape_creds(
            admin_name, admin_email, system_email,
            maas_server, maas_apikey)

        self.display_controller.ui.hide_widget_on_top()
        self.display_controller.info_message("Running ..")
        if not maas_server:
            log.debug("No maas credentials entered, doing a new MAAS install")
            self._do_install_new_maas()
        else:
            log.debug("Existing MAAS defined, doing a LDS "
                      "installation with existing MAAS.")
            self.config.save_maas_creds(maas_server,
                                        maas_apikey)
            self._do_install_existing_maas()

    def run(self):
        self.display_controller.info_message(
            "Please enter your Landscape information and "
            "optionally an existing MAAS Server IP. If MAAS "
            "is not defined a new one will be created for you.")
        self.display_controller.show_landscape_input("Landscape Setup",
                                                     self._save_lds_creds)
开发者ID:chrisglass,项目名称:openstack-installer,代码行数:59,代码来源:landscape_install.py

示例2: __init__

# 需要导入模块: from cloudinstall.config import Config [as 别名]
# 或者: from cloudinstall.config.Config import save_landscape_creds [as 别名]
class LandscapeInstall:

    def __init__(self, opts, display_controller):
        self.config = Config()
        self.opts = opts
        self.display_controller = display_controller
        # Sets install type
        utils.spew(os.path.join(self.config.cfg_path,
                                'landscape'),
                   'auto-generated')

        self.landscape_tasks = ["Preparing Landscape",
                                "Deploying Landscape",
                                "Registering against Landscape"]

    def _do_install_existing_maas(self):
        """ Performs the landscape deployment with existing MAAS
        """
        MultiInstallExistingMaas(
            self.opts, self.display_controller,
            post_tasks=self.landscape_tasks).run()

    def _do_install_new_maas(self):
        """ Prepare new maas environment for landscape
        """
        MultiInstallNewMaas(self.opts, self.display_controller,
                            post_tasks=self.landscape_tasks).run()

    def _save_lds_creds(self, creds):
        admin_name = creds['admin_name'].value
        admin_email = creds['admin_email'].value
        system_email = creds['admin_email'].value
        maas_server = creds['maas_server'].value
        maas_apikey = creds['maas_apikey'].value
        self.config.save_landscape_creds(
            admin_name, admin_email, system_email,
            maas_server, maas_apikey)

        self.display_controller.ui.hide_widget_on_top()

        # Validate
        if not maas_server:
            log.debug("No MAAS server entered.")
            self.display_controller.flash("Missing required MAAS Server")
            return self.run()

        if not maas_apikey:
            log.debug("No MAAS api key entered.")
            self.display_controller.flash("Missing required MAAS API Key")
            return self.run()

        # self.display_controller.flash_reset()
        log.debug("Existing MAAS defined, doing a LDS "
                  "installation with existing MAAS.")
        self.config.save_maas_creds(maas_server,
                                    maas_apikey)
        self._do_install_existing_maas()

    def run(self):
        self.display_controller.info_message(
            "Please enter your Landscape information and "
            "MAAS Server IP and API Key. Use the MAAS web UI or 'maas list' "
            "to find your API Key")
        self.display_controller.show_landscape_input(
            "Landscape OpenStack Autopilot Setup",
            self._save_lds_creds)
开发者ID:xrobau,项目名称:openstack-installer,代码行数:68,代码来源:landscape_install.py


注:本文中的cloudinstall.config.Config.save_landscape_creds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。