Chef::Exceptions::EnclosingDirectoryDoesNotExist: Parent directory

1,632 views
Skip to first unread message

John Riker

unread,
Jun 24, 2013, 7:15:51 PM6/24/13
to vagra...@googlegroups.com
Though I believe I have the correct directory setup, I continue to get the error above

The directory file structure I have is

C:\Users\threezerous\cookbooks
C:\Users\threezerous\cookbooks\basic
C:\Users\threezerous\cookbooks\basic\attributes
C:\Users\threezerous\cookbooks\basic\recipes
C:\Users\threezerous\cookbooks\basic\templates
C:\Users\threezerous\cookbooks\basic\templates\default

I have a template defined in recipes(C:\Users\threezerous\cookbooks\basic\recipes\default.rb) as

template "createfile" do
  path "/users/threezerous/cookbooks/basic/templates/default"
  source "createfile.erb"
  owner "root"
  group "root"
  mode "0644"
end

and I am trying to create a file through the C:\Users\threezerous\cookbooks\basic\templates\default\createfile.erb as

# Just create a file
file "/tmp/from_template_test" do
  action :create_if_missing
  mode    0644
  content "success"
end

One of the google forums suggested I may have an older version of repo and suggested to run git log inside the local copy of this chef_solo repo. However, I am not very clear where would I find the version of the repository or where I should be running this command.

Any guidance is greatly appreciated.
Thanks

Mike

unread,
Jun 25, 2013, 8:39:05 AM6/25/13
to vagra...@googlegroups.com
Hi John,

In this section:

template "createfile" do
path "/users/threezerous/cookbooks/basic/templates/default"
source "createfile.erb"
owner "root"
group "root"
mode "0644"
end

try removing the `path` and `source` altogether, rather in the
`template` title, point to the actual file contexts you'd want, like
so:

template "/tmp/createfile" do
owner "root"
group "root"
mode "0644"
end


And the contents of the createfile.erb should be the thing you want to
exist, not further Chef statements:
C:\Users\threezerous\cookbooks\basic\templates\default\createfile.erb:

<%= node.name %> is my name, and Chef is my game.


After a Chef run, the `/tmp/createfile` should contain the node's name
replaced in the string.

You might want to run through the NTP use case on learnchef.com - it
uses a templating example. Somewhat less confusing than reading the
'template' docs -
http://docs.opscode.com/essentials_cookbook_templates.html

-M
> --
> You received this message because you are subscribed to the Google Groups
> "Vagrant" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to vagrant-up+...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

John Riker

unread,
Jun 25, 2013, 9:59:30 AM6/25/13
to vagra...@googlegroups.com
Thanks for the response. I was able to successfully run  the template example you provided. Let me go through the link you provided for learnchef to see if I can create a file based on a template. Much appreciated.
Reply all
Reply to author
Forward
0 new messages