diff --git a/recipes/configure.rb b/recipes/configure.rb index 13191ee..7cdaf32 100644 --- a/recipes/configure.rb +++ b/recipes/configure.rb @@ -1,6 +1,2 @@ -if node[:opsworks][:instance][:layers].include?('rails-app') - - include_recipe "opsworks_custom_env::restart_command" - include_recipe "opsworks_custom_env::write_config" - -end +include_recipe "opsworks_custom_env::restart_command" +include_recipe "opsworks_custom_env::write_config" diff --git a/recipes/restart_command.rb b/recipes/restart_command.rb index 7954606..17855bc 100644 --- a/recipes/restart_command.rb +++ b/recipes/restart_command.rb @@ -1,9 +1,12 @@ node[:deploy].each do |application, deploy| + if deploy[:application_type] != 'rails' + Chef::Log.debug("Skipping opsworks_custom_env::restart_command for application #{application} as it is not a rails app") + next + end execute "restart Rails app #{application} for custom env" do cwd deploy[:current_path] - command "#{deploy[:deploy_to]}/shared/scripts/unicorn restart" - user deploy[:user] + command node[:opsworks][:rails_stack][:restart_command] action :nothing end diff --git a/recipes/write_config.rb b/recipes/write_config.rb index 501aa5f..57bb873 100644 --- a/recipes/write_config.rb +++ b/recipes/write_config.rb @@ -2,6 +2,10 @@ # See https://forums.aws.amazon.com/thread.jspa?threadID=118107 node[:deploy].each do |application, deploy| + if deploy[:application_type] != 'rails' + Chef::Log.debug("Skipping opsworks_custom_env::restart_command for application #{application} as it is not a rails app") + next + end custom_env_template do application application