无法为 vagrant box 执行结构脚本

Unable to execute fabric script for vagrant box

我正在尝试 运行 一个正在将数据上传到 vagrant box 中的 postgres 数据库中的结构脚本。同一个脚本在几个月前 运行ning 很好,没有任何改变。但是这次当我从我的主机执行脚本时:

./pipeline-import.sh

但后来我遇到了一个奇怪的行为。 首先,我被要求为 vagrant 用户输入密码,而在此之前我从未被要求输入密码。在我输入默认通行证后:vagrant 我收到这些错误:

Loaded environment from env/dev.yml
[localhost:2222] Executing task 'pipeline_sql_schemas'
Continue (y/n)? y
[localhost:2222] sudo: echo 'CREATE SCHEMA IF NOT EXISTS gaul;' | PGPASSWORD='xxxx' psql -U user -d user_db
[localhost:2222] Login password for 'vagrant': 
 No handlers could be found for logger "paramiko.transport"

 Fatal error: No existing session

 Underlying exception:
   No existing session

 Aborting.

当您被询问时 Login password for 'vagrant':,它不会发生在您自己的终端中。因此,如果您输入任何内容(即使是正确的密码),也会导致错误,就像您遇到的那样。

解决此问题的一种方法是在 env 变量中声明您的默认密码以及 VM 的用户名