cpo@LR5.wue4# python3 Python 3.11.2 (main, Nov 30 2024, 21:22:50) [GCC 12.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> from vyos.utils.io import is_interactive >>> is_interactive() True
But when run form a conf_mode script under vyos-configd.service this will evaluate to False. I think vyos-configd should be aware if it's in interactive user session, or non-interfactive like API calls or system bootup
May 04 07:23:31 vyos-configd[14249]: Received message: {"type": "init"}
May 04 07:23:31 vyos-configd[14249]: config session pid is 3903
May 04 07:23:31 vyos-configd[14249]: config session sudo_user is cpo
May 04 07:23:31 vyos-configd[14249]: commit_scripts: ['pki', 'load-balancing_haproxy']
May 04 07:23:31 vyos-configd[14249]: Received message: {"type": "node", "last": false, "data": "/usr/libexec/vyos/conf_mode/pki.py"}
May 04 07:23:31 /usr/libexec/vyos/services/vyos-configd[14249]: Interactive? FalseAs there is yet no script under config mode which uses is_interactive() it would be safe to change. The first occurance where this could be used is during implementation of T7122
When not running under vyos-configd there seems to be an IO issue (my suspect would be airbag)
Traceback (most recent call last):
File "/usr/libexec/vyos/conf_mode/pki.py", line 585, in <module>
verify(c)
File "/usr/libexec/vyos/conf_mode/pki.py", line 385, in verify
certbot_request(name, cert_conf['acme'])
File "/usr/libexec/vyos/conf_mode/pki.py", line 146, in certbot_request
log.info(f"Interactive? {is_interactive()}")
^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/vyos/utils/io.py", line 81, in is_interactive
return os.getenv('TERM', default=False) and sys.stderr.isatty() and sys.stdout.isatty()
^^^^^^^^^^^^^^^^^
AttributeError: '_IO' object has no attribute 'isatty'