首页 > 解决方案 > Chef - Block not being executed even tho its notified?

问题描述

i've looked over this code a few times and i'm not sure why the extract_presta block isnt being triggered. I've confirmed the file i'm looking for isnt in the /var/www/html directory :c)

What i'm trying to achieve is to:

Could i ask for some advice please? thanks. -nat

service "apache" do
  action :nothing
end

execute 'extract_presta' do
  command 'unzip /tmp/prestashop_1.7.4.2.zip'
  cwd '/var/www/html'
  not_if { File.exists?("/var/www/html/autoload.php") }
  action :nothing
  notifies :start, "service[apache]"
end

# Fetch the file. Maybe the file won't be fetched because of not_if or checksum.
# In that case apache won't be stopped or started, it will just keep running.
  remote_file "/tmp/prestashop_1.7.4.2.zip" do
  source "https://download.prestashop.com/download/releases/prestashop_1.7.4.2.zip"
  notifies :stop, "service[apache]", :immediately
  notifies :run, 'execute[extract_presta]', :immediately
end

标签: rubychef-infra

解决方案


下载是否已经存在?如果是这样,那么remote_file资源将被标记为最新并且不会触发通知。


推荐阅读