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


Python NetworkManager.get_horizon_url方法代码示例

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


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

示例1: GET

# 需要导入模块: from nailgun.network.manager import NetworkManager [as 别名]
# 或者: from nailgun.network.manager.NetworkManager import get_horizon_url [as 别名]
    def GET(self, cluster_id):
        try:
            cluster = db().query(Cluster).get(cluster_id)
            cluster_attrs = self.get_cluster_attrs(cluster)
            network_manager = NetworkManager()
            horizon_url = network_manager.get_horizon_url(cluster_id)
            keystone_url = network_manager.get_keystone_url(cluster_id)

            return {
                "horizon_url": horizon_url,
                "keystone_url": keystone_url,
                "admin_username": cluster_attrs["user"],
                "admin_password": cluster_attrs["password"],
                "admin_tenant_name": cluster_attrs["tenant"],
                "controller_nodes_ips": self.get_controller_nodes_ips(cluster),
                "controller_nodes_names": self.get_controller_nodes_fqdns(cluster),
            }
        except Exception as exc:
            logger.error(traceback.format_exc())
            raise web.badrequest(message=str(exc))
开发者ID:newsky,项目名称:fuelweb,代码行数:22,代码来源:ostf.py

示例2: _success_action

# 需要导入模块: from nailgun.network.manager import NetworkManager [as 别名]
# 或者: from nailgun.network.manager.NetworkManager import get_horizon_url [as 别名]
    def _success_action(cls, task, status, progress):
        # check if all nodes are ready
        if any(map(lambda n: n.status == 'error',
                   task.cluster.nodes)):
            cls._error_action(task, 'error', 100)
            return

        if task.cluster.mode in ('singlenode', 'multinode'):
            # determining horizon url - it's an IP
            # of a first cluster controller
            controller = db().query(Node).filter_by(
                cluster_id=task.cluster_id
            ).filter(Node.role_list.any(name='controller')).first()
            if controller:
                logger.debug(
                    u"Controller is found, node_id=%s, "
                    "getting it's IP addresses",
                    controller.id
                )
                public_net = filter(
                    lambda n: n['name'] == 'public' and 'ip' in n,
                    NetworkManager.get_node_networks(controller.id)
                )
                if public_net:
                    horizon_ip = public_net[0]['ip'].split('/')[0]
                    message = (
                        u"Deployment of environment '{0}' is done. "
                        "Access the OpenStack dashboard (Horizon) at "
                        "http://{1}/ or via internal network at http://{2}/"
                    ).format(
                        task.cluster.name,
                        horizon_ip,
                        controller.ip
                    )
                else:
                    message = (
                        u"Deployment of environment '{0}' is done"
                    ).format(task.cluster.name)
                    logger.warning(
                        u"Public ip for controller node "
                        "not found in '{0}'".format(task.cluster.name)
                    )
            else:
                message = (
                    u"Deployment of environment"
                    " '{0}' is done"
                ).format(task.cluster.name)
                logger.warning(u"Controller node not found in '{0}'".format(
                    task.cluster.name
                ))
        elif task.cluster.is_ha_mode:
            # determining horizon url in HA mode - it's vip
            # from a public network saved in task cache
            try:
                message = (
                    u"Deployment of environment '{0}' is done. "
                    "Access the OpenStack dashboard (Horizon) at {1}"
                ).format(
                    task.cluster.name,
                    NetworkManager.get_horizon_url(task.cluster.id)
                )
            except Exception as exc:
                logger.error(": ".join([
                    str(exc),
                    traceback.format_exc()
                ]))
                message = (
                    u"Deployment of environment"
                    " '{0}' is done"
                ).format(task.cluster.name)
                logger.warning(
                    u"Cannot find virtual IP for '{0}'".format(
                        task.cluster.name
                    )
                )

        notifier.notify(
            "done",
            message,
            task.cluster_id
        )
        TaskHelper.update_task_status(task.uuid, status, progress, message)
开发者ID:adanin,项目名称:fuel-web,代码行数:84,代码来源:receiver.py


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