I don’t seem to be getting the expected workings. I can’t seem to actually catch the prompt.
Here is what I have:
with settings(hide('commands', 'warnings') , warn_only=True):
prompts = expect('Are you sure you want to perform this operation? [Y/N]:', 'N')
with expecting(prompts):
run(sudo("/something.sh apply /some.file" , user="someuser"))
I’m pretty sure I’m doing something wrong.
I have edited your code with some minor things:
expectingrequires a listYou have to escape regexp symbols, such as
[]with a slash\[or just make the ‘expectation’ shorter:Also, perhaps you should not
hide('commands'), depending on what promptsomething.shuses.