Skip to content

'abort_on_prompts' overrides warn_only = True #762

@pkittenis

Description

@pkittenis

Trying to use both abort_on_prompts and warn_only = True makes abort_on_prompts override warn_only and fabric still throws a SystemExit

In [6]: from fabric.api import sudo, execute, cd, env, run, local

In [7]: with settings(warn_only = True):
    result = local("ls -ltrh")
   ...:     
[localhost] local: ls -ltrh
total 188K
In [8]: with settings(warn_only = True):
    result = local("ls -ltrh /tmp/tartratrat")
   ...:     
[localhost] local: ls -ltrh /tmp/tartratrat
ls: cannot access /tmp/tartratrat: No such file or directory

Warning: local() encountered an error (return code 2) while executing 'ls -ltrh /tmp/tartratrat'


In [9]: env['abort_on_prompts'] = True

In [10]: with settings(warn_only = True):
    result = local("ls -ltrh /tmp/tartratrat")
   ....:     
[localhost] local: ls -ltrh /tmp/tartratrat
ls: cannot access /tmp/tartratrat: No such file or directory

Warning: local() encountered an error (return code 2) while executing 'ls -ltrh /tmp/tartratrat'


In [11]: with settings(warn_only = True):
    result = run("ls -ltrh /tmp/tartratrat")
   ....:     

Fatal error: Needed to prompt for the target host connection string, but abort-on-prompts was set to True

Aborting.
An exception has occurred, use %tb to see the full traceback.

SystemExit: 1
To exit: use 'exit', 'quit', or Ctrl-D.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions