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


Python Environment.list_all方法代码示例

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


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

示例1: update

# 需要导入模块: from devops.models import Environment [as 别名]
# 或者: from devops.models.Environment import list_all [as 别名]
def update():
    from os import environ
    from devops.models import Environment

    environ.setdefault("DJANGO_SETTINGS_MODULE", "devops.settings")

    with open("hosts.pp", "w") as pp:
        for e in Environment.list_all():
            ip = e.nodes().admin.get_ip_address_by_network_name(e.admin_net)
            pp.write("host {{ '{}': ip => '{}' }}\n".format(e.name, ip))

    local("sudo puppet apply hosts.pp")
开发者ID:nikitamarchenko,项目名称:mazut,代码行数:14,代码来源:fabfile.py

示例2: _create_env_from_config

# 需要导入模块: from devops.models import Environment [as 别名]
# 或者: from devops.models.Environment import list_all [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: do_list

# 需要导入模块: from devops.models import Environment [as 别名]
# 或者: from devops.models.Environment import list_all [as 别名]
    def do_list(self):
        env_list = Environment.list_all().values("name", "created")
        columns = []
        for env in env_list:
            column = collections.OrderedDict({"NAME": env["name"]})
            if self.params.list_ips:
                cur_env = Environment.get(name=env["name"])
                admin_ip = ""
                if "admin" in [node.name for node in cur_env.get_nodes()]:
                    admin_ip = cur_env.get_node(name="admin").get_ip_address_by_network_name("admin")
                column["ADMIN IP"] = admin_ip
            if self.params.timestamps:
                column["CREATED"] = env["created"].strftime("%Y-%m-%d_%H:%M:%S")
            columns.append(column)

        self.print_table(headers="keys", columns=columns)
开发者ID:TracyHe,项目名称:fuel-devops,代码行数:18,代码来源:shell.py

示例4: do_create

# 需要导入模块: from devops.models import Environment [as 别名]
# 或者: from devops.models.Environment import list_all [as 别名]
 def do_create(self):
     env_name = self.params.name
     for env in Environment.list_all():
         if env.name == env_name:
             print("Please, set another environment name")
             raise SystemExit()
     self.env = Environment.create(env_name)
     networks, prefix = self.params.net_pool.split(":")
     Network.default_pool = Network.create_network_pool(networks=[ipaddr.IPNetwork(networks)], prefix=int(prefix))
     networks = Network.create_networks(environment=self.env)
     admin_node = self.admin_add(networks=networks)
     self.do_slave_add(force_define=False)
     self.env.define()
     admin_node.disk_devices.get(device="cdrom").volume.upload(self.params.iso_path)
     for net in self.env.get_networks():
         net.start()
开发者ID:TracyHe,项目名称:fuel-devops,代码行数:18,代码来源:shell.py

示例5: do_list

# 需要导入模块: from devops.models import Environment [as 别名]
# 或者: from devops.models.Environment import list_all [as 别名]
    def do_list(self):
        env_list = Environment.list_all().values('name', 'created')
        columns = []
        for env in env_list:
            column = collections.OrderedDict({'NAME': env['name']})
            if self.params.list_ips:
                cur_env = Environment.get(name=env['name'])
                admin_ip = ''
                if 'admin' in [node.name for node in cur_env.get_nodes()]:
                    admin_ip = (cur_env.get_node(name='admin').
                                get_ip_address_by_network_name('admin'))
                column['ADMIN IP'] = admin_ip
            if self.params.timestamps:
                column['CREATED'] = env['created'].strftime(
                    '%Y-%m-%d_%H:%M:%S')
            columns.append(column)

        self.print_table(headers="keys", columns=columns)
开发者ID:jeromeshi,项目名称:fuel-devops,代码行数:20,代码来源:shell.py

示例6: tearDown

# 需要导入模块: from devops.models import Environment [as 别名]
# 或者: from devops.models.Environment import list_all [as 别名]
 def tearDown(self):
     for environment in Environment.list_all():
         environment.erase()
开发者ID:asledzinskiy,项目名称:fuel-devops,代码行数:5,代码来源:test_manager.py


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