python - How to force bdutil command to run as root? -


i starting google compute engine vm app engine application. start-up scripts gce vm run python scripts which, in turn, make os.system calls bdutil commands, e.g.,

os.system("bdutil --bucket <bucket> --num_workers 1 "           "--env_var_files hadoop2_env.sh --default_fs hdfs "           "--zone us-central1-b --prefix <name> --force deploy") 

i have found necessary run these scripts root, e.g.,

sudo python script.py 

the --force deploy command option works expected, i.e., shell terminal shows:

deploy cluster following settings? .... (y/n) y 

however, prompt included:

are sure want run command root? (y/n) 

i have found need execute these scripts root, executing them remotely , cannot respond terminal prompts.

how can force execution of bdutil command without responding final prompt? modification of bdutil source code not viable option.

thanks report, bug in bdutil, , in normal circumstances should indeed apply -f or --force flags confirmation prompts, not standard deploy/delete prompts. i've filed https://github.com/googlecloudplatform/bdutil/issues/31 track issue.

in meantime, should able workaround using linux yes command, commonly used ad-hoc --force flag commands don't include such flag directly:

os.system("yes | bdutil --bucket <bucket> --num_workers 1 "           "--env_var_files hadoop2_env.sh --default_fs hdfs "           "--zone us-central1-b --prefix <name> --force deploy") 

Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -