Skip to content

Commit

Permalink
Merge pull request #26 from ncerny/nc/fix-source-req-error
Browse files Browse the repository at this point in the history
Default chef_file source to cookbook_file if source property is not set.
  • Loading branch information
ncerny authored Apr 14, 2017
2 parents 47ca93d + c963217 commit 4560c48
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
long_description 'Resource Cookbook for Managing Chef Software Inc Product Suite'
issues_url 'https://github.com/ncerny/chef_stack/issues' if respond_to?(:issues_url)
source_url 'https://github.com/ncerny/chef_stack' if respond_to?(:source_url)
version '0.6.1'
version '0.6.3'

depends 'chef-ingredient'
3 changes: 2 additions & 1 deletion resources/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
default_action :create

property :filename, String, name_property: true
property :source, String, required: true
property :source, String
property :user, String, default: 'root'
property :group, String, default: 'root'
property :mode, String, default: '0600'
Expand All @@ -31,6 +31,7 @@
end

action :create do
new_resource.source = (property_is_set?(:source) ? new_resource.source : "cookbook_file://#{new_resource.filename}")
if new_resource.source.start_with?('cookbook_file://')
src = new_resource.source.split('://')[1].split('::')

Expand Down

0 comments on commit 4560c48

Please sign in to comment.