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


Python Interpreter.do_set方法代码示例

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


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

示例1: test_set_complex_args_deprecated

# 需要导入模块: from ansibledebugger.interpreter.simple_interpreter import Interpreter [as 别名]
# 或者: from ansibledebugger.interpreter.simple_interpreter.Interpreter import do_set [as 别名]
    def test_set_complex_args_deprecated(self, mock_stdout):
        interpreter = Interpreter(TaskInfo('', '', None, None),
                                  ErrorInfo(), None)

        key = 'key1'
        value = 'v1'
        interpreter.do_set('complex_args %s %s' % (key, value))

        self.assertIn('deprecated', mock_stdout.getvalue())
开发者ID:logic855,项目名称:ansible-playbook-debugger,代码行数:11,代码来源:interpreter_test.py

示例2: test_set_module_args_replace_all

# 需要导入模块: from ansibledebugger.interpreter.simple_interpreter import Interpreter [as 别名]
# 或者: from ansibledebugger.interpreter.simple_interpreter.Interpreter import do_set [as 别名]
    def test_set_module_args_replace_all(self, mock_stdout):
        module_args = 'shell_command key1=v1 key2=v2'
        interpreter = Interpreter(TaskInfo('', module_args, None, None),
                                  ErrorInfo(), None)

        value = 'new_command key1=new_v1'
        interpreter.do_set('module_args . %s' % (value))

        self.assertEqual(value, interpreter.task_info.module_args)
开发者ID:logic855,项目名称:ansible-playbook-debugger,代码行数:11,代码来源:interpreter_test.py

示例3: test_set_complex_args_replace_all

# 需要导入模块: from ansibledebugger.interpreter.simple_interpreter import Interpreter [as 别名]
# 或者: from ansibledebugger.interpreter.simple_interpreter.Interpreter import do_set [as 别名]
    def test_set_complex_args_replace_all(self, mock_stdout):
        complex_args = {'key1': 'v1'}
        interpreter = Interpreter(TaskInfo('', '', None, complex_args),
                                  ErrorInfo(), None)

        key = '.'
        value = '{"key2": "v2"}'
        interpreter.do_set('complex_args %s %s' % (key, value))

        expect = {'key2': 'v2'}
        self.assertEqual(interpreter.task_info.complex_args, expect)
开发者ID:logic855,项目名称:ansible-playbook-debugger,代码行数:13,代码来源:interpreter_test.py

示例4: test_set_complex_args_list_access

# 需要导入模块: from ansibledebugger.interpreter.simple_interpreter import Interpreter [as 别名]
# 或者: from ansibledebugger.interpreter.simple_interpreter.Interpreter import do_set [as 别名]
    def test_set_complex_args_list_access(self, mock_stdout):
        complex_args = {'key1': ['v1', 'v2']}
        interpreter = Interpreter(TaskInfo('', '', None, complex_args),
                                  ErrorInfo(), None)

        key = 'key1[1]'
        value = '{"key2": "v2"}'
        interpreter.do_set('complex_args %s %s' % (key, value))

        expect = {'key1': ['v1', {'key2': 'v2'}] }
        self.assertEqual(interpreter.task_info.complex_args, expect)
开发者ID:logic855,项目名称:ansible-playbook-debugger,代码行数:13,代码来源:interpreter_test.py

示例5: test_set_complex_args_add_json_sibling

# 需要导入模块: from ansibledebugger.interpreter.simple_interpreter import Interpreter [as 别名]
# 或者: from ansibledebugger.interpreter.simple_interpreter.Interpreter import do_set [as 别名]
    def test_set_complex_args_add_json_sibling(self, mock_stdout):
        complex_args = {'key1': 'v1'}
        interpreter = Interpreter(TaskInfo('', '', None, complex_args),
                                  ErrorInfo(), None)

        key = 'key1.key2'
        value = '{"key3": "v3"}'
        interpreter.do_set('complex_args %s %s' % (key, value))

        expect = {'key1': {'key2': {'key3': 'v3'} } }
        self.assertEqual(interpreter.task_info.complex_args, expect)
开发者ID:logic855,项目名称:ansible-playbook-debugger,代码行数:13,代码来源:interpreter_test.py

示例6: test_set_module_args_replace_skip_quote

# 需要导入模块: from ansibledebugger.interpreter.simple_interpreter import Interpreter [as 别名]
# 或者: from ansibledebugger.interpreter.simple_interpreter.Interpreter import do_set [as 别名]
    def test_set_module_args_replace_skip_quote(self, mock_stdout):
        module_args = 'shell_command "key1=v1" key2=v2'
        interpreter = Interpreter(TaskInfo('', module_args, None, None),
                                  ErrorInfo(), None)

        key = 'key1'
        value = 'v1'
        interpreter.do_set('module_args %s %s' % (key, value))

        expected_kv = 'shell_command "key1=v1" key2=v2 %s=%s' % (key, value)
        self.assertEqual(expected_kv, interpreter.task_info.module_args)
开发者ID:logic855,项目名称:ansible-playbook-debugger,代码行数:13,代码来源:interpreter_test.py

示例7: test_set_module_args_replace_template

# 需要导入模块: from ansibledebugger.interpreter.simple_interpreter import Interpreter [as 别名]
# 或者: from ansibledebugger.interpreter.simple_interpreter.Interpreter import do_set [as 别名]
    def test_set_module_args_replace_template(self, mock_stdout):
        module_args = '{{ command }} key1={{ var1 }} key2=v2'
        interpreter = Interpreter(TaskInfo('', module_args, None, None),
                                  ErrorInfo(), None)

        key = 'key1'
        value = '{{ var2 }}'
        interpreter.do_set('module_args %s %s' % (key, value))

        expected_kv = '{{ command }} %s=%s key2=v2' % (key, value)
        self.assertEqual(expected_kv, interpreter.task_info.module_args)
开发者ID:logic855,项目名称:ansible-playbook-debugger,代码行数:13,代码来源:interpreter_test.py

示例8: test_set_module_args_add

# 需要导入模块: from ansibledebugger.interpreter.simple_interpreter import Interpreter [as 别名]
# 或者: from ansibledebugger.interpreter.simple_interpreter.Interpreter import do_set [as 别名]
    def test_set_module_args_add(self, mock_stdout):
        module_args = 'key1=v1 key2=v2'
        interpreter = Interpreter(TaskInfo('', module_args, None, None),
                                  ErrorInfo(), None)

        key = 'key3'
        value = 'v3'
        interpreter.do_set('module_args %s %s' % (key, value))

        expected_kv = '%s %s=%s' % (module_args, key, value)
        self.assertEqual(expected_kv, interpreter.task_info.module_args)
开发者ID:logic855,项目名称:ansible-playbook-debugger,代码行数:13,代码来源:interpreter_test.py


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