Chef::Exceptions::EnclosingDirectoryDoesNotExist: Parent directory

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Chef::Exceptions::EnclosingDirectoryDoesNotExist: Parent directory

John Riker
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

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.
 
 
Reply | Threaded
Open this post in threaded view
|

Re: Chef::Exceptions::EnclosingDirectoryDoesNotExist: Parent directory

Mike
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



On Mon, Jun 24, 2013 at 7:15 PM, John Riker <[hidden email]> wrote:

> 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
>
> --
> 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 [hidden email].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.


Reply | Threaded
Open this post in threaded view
|

Re: Chef::Exceptions::EnclosingDirectoryDoesNotExist: Parent directory

John Riker
In reply to this post by John Riker
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.

On Monday, June 24, 2013 7:15:51 PM UTC-4, John Riker wrote:
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

--
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 [hidden email].
For more options, visit https://groups.google.com/groups/opt_out.