Thanks a lot Matt, it worked. I was confused a bit because I saw that p/expect actually found the match (both of them), so I did not think that it could be regex issue
Thanks again Edgars piektdiena, 2015. gada 4. septembris 14:01:06 UTC+2, Matt Martz rakstīja: > > I believe the problem is that pexpect treats all matches as regex. You > have specified '#?' which means the # is optional, effectively making the > regex an empty string. > > An empty string matches anything, so pexpect will send the response for > '#?' for everything. > > You probably want: > > responses: > '#\? ': '5' > "\[y/N\]": 'y' > > I think that should like help out. > > On Friday, September 4, 2015, Edgars <edgars.ma > [email protected] <javascript:>> wrote: > >> Hi >> >> I have this task: >> >> tasks: >> - expect: >> command: /path/to/bash/script.sh >> responses: >> '#? ': '5' >> "[y/N]": 'y' >> >> expect module correctly responds to first prompt, but not to second. It >> responds to second prompt with '5' when it should respond with 'y'. >> >> When I enable echo=yes, I see: >> >> ... >> "#? 5" >> >> "[y/N]5" >> >> ... >> >> You can easily reproduce it with bash script and two echo/read >> >> Edgars >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Ansible Project" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/704f6fd4-b7d0-464f-a868-07ab18ba9848%40googlegroups.com >> >> <https://groups.google.com/d/msgid/ansible-project/704f6fd4-b7d0-464f-a868-07ab18ba9848%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > > -- > Matt Martz > @sivel > sivel.net > > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/38836b62-52df-410d-85fd-950ec0b08802%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
