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


Python Environment.create_environment方法代码示例

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


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

示例1: setUp

# 需要导入模块: from devops.models import Environment [as 别名]
# 或者: from devops.models.Environment import create_environment [as 别名]
    def setUp(self):
        super(TestLibvirtTemplate, self).setUp()

        # speed up retry
        self.sleep_mock = self.patch('time.sleep')

        # mock open
        self.open_mock = mock.mock_open(read_data='image_data')
        self.patch('devops.driver.libvirt.libvirt_driver.open',
                   self.open_mock, create=True)

        self.os_mock = self.patch('devops.helpers.helpers.os')
        self.os_mock.urandom = os.urandom
        # noinspection PyPep8Naming
        Size = collections.namedtuple('Size', ['st_size'])
        self.file_sizes = {
            '/tmp/admin.iso': Size(st_size=500),
        }
        self.os_mock.stat.side_effect = self.file_sizes.get

        # Create Environment
        self.full_conf = yaml.load(ENV_TMPLT)
        self.env = Environment.create_environment(self.full_conf)

        self.d = self.env.get_group(name='rack-01').driver
开发者ID:openstack,项目名称:fuel-devops,代码行数:27,代码来源:test_template.py

示例2: _create_env_from_config

# 需要导入模块: from devops.models import Environment [as 别名]
# 或者: from devops.models.Environment import create_environment [as 别名]
    def _create_env_from_config(self, config):
        env_name = config['template']['devops_settings']['env_name']
        for env in Environment.list_all():
            if env.name == env_name:
                print("Please, set another environment name")
                raise SystemExit()

        self.env = Environment.create_environment(config)
        self.env.define()

        # Start all l2 network devices
        for group in self.env.get_groups():
            for net in group.get_l2_network_devices():
                net.start()
开发者ID:TregubovYury,项目名称:fuel-devops,代码行数:16,代码来源:shell.py

示例3: d_env

# 需要导入模块: from devops.models import Environment [as 别名]
# 或者: from devops.models.Environment import create_environment [as 别名]
 def d_env(self):
     if self._virt_env is None:
         if not self._config:
             try:
                 return Environment.get(name=settings.ENV_NAME)
             except Exception:
                 self._virt_env = Environment.describe_environment(boot_from=settings.ADMIN_BOOT_DEVICE)
                 self._virt_env.define()
         else:
             try:
                 return Environment.get(name=self._config["template"]["devops_settings"]["env_name"])
             except Exception:
                 self._virt_env = Environment.create_environment(full_config=self._config)
                 self._virt_env.define()
     return self._virt_env
开发者ID:asledzinskiy,项目名称:fuel-qa,代码行数:17,代码来源:environment.py

示例4: setUp

# 需要导入模块: from devops.models import Environment [as 别名]
# 或者: from devops.models.Environment import create_environment [as 别名]
    def setUp(self):
        super(TestIPMITemplate, self).setUp()

        # Create Environment
        self.full_conf = yaml.load(ENV_TMPLT)
        self.env = Environment.create_environment(self.full_conf)
        self.ipmiclient_mock = self.patch(
            'devops.driver.baremetal.ipmi_client.IpmiClient')
        self.wait_mock = self.patch(
            'devops.helpers.helpers.wait')
        self.ipmiclient1 = mock.Mock(spec=IpmiClient)
        self.ipmiclient2 = mock.Mock(spec=IpmiClient)

        def get_client(*args):
            """Tricky way to return necessary node """
            if args and args[6] == 'slave-01':
                return self.ipmiclient1
            elif args and args[6] == 'slave-02':
                return self.ipmiclient2

        self.ipmiclient_mock.side_effect = get_client
开发者ID:openstack,项目名称:fuel-devops,代码行数:23,代码来源:test_ipmi_template.py

示例5: define_from_config

# 需要导入模块: from devops.models import Environment [as 别名]
# 或者: from devops.models.Environment import create_environment [as 别名]
def define_from_config(conf):
    env = Environment.create_environment(conf)
    env.define()
    env.start()
    print get_ips(env)
开发者ID:pigmej,项目名称:solar,代码行数:7,代码来源:env.py


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