我是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 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
im获取的错误是:
* bash[DropboxInstall] action run[2018-04-23T07:47:53+00:00] INFO: Processing bash[DropboxInstall] action run (dropbox::default line 24)
[2018-04-23T07:47:53+00:00] DEBUG: Providers for generic bash resource enabled on node include: [Chef::Provider::Script]
[2018-04-23T07:47:53+00:00] DEBUG: Provider for action run on resource bash[DropboxInstall] is Chef::Provider::Script
[execute] Starting Dropbox...dropbox: locating interpreter
dropbox: logging to /tmp/dropbox-antifreeze-umikIQ
dropbox: initializing
dropbox: initializing python 2.7.11
dropbox: setting program path '/root/.dropbox-dist/dropbox-lnx.x86_64-47.4.74/dropbox'
dropbox: setting home path '/root/.dropbox-dist/dropbox-lnx.x86_64-47.4.74'
dropbox: setting python path '/root/.dropbox-dist/dropbox-lnx.x86_64-47.4.74:/root/.dropbox-dist/dropbox-lnx.x86_64-47.4.74/python-packages-27.zip'
dropbox: python initialized
dropbox: running dropbox
dropbox: setting args
dropbox: applying overrides
dropbox: running main script
dropbox: load fq extension '/root/.dropbox-dist/dropbox-lnx.x86_64-47.4.74/cryptography.hazmat.bindings._constant_time.so'
dropbox: load fq extension '/root/.dropbox-dist/dropbox-lnx.x86_64-47.4.74/cryptography.hazmat.bindings._openssl.so'
dropbox: load fq extension '/root/.dropbox-dist/dropbox-lnx.x86_64-47.4.74/cryptography.hazmat.bindings._padding.so'
dropbox: load fq extension '/root/.dropbox-dist/dropbox-lnx.x86_64-47.4.74/psutil._psutil_linux.so'
dropbox: load fq extension '/root/.dropbox-dist/dropbox-lnx.x86_64-47.4.74/psutil._psutil_posix.so'
dropbox: load fq extension '/root/.dropbox-dist/dropbox-lnx.x86_64-47.4.74/linuxffi.pthread._linuxffi_pthread.so'
dropbox: load fq extension '/root/.dropbox-dist/dropbox-lnx.x86_64-47.4.74/tornado.speedups.so'
dropbox: load fq extension '/root/.dropbox-dist/dropbox-lnx.x86_64-47.4.74/cpuid.compiled._cpuid.so'
dropbox: load fq extension '/root/.dropbox-dist/dropbox-lnx.x86_64-47.4.74/linuxffi.resolv.compiled._linuxffi_resolv.so'
dropbox: load fq extension '/root/.dropbox-dist/dropbox-lnx.x86_64-47.4.74/linuxffi.sys.compiled._linuxffi_sys.so'
dropbox: load fq extension '/root/.dropbox-dist/dropbox-lnx.x86_64-47.4.74/posixffi.libc._posixffi_libc.so'
dropbox: load fq extension '/root/.dropbox-dist/dropbox-lnx.x86_64-47.4.74/librsyncffi.compiled._librsyncffi.so'
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”它不在那里,所以我不知道如何解决这个问题。
提前感谢!