Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some commands require further input after sending remote commands. #780

Open
chengxiang1997 opened this issue Oct 17, 2024 · 1 comment
Open

Comments

@chengxiang1997
Copy link

Some commands require further input after sending remote commands. What can I do if I'm using TestInfra?
For example, when I input mkfs.ext4 /dev/sdb, it prompts the following content:

[root@localhost ~]# mkfs.ext4 /dev/sdb
mke2fs 1.42.9 (28-Dec-2013)
/dev/sdb is entire device, not just one partition!
Proceed anyway? (y,n)

If I want to further input y through a Python script, how can I do that?"

@narmaku
Copy link
Contributor

narmaku commented Oct 17, 2024

This is not an issue with this project itself, but with the fact that you are trying to run a command that requires interaction with the end user to confirm next steps.

This is a common situation when you try to run commands remotely (such as pytest-testinfra does) since they use non-interactive shell (as everything is run programmatically).

To solve this, you may need to explore ways to force the command to be executed without asking you for confirmation. E.g. some commands provide the -y option to auto-approve operations.

You may consult the man page of mkfs to see which option suites your needs: https://linux.die.net/man/8/mkfs.ext4 (maybe the -F opt)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants