當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。