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


Python Helper.get_setup_node_ip方法代码示例

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


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

示例1: __init__

# 需要导入模块: from helper import Helper [as 别名]
# 或者: from helper.Helper import get_setup_node_ip [as 别名]
    def __init__(self, config, fuel_cluster_id, tag, cleanup):
        # fuel cluster id
        self.fuel_cluster_id = fuel_cluster_id

        # tag, only deploy nodes with this tag
        self.tag = tag

        # clean up flag
        self.cleanup = cleanup

        # flags for upgrade
        self.install_ivs = config.get('default_install_ivs')
        self.install_bsnstacklib = config.get('default_install_bsnstacklib')
        self.install_all = config.get('default_install_all')

        # flags for dhcp and metadata agent
        self.deploy_dhcp_agent = config.get('default_deploy_dhcp_agent')

        # setup node ip and directory
        self.setup_node_ip  = Helper.get_setup_node_ip()
        self.setup_node_dir = os.getcwd()

        # t5 or t6 mode
        self.deploy_mode = config.get('default_deploy_mode')
        if not self.deploy_mode:
            self.deploy_mode = const.T5
        for node_config in config['nodes']:
            node_mode = node_config.get('deploy_mode')
            if node_mode and node_mode.lower() == const.T6:
                self.deploy_mode = const.T6
                break

        # selinux configuration
        self.selinux_mode = None
        if os.path.isfile(const.SELINUX_CONFIG_PATH):
            with open(const.SELINUX_CONFIG_PATH, "r") as selinux_config_file:
                selinux_mode_match = re.compile(const.SELINUX_MODE_EXPRESSION, re.IGNORECASE)
                lines = selinux_config_file.readlines()
                for line in lines:
                    match = selinux_mode_match.match(line)
                    if match:
                        self.selinux_mode = match.group(1)
                        break

        # neutron vlan ranges
        self.network_vlan_ranges = config['network_vlan_ranges']
        network_vlan_range_pattern = re.compile(const.NETWORK_VLAN_RANGE_EXPRESSION, re.IGNORECASE)
        match = network_vlan_range_pattern.match(self.network_vlan_ranges)
        if not match:
            Helper.safe_print("network_vlan_ranges' format is not correct.\n")
            exit(1)
        self.physnet    = match.group(1)
        self.lower_vlan = match.group(2)
        self.upper_vlan = match.group(3)

        # bcf controller information
        self.bcf_controllers = config['bcf_controllers']
        self.bcf_controller_ips = []
        for controller in self.bcf_controllers:
            ip = controller.split(':')[0]
            self.bcf_controller_ips.append(ip)
        self.bcf_controller_user = config['bcf_controller_user']
        self.bcf_controller_passwd = config['bcf_controller_passwd']
        self.bcf_openstack_management_tenant = config.get('bcf_openstack_management_tenant')

        # ivs pkg and debug pkg
        self.ivs_pkg_map = {}
        self.ivs_url_map = {}
        for ivs_url in config['ivs_packages']:
            ivs_pkg = os.path.basename(ivs_url)
            if '.rpm' in ivs_pkg and 'debuginfo' not in ivs_pkg:
                self.ivs_url_map['rpm'] = ivs_url
                self.ivs_pkg_map['rpm'] = ivs_pkg
            elif '.rpm' in ivs_pkg and 'debuginfo' in ivs_pkg:
                self.ivs_url_map['debug_rpm'] = ivs_url
                self.ivs_pkg_map['debug_rpm'] = ivs_pkg
            elif '.deb' in ivs_pkg and 'dbg' not in ivs_pkg:
                self.ivs_url_map['deb'] = ivs_url
                self.ivs_pkg_map['deb'] = ivs_pkg
            elif '.deb' in ivs_pkg and 'dbg' in ivs_pkg:
                self.ivs_url_map['debug_deb'] = ivs_url
                self.ivs_pkg_map['debug_deb'] = ivs_pkg

        # information will be passed on to nodes
        self.skip = False
        if 'default_skip' in config:
            self.skip = config['default_skip']
        self.os = config.get('default_os')
        self.os_version = config.get('default_os_version')
        self.role = config.get('default_role')
        self.user = config.get('default_user')
        self.passwd = config.get('default_passwd')
        self.uplink_interfaces = config.get('default_uplink_interfaces')

        # openstack bsnstacklib version and horizon patch
        self.openstack_release = str(config['openstack_release']).lower()
        self.bsnstacklib_version = const.OS_RELEASE_TO_BSN_LIB[self.openstack_release]
        self.deploy_horizon_patch = const.DEPLOY_HORIZON_PATCH
        self.horizon_patch_url = const.HORIZON_PATCH_URL[self.openstack_release]
        self.horizon_patch = os.path.basename(self.horizon_patch_url)
#.........这里部分代码省略.........
开发者ID:xinwu,项目名称:deployment-support,代码行数:103,代码来源:environment.py

示例2: __init__

# 需要导入模块: from helper import Helper [as 别名]
# 或者: from helper.Helper import get_setup_node_ip [as 别名]
    def __init__(self, config, mode, fuel_cluster_id, rhosp, tag, cleanup, skip_ivs_version_check):
        # fuel cluster id
        self.fuel_cluster_id = fuel_cluster_id

        # rhosp as installer
        self.rhosp = rhosp

        # tag, only deploy nodes with this tag
        self.tag = tag

        # clean up flag
        self.cleanup = cleanup

        self.skip_ivs_version_check = skip_ivs_version_check

        # neutron_id for ml2 plugin restproxy
        self.neutron_id = config.get('neutron_id')

        # installer pxe interface ip
        self.installer_pxe_interface_ip = config.get(
            'installer_pxe_interface_ip')

        # install to specified nodes
        self.deploy_to_specified_nodes_only = config.get(
            'deploy_to_specified_nodes_only')

        # flags for upgrade
        self.install_ivs = config.get('default_install_ivs')
        self.install_bsnstacklib = config.get('default_install_bsnstacklib')
        self.install_all = True

        # flags for dhcp and metadata agent
        self.deploy_dhcp_agent = config.get('default_deploy_dhcp_agent')

        # flags for l3 agent
        self.deploy_l3_agent = config.get('default_deploy_l3_agent')

        # setup node ip and directory
        self.setup_node_ip = Helper.get_setup_node_ip()
        example_yamls = ["/usr/local/etc/bosi/config.yaml",
                         "/usr/etc/bosi/config.yaml"]
        for example_yaml in example_yamls:
            if os.path.isfile(example_yaml):
                self.setup_node_dir = os.path.dirname(example_yaml)
                break

        # t5 or t6 mode
        self.deploy_mode = const.MODE_DICT.get(mode)
        if not self.deploy_mode:
            self.deploy_mode = const.T5

        # selinux configuration
        self.selinux_mode = None
        if os.path.isfile(const.SELINUX_CONFIG_PATH):
            with open(const.SELINUX_CONFIG_PATH, "r") as selinux_config_file:
                selinux_mode_match = re.compile(const.SELINUX_MODE_EXPRESSION,
                                                re.IGNORECASE)
                lines = selinux_config_file.readlines()
                for line in lines:
                    match = selinux_mode_match.match(line)
                    if match:
                        self.selinux_mode = match.group(1)
                        break

        # neutron vlan ranges
        self.network_vlan_ranges = config.get('network_vlan_ranges')
        network_vlan_range_pattern = re.compile(
            const.NETWORK_VLAN_RANGE_EXPRESSION, re.IGNORECASE)
        match = network_vlan_range_pattern.match(self.network_vlan_ranges)
        if not match:
            Helper.safe_print("network_vlan_ranges' format is not correct.\n")
            exit(1)
        self.physnet = match.group(1)
        self.lower_vlan = match.group(2)
        self.upper_vlan = match.group(3)

        # bcf controller information
        self.bcf_controllers = config['bcf_controllers']
        self.bcf_controller_ips = []
        for controller in self.bcf_controllers:
            ip = controller.split(':')[0]
            self.bcf_controller_ips.append(ip)
        self.bcf_controller_user = config['bcf_controller_user']
        self.bcf_controller_passwd = config['bcf_controller_passwd']
        self.bcf_openstack_management_tenant = config.get(
            'bcf_openstack_management_tenant')

        # ivs pkg and debug pkg
        self.ivs_pkg_map = {}
        self.ivs_url_map = {}
        if config['ivs_packages']:
            for ivs_url in config['ivs_packages']:
                ivs_pkg = os.path.basename(ivs_url)
                if '.rpm' in ivs_pkg and 'debuginfo' not in ivs_pkg:
                    self.ivs_url_map['rpm'] = ivs_url
                    self.ivs_pkg_map['rpm'] = ivs_pkg
                elif '.rpm' in ivs_pkg and 'debuginfo' in ivs_pkg:
                    self.ivs_url_map['debug_rpm'] = ivs_url
                    self.ivs_pkg_map['debug_rpm'] = ivs_pkg
                elif '.deb' in ivs_pkg and 'dbg' not in ivs_pkg:
#.........这里部分代码省略.........
开发者ID:xinwu,项目名称:bosi,代码行数:103,代码来源:environment.py


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