Installation 厨师配方-Ubuntu上DropBox安装的交互式响应
我是chef的新手,正在尝试学习如何通过CLI提供安装脚本的答案。我运气不太好,希望能得到一些帮助Installation 厨师配方-Ubuntu上DropBox安装的交互式响应,installation,chef-infra,ubuntu-16.04,dropbox,recipe,Installation,Chef Infra,Ubuntu 16.04,Dropbox,Recipe,我是chef的新手,正在尝试学习如何通过CLI提供安装脚本的答案。我运气不太好,希望能得到一些帮助 bash 'DropboxInstall' do user 'root' cwd '/opt/dropbox' code <<-EOH dropbox start -i expect "Starting Dropbox...\rDropbox is the easiest way to share and store your files
bash 'DropboxInstall' do
user 'root'
cwd '/opt/dropbox'
code <<-EOH
dropbox start -i
expect "Starting Dropbox...\rDropbox is the easiest way to share and store your files online. Want to learn more? Head to https://www.dropbox.com/\rIn order to use Dropbox, you must download the proprietary daemon. [y/n]"
send "y\r"
dropbox autostart y
EOH
end
Chef脚本正在完成安装,但当它尝试从CLI执行“expect”时,它将停止:
Dropbox is the easiest way to share and store your files online. Want to learn more? Head to https://www.dropbox.com/
In order to use Dropbox, you must download the proprietary daemon. [y/n] Traceback (most recent call last):
File "/usr/bin/dropbox", line 1404, in start
download()
File "/usr/bin/dropbox", line 547, in download
if not yes_no_question("%s%s" % (WARNING, GPG_WARNING_MSG)):
File "/usr/bin/dropbox", line 138, in yes_no_question
text = raw_input()
EOFError: EOF when reading a line
****/tmp/chef-script20180423-29717-15l42km: line 2: expect: command not found
/tmp/chef-script20180423-29717-15l42km: line 3: send: command not found****
[2018-04-23T07:48:54+00:00] INFO: bash[DropboxInstall] ran successfully
- execute "bash" "/tmp/chef-script20180423-29717-15l42km"
我毫不怀疑是我,但我读了一些书,不知道如何最好地解决这个问题。看起来当它尝试执行bash脚本时,它有问题,但我尝试了“cat/tmp/chef-script20180423-29717-15l42km”它不在那里,所以我不确定如何解决这个问题
提前谢谢 文件'/tmp/dropbox.sh'do
file '/tmp/dropbox.sh' do
mode '0755'
owner 'root'
group 'root'
content 'puts "Running Dropbox Installer..."
log_user 0
spawn dropbox start -i
expect {
"*In order to use Dropbox, you must download the proprietary daemon*" {send "y\r"}
}
exec sleep 360
puts "Dropbox installer completed"'
end
bash 'DropboxInstall' do
user 'root'
cwd '/tmp'
code <<-EOF
/usr/bin/expect -d dropbox.sh
EOF
end
模式“0755”
所有者“根”
“根”组
内容“放置”正在运行Dropbox安装程序
日志用户0
繁殖dropbox开始-i
期待{
*要使用Dropbox,必须下载专有守护程序*“{send“y\r”}
}
高级睡眠360
将“Dropbox安装程序已完成”
结束
bash“DropboxInstall”do
用户“根”
cwd'/tmp'
代码:在显示实际失败的代码之前,您切断了错误信息。您好,感谢您的响应,我更新了整个调试块。如果您有任何想法,我们将不胜感激。另外,“为了使用Dropbox,您必须下载专有的守护进程。”提示会在30秒后出现吗?谢谢您似乎试图混合使用shell命令和expect命令?你有一个bash脚本,所以它按顺序运行命令,而不是TTY。嗨,coderanger,谢谢!我最后有点作弊,使用了expect和TCL。根据我所读到的,这并不是最好或推荐的方法,但Dropbox安装程序没有应答文件或无人参与安装选项:-/谢谢,伙计,我很感激!如果这对其他人有帮助,请随意使用:
file '/tmp/dropbox.sh' do
mode '0755'
owner 'root'
group 'root'
content 'puts "Running Dropbox Installer..."
log_user 0
spawn dropbox start -i
expect {
"*In order to use Dropbox, you must download the proprietary daemon*" {send "y\r"}
}
exec sleep 360
puts "Dropbox installer completed"'
end
bash 'DropboxInstall' do
user 'root'
cwd '/tmp'
code <<-EOF
/usr/bin/expect -d dropbox.sh
EOF
end