From 9a0175a77c256741c3dff7a1223baf734586bca5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Pervill=C3=A9?= Date: Tue, 18 Nov 2014 15:59:27 +0630 Subject: [PATCH] Upstart: install inotify-tools only once (avoid CHEF-3694 warning). --- providers/container.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/providers/container.rb b/providers/container.rb index a6d8467f6c..c20eeba474 100644 --- a/providers/container.rb +++ b/providers/container.rb @@ -487,9 +487,15 @@ def service_create_sysv def service_create_upstart # The upstart init script requires inotifywait, which is in inotify-tools - package 'inotify-tools' do - action :nothing - end.run_action(:install) + # For clarity, install the package here but do it only once (no CHEF-3694). + begin + run_context.resource_collection.find(:package => 'inotify-tools') + # If we get here then we already installed the resource the first time. + rescue Chef::Exceptions::ResourceNotFound + package('inotify-tools') do + action :nothing + end.run_action(:install) + end template "/etc/init/#{service_name}.conf" do source service_template