可以预期模块抛出错误模块失败解析:失败。

时间:2022-09-15 23:00:27

my playbook is like

我的剧本就像

- name: configuring pdf harmony
  expect:
  command: ./install.sh
   responses:
     'This will install pdfharmony on your system. Do you want to continue[y/N]?': y
     'Do you agree with this copyright? [y/N]': y
     'Now you must enter a valid registration number:': XXXX-XXXX-XXXX-XXXX-XXXX
  echo: yes
  args:
    chdir: '{{ dest_dir }}/pdfHarmony_20_L26_64'
  become: yes

Error:

错误:

fatal: [10.135.232.213]: FAILED! => {"changed": true, "cmd": "./install.sh", 
"delta": "0:00:30.186764", "end": "2016-08-12 14:02:23.384237", "failed": 
true, "invocation": {"module_args": {"chdir": 
"/usr/local/pdfHarmony_20_L26_64", "command": "./ 
mounted or mapped drive. You may not copy the software to use for ", 
"development, testing or staging purposes.", "", "1.  Restrictions:  You may 
not resell, transfer, rent or lease the Software ", "without the specific 
agreement of Appligent. You may not reverse engineer, ", "\u001b[7m--More--
\u001b[27m"]}

I could not understand the cause of this error when installing manually, Here when you pass y to the first prompt, you get a copyright agreement which is more than a page and you will find --More-- at the end of the page and when keep on pressing enter last line of the agreement the second prompt(question appears) like when you press y for 1st prompt you see this then you press more after pressing more at last you see this then it asks for reg. keys

我听不懂的原因这个错误安装手动时,当你通过y第一个提示,你会得到一个版权协议不仅仅是一个页面,你会发现——更多的页面,当继续按输入协议的最后一行第二个提示(比如当你按y问题出现),1日提示你看到这个新闻更紧迫之后终于看到这个要求注册。键

Update: it is like not listening to my next response after more.. i am not able to understand how this is happening it is not taking my response for 'Do you agree with this copyright? [y/N]': y

更新:这就像是不听我的下一个回复。我无法理解这是怎么发生的它并没有回应我的回应“你同意这个版权吗?”[y / N]”:y

i have added more and now it looks like

我增加了更多,现在看起来。

- name: configuring pdf harmony
  expect:
  command: ./install.sh
  responses:
  'This will install pdfharmony on your system. Do you want to continue[y/N]?': y
  '--More--': \r
  '(?i)Do you agree with this copyright? [y/N]': y
  'Now you must enter a valid registration number': XXXX-XXXX-XXXX-XXXX-XXXX
   echo: yes
   args:
    chdir: '{{ dest_dir }}/pdfHarmony_20_L26_64'
   become: yes

But now it fails at next response it doesn't take the next response and i don't know why it fails at:

但是现在它在下一次响应中失败了它没有接受下一个响应我不知道为什么它失败了:

"\u001b[7m--More--\u001b[27m\u0007\u0007", "Updates may be licensed to you 
by Appligent with additional or different terms.", "", "Do you agree with 
this copyright? [y/N] : "]}

There is a new error with the module and i can make nothing out of it, ichanghed the play to :

这个模块出现了一个新的错误,我无法从中做出任何改变,我把这个游戏变成了:

- name: configuring stamp pdf batch
  expect:
  command: /bin/bash -c "stty rows 2000,2000; ./install.sh"
  responses:
  'This will install stamppdf on your system. Do you want to continue[y/N]?': y
  #    '--More--': \r
 '(?i)Do you agree with this copyright\? \[y/N\]': y
 'AP_FONT_DIR [/usr/local/fonts]': y
 'Now you must enter a valid registration number': '{{ stamp_pdf_key }}'
 echo: yes
 args:
 chdir: '{{ dest_dir }}/StampPDFBatch_60_L26_64'
 become: yes

the error is:

错误的是:

fatal: [10.135.232.213]: FAILED! => {"changed": false, "failed": true, 
"invocation": {"module_name": "expect"}, "module_stderr": "", 
"module_stdout": "Traceback (most recent call last):\r\n  File 
\"/tmp/ansible_V_modk/ansible_module_expect.py\", line 230, in <module>\r\n
main()\r\n  File \"/tmp/ansible_V_modk/ansible_module_expect.py\", line 199,
in main\r\n    events=events, cwd=chdir, echo=echo)\r\n  File 
\"/usr/lib/python2.6/site-packages/pexpect/__init__.py\", line 225, in 
runu\r\n    env=env, _spawn=spawnu, **kwargs)\r\n  File 
\"/usr/lib/python2.6/site-packages/pexpect/__init__.py\", line 246, in 
_run\r\n    index = child.expect(patterns)\r\n  File 
\"/usr/lib/python2.6/site-packages/pexpect/__init__.py\", line 1451, in 
expect\r\n    timeout, searchwindowsize)\r\n  File 
\"/usr/lib/python2.6/site-packages/pexpect/__init__.py\", line 1466, in 
expect_list\r\n    timeout, searchwindowsize)\r\n  File 
\"/usr/lib/python2.6/site-packages/pexpect/__init__.py\", line 1535, in 
expect_loop\r\n    c = self.read_nonblocking(self.maxread, timeout)\r\n  
File \"/usr/lib/python2.6/site-packages/pexpect/__init__.py\", line 984, in 
read_nonblocking\r\n    s = self._coerce_read_string(s)\r\n  File 
\"/usr/lib/python2.6/site-packages/pexpect/__init__.py\", line 1797, in 
_coerce_read_string\r\n    return self._decoder.decode(s, final=False)\r\n 
 File \"/usr/lib64/python2.6/codecs.py\", line 296, in decode\r\n    
(result, consumed) = self._buffer_decode(data, self.errors, 
final)\r\nUnicodeDecodeError: 'utf8' codec can't decode byte 0xd2 in 
position 1166: invalid continuation byte\r\n", "msg": "MODULE FAILURE", 
"parsed": false}

1 个解决方案

#1


0  

You can try to alter TTY height and avoid 'More'-thing:

你可以试着改变TTY的高度,避免“更多”:

command: /bin/bash -c "stty rows 2000,2000; ./install.sh"

#1


0  

You can try to alter TTY height and avoid 'More'-thing:

你可以试着改变TTY的高度,避免“更多”:

command: /bin/bash -c "stty rows 2000,2000; ./install.sh"