Skip to content
This repository

Make cached-copy deletion optional #9

Closed
wants to merge 1 commit into from

4 participants

Dennis Reimann Ralph von der Heyden Jaroslav Kalistsuk Jonathan Weiss
Dennis Reimann

Deleting the cached-copy is a workaround for a bug in Chef for cases in which updating the cached-copy does not work because of branch-switching. For backwards-compatibility the default value is true.

Nevertheless I think it should not be a problem anyways, because the Chef Deploy Resource offers ways to configure the strategy to do a checkout/export instead of the default option sync (which would update the existing cached-copy).

However: Do you know if this bug has been fixed in Chef, so that deletion of the cached-copy could be removed altogether?

Dennis Reimann Make cached-copy deletion optional
Deleting the cached-copy is a workaround for a bug in Chef for cases in which updating the cached-copy does not work because of branch-switching. For backwards-compatibility the default value is true.
03895ff
Ralph von der Heyden
ralph commented

+1

Jaroslav Kalistsuk

do you think it could be possible to just check what is the current branch in the cached-copy folder? if it's the same branch then pull, if not then delete and clone again?

Jonathan Weiss
Owner

I have a better fix here: 7a74383

It uses only_if instead of if which works better with the 2-phase flow of chef.

Jonathan Weiss jweiss closed this
Dennis Reimann

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Mar 15, 2012
Dennis Reimann Make cached-copy deletion optional
Deleting the cached-copy is a workaround for a bug in Chef for cases in which updating the cached-copy does not work because of branch-switching. For backwards-compatibility the default value is true.
03895ff
This page is out of date. Refresh to see the latest.
1  deploy/attributes/deploy.rb
@@ -44,6 +44,7 @@
44 44
   default[:deploy][application][:stack][:needs_reload] = true
45 45
   default[:deploy][application][:enable_submodules] = true
46 46
   default[:deploy][application][:shallow_clone] = true
  47
+  default[:deploy][application][:delete_cached_copy] = true
47 48
   default[:deploy][application][:symlink_before_migrate] = {}
48 49
   
49 50
   default[:deploy][application][:environment] = {"RAILS_ENV" => deploy[:rails_env],
8  deploy/definitions/scalarium_deploy.rb
@@ -41,9 +41,11 @@
41 41
 
42 42
   Chef::Log.debug("Checking out source code of application #{application} with type #{deploy[:application_type]}")
43 43
 
44  
-  directory "#{deploy[:deploy_to]}/shared/cached-copy" do
45  
-    recursive true
46  
-    action :delete
  44
+  if deploy[:delete_cached_copy]
  45
+    directory "#{deploy[:deploy_to]}/shared/cached-copy" do
  46
+      recursive true
  47
+      action :delete
  48
+    end
47 49
   end
48 50
 
49 51
   ruby_block "change HOME to #{deploy[:home]} for source checkout" do
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.