Issue when zipping folder with Chef resource windows_zipfile

2015/09/18

If you receive the warning

Single directory must be specified for compression, and [folder] does not meet that criteria.

when trying to zip a file with Chef resource provider windows_zipfile from windows cookbook, well… it just means what it says: the specified folder is not a folder or doesn’t exists.

The reason I’ve spend more than an hour investigating this is because I was using artifact_deploy resource to first download a build, from which I wanted afterwards to zip only a subfolder; and also, there were several cookbook dependencies, which also had to be compiled… so there goes wasted time.

But the problem is that artifact_deploy uses versioning, so I had to add a current subfolder to point to the right location.
Just to be sure you have the right folder specified, do a

Chef::Log.warn(“Source: #{backup_path}/current/#{app_name}/subfolder

in your cookbook, and paste the output into the file manager from the virtual machine used for testing the cookbook.

Note: Chef::Log.info doesn’t work for me on simple kitchen converge (Chef 12.4), that’s why I used the warn method. Of course, on DEBUG, it’s displayed either way.

Hope this helps someone.

Note: Be aware that when copy-pasting, the quotes and possibly other characters get messed up by WordPress, you’ll have to replace them.

Advertisements

%d bloggers like this: