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


Python Host.implicit方法代码示例

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


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

示例1: _create_implicit_localhost

# 需要导入模块: from ansible.inventory.host import Host [as 别名]
# 或者: from ansible.inventory.host.Host import implicit [as 别名]
    def _create_implicit_localhost(self, pattern):

        if self.localhost:
            new_host = self.localhost
        else:
            new_host = Host(pattern)

            # use 'all' vars but not part of all group
            new_host.vars = self.groups['all'].get_vars()

            new_host.address = "127.0.0.1"
            new_host.implicit = True

            if "ansible_python_interpreter" not in new_host.vars:
                py_interp = sys.executable
                if not py_interp:
                    # sys.executable is not set in some cornercases.  #13585
                    py_interp = '/usr/bin/python'
                    display.warning('Unable to determine python interpreter from sys.executable. Using /usr/bin/python default. '
                                    'You can correct this by setting ansible_python_interpreter for localhost')
                new_host.set_variable("ansible_python_interpreter", py_interp)

            if "ansible_connection" not in new_host.vars:
                new_host.set_variable("ansible_connection", 'local')

            self.localhost = new_host

        return new_host
开发者ID:ernstp,项目名称:ansible,代码行数:30,代码来源:data.py

示例2: _create_implicit_localhost

# 需要导入模块: from ansible.inventory.host import Host [as 别名]
# 或者: from ansible.inventory.host.Host import implicit [as 别名]
 def _create_implicit_localhost(self, pattern='localhost'):
     new_host = Host(pattern)
     new_host.address = "127.0.0.1"
     new_host.implicit = True
     new_host.vars = self.get_host_vars(new_host)
     new_host.set_variable("ansible_connection", "local")
     if "ansible_python_interpreter" not in new_host.vars:
         py_interp = sys.executable
         if not py_interp:
             # sys.executable is not set in some cornercases.  #13585
             display.warning('Unable to determine python interpreter from sys.executable. Using /usr/bin/python default. You can correct this by setting ansible_python_interpreter for localhost')
             py_interp = '/usr/bin/python'
         new_host.set_variable("ansible_python_interpreter", py_interp)
     self.get_group("ungrouped").add_host(new_host)
     return new_host
开发者ID:LukeInkster,项目名称:PythonCorpus,代码行数:17,代码来源:__init__.py

示例3: _create_implicit_localhost

# 需要导入模块: from ansible.inventory.host import Host [as 别名]
# 或者: from ansible.inventory.host.Host import implicit [as 别名]
    def _create_implicit_localhost(self, pattern):

        if self.localhost:
            new_host = self.localhost
        else:
            new_host = Host(pattern)

            new_host.address = "127.0.0.1"
            new_host.implicit = True

            # set localhost defaults
            py_interp = sys.executable
            if not py_interp:
                # sys.executable is not set in some cornercases. see issue #13585
                py_interp = '/usr/bin/python'
                display.warning('Unable to determine python interpreter from sys.executable. Using /usr/bin/python default. '
                                'You can correct this by setting ansible_python_interpreter for localhost')
            new_host.set_variable("ansible_python_interpreter", py_interp)
            new_host.set_variable("ansible_connection", 'local')

            self.localhost = new_host

        return new_host
开发者ID:awiddersheim,项目名称:ansible,代码行数:25,代码来源:data.py


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