我是厨师的新鲜肉。我正在使用 chef 来管理一个 ec2 实例,并且似乎正在工作。当我登录该框时,我运行以下命令,以便查看发生了什么。
sudo chef-client -i 60
我注意到我对 pytimer 的安装不断被重新安装。我如何修改配方以确保它只安装一次,除非配方发生变化?
[Thu, 29 Mar 2012 00:28:01 +0000] INFO: Processing easy_install_package[hash_ring] action install (nginx_base::default line 107)
[Thu, 29 Mar 2012 00:28:02 +0000] INFO: Processing bash[compile_proto_source_source] action run (PyTimer::default line 8)
[Thu, 29 Mar 2012 00:28:02 +0000] INFO: bash[compile_proto_source_source] sh("bash" "/tmp/chef-script20120329-23998-1te88gz-0")
timeout-0.1.2/
timeout-0.1.2/PKG-INFO
timeout-0.1.2/setup.py
timeout-0.1.2/timeout.py
running install
running build
running build_py
copying timeout.py -> build/lib.linux-x86_64-2.7
running install_lib
copying build/lib.linux-x86_64-2.7/timeout.py -> /usr/local/lib/python2.7/dist-packages
byte-compiling /usr/local/lib/python2.7/dist-packages/timeout.py to timeout.pyc
running install_egg_info
Removing /usr/local/lib/python2.7/dist-packages/timeout-0.1.2.egg-info
Writing /usr/local/lib/python2.7/dist-packages/timeout-0.1.2.egg-info
version = node[:PyTimer][:version]
remote_file "#{Chef::Config[:file_cache_path]}/timeout-#{version}.tar.gz" do
source "http://pypi.python.org/packages/source/t/timeout/timeout-#{version}.tar.gz"
#action :create_if_missing
end
bash "compile_proto_source_source" do
cwd Chef::Config[:file_cache_path]
code <<-EOH
tar -xvf timeout-#{version}.tar.gz
cd timeout-#{version}
sed 's/signal.alarm(self.timeout)/signal.setitimer(signal.ITIMER_REAL,self.timeout)/g' -i timeout.py
python setup install
EOH
end