Chef-Cookbook creation


#1

Hi all,

I have just a little question about knife?! At the installation of the server you have to configure knife with “knife configure -I” You will locate the different *.pem files aso. After that you are able to create a new cookbook with:
" knife cookbook create test04"
** Creating cookbook test04
** Creating README for cookbook: test04
** Creating metadata for cookbook: test04

After playing with GIT and the root user I will get this if I try to create a new cookbook:
** Creating cookbook vendor
/usr/lib/ruby/1.8/chef/knife/cookbook_create.rb:90:in initialize': No such file or directory - ~/chef-repo/cookbooks/vendor/recipes/default.rb (Errno::ENOENT) from /usr/lib/ruby/1.8/chef/knife/cookbook_create.rb:90:inopen’
from /usr/lib/ruby/1.8/chef/knife/cookbook_create.rb:90:in create_cookbook' from /usr/lib/ruby/1.8/chef/knife/cookbook_create.rb:74:inrun’
from /usr/lib/ruby/1.8/chef/knife.rb:127:in run' from /usr/lib/ruby/1.8/chef/application/knife.rb:121:inrun’
from /usr/bin/knife:25

Can anybody help me with this problem?! I did a reconfigure of the knife but without success!!

Knife.rb is thath:

log_level :info
log_location STDOUT
node_name 'xxx’
client_key '/home/xxx/chef-repo/.chef/thales.pem’
validation_client_name 'chef-validator’
validation_key '/etc/chef/validation.pem’
chef_server_url 'http://serverxx.domain:4000
cache_type 'BasicFile’
cache_options( :path => ‘/home/xxx/chef-repo/.chef/checksums’ )
cookbook_path [ ‘~/chef-repo/cookbooks’, ‘~/chef-repo/site-cookbooks’ ]

Regards
Andreas


#2

On 14 March 2011 09:44, WEINHAPL Andreas
andreas.weinhapl@thalesgroup.com wrote:

Hi all,

I have just a little question about knife?! At the installation of the
server you have to configure knife with “knife configure –I” You will locate
the different *.pem files aso. After that you are able to create a new
cookbook with:

“ knife cookbook create test04”

            ** Creating cookbook test04

** Creating README for cookbook: test04

** Creating metadata for cookbook: test04

After playing with GIT and the root user I will get this if I try to create
a new cookbook:

** Creating cookbook vendor

/usr/lib/ruby/1.8/chef/knife/cookbook_create.rb:90:in `initialize’: No such
file or directory - ~/chef-repo/cookbooks/vendor/recipes/default.rb
(Errno::ENOENT)

Use File.expand_path("~/some/shit") to expand the tilde to your home directory.

Regards,

AJ

    from /usr/lib/ruby/1.8/chef/knife/cookbook_create.rb:90:in `open'

    from /usr/lib/ruby/1.8/chef/knife/cookbook_create.rb:90:in

`create_cookbook’

    from /usr/lib/ruby/1.8/chef/knife/cookbook_create.rb:74:in `run'

    from /usr/lib/ruby/1.8/chef/knife.rb:127:in `run'

    from /usr/lib/ruby/1.8/chef/application/knife.rb:121:in `run'

    from /usr/bin/knife:25

Can anybody help me with this problem?! I did a reconfigure of the knife but
without success!!

Knife.rb is thath:

log_level :info

log_location STDOUT

node_name ‘xxx’

client_key ‘/home/xxx/chef-repo/.chef/thales.pem’

validation_client_name ‘chef-validator’

validation_key ‘/etc/chef/validation.pem’

chef_server_url ‘http://serverxx.domain:4000

cache_type ‘BasicFile’

cache_options( :path => ‘/home/xxx/chef-repo/.chef/checksums’ )

cookbook_path [ ‘~/chef-repo/cookbooks’, ‘~/chef-repo/site-cookbooks’ ]

Regards

Andreas


#3

Hi AJ,

Sry If the question is a little bit confusing: Where should I paste the line “File.expand_path(”~/some/shit")" because the strange thing is that on my first chef-server I didn’t get this problem!

Regards
Andreas

From: AJ Christensen [mailto:aj@junglist.gen.nz]
Sent: Montag, 14. März 2011 14:56
To: chef@lists.opscode.com
Subject: [chef] Re: Chef-Cookbook creation

On 14 March 2011 09:44, WEINHAPL Andreas
andreas.weinhapl@thalesgroup.com wrote:

Hi all,

I have just a little question about knife?! At the installation of the
server you have to configure knife with “knife configure –I” You will locate
the different *.pem files aso. After that you are able to create a new
cookbook with:

“ knife cookbook create test04”

            ** Creating cookbook test04

** Creating README for cookbook: test04

** Creating metadata for cookbook: test04

After playing with GIT and the root user I will get this if I try to create
a new cookbook:

** Creating cookbook vendor

/usr/lib/ruby/1.8/chef/knife/cookbook_create.rb:90:in `initialize’: No such
file or directory - ~/chef-repo/cookbooks/vendor/recipes/default.rb
(Errno::ENOENT)

Use File.expand_path("~/some/shit") to expand the tilde to your home directory.
Regards,

AJ

    from /usr/lib/ruby/1.8/chef/knife/cookbook_create.rb:90:in `open'

    from /usr/lib/ruby/1.8/chef/knife/cookbook_create.rb:90:in

`create_cookbook’

    from /usr/lib/ruby/1.8/chef/knife/cookbook_create.rb:74:in `run'

    from /usr/lib/ruby/1.8/chef/knife.rb:127:in `run'

    from /usr/lib/ruby/1.8/chef/application/knife.rb:121:in `run'

    from /usr/bin/knife:25

Can anybody help me with this problem?! I did a reconfigure of the knife but
without success!!

Knife.rb is thath:

log_level :info

log_location STDOUT

node_name ‘xxx’

client_key ‘/home/xxx/chef-repo/.chef/thales.pem’

validation_client_name ‘chef-validator’

validation_key ‘/etc/chef/validation.pem’

chef_server_url ‘http://serverxx.domain:4000

cache_type ‘BasicFile’

cache_options( :path => ‘/home/xxx/chef-repo/.chef/checksums’ )

cookbook_path [ ‘~/chef-repo/cookbooks’, ‘~/chef-repo/site-cookbooks’ ]

Regards

Andreas


#4

I think there is an easier way to solve this issue:
Knife.rb (won’t work)
cookbook_path [ ‘~/chef-repo/cookbooks’, ‘~/chef-repo/site-cookbooks’ ]

Knife.rb (works really good)
cookbook_path [ ‘/home/xxx/chef-repo/cookbooks’, ‘/home/chef-repo/site-cookbooks’ ]

I just use the absolute path for the cookbook…

Many thanks for your help :slight_smile: But please explain your method.

Regards
Andreas

-----Original Message-----
From: AJ Christensen [mailto:aj@junglist.gen.nz]
Sent: Montag, 14. März 2011 14:56
To: chef@lists.opscode.com
Subject: [chef] Re: Chef-Cookbook creation

On 14 March 2011 09:44, WEINHAPL Andreas
andreas.weinhapl@thalesgroup.com wrote:

Hi all,

I have just a little question about knife?! At the installation of the
server you have to configure knife with “knife configure –I” You will locate
the different *.pem files aso. After that you are able to create a new
cookbook with:

“ knife cookbook create test04”

            ** Creating cookbook test04

** Creating README for cookbook: test04

** Creating metadata for cookbook: test04

After playing with GIT and the root user I will get this if I try to create
a new cookbook:

** Creating cookbook vendor

/usr/lib/ruby/1.8/chef/knife/cookbook_create.rb:90:in `initialize’: No such
file or directory - ~/chef-repo/cookbooks/vendor/recipes/default.rb
(Errno::ENOENT)

Use File.expand_path("~/some/shit") to expand the tilde to your home directory.

Regards,

AJ

    from /usr/lib/ruby/1.8/chef/knife/cookbook_create.rb:90:in `open'

    from /usr/lib/ruby/1.8/chef/knife/cookbook_create.rb:90:in

`create_cookbook’

    from /usr/lib/ruby/1.8/chef/knife/cookbook_create.rb:74:in `run'

    from /usr/lib/ruby/1.8/chef/knife.rb:127:in `run'

    from /usr/lib/ruby/1.8/chef/application/knife.rb:121:in `run'

    from /usr/bin/knife:25

Can anybody help me with this problem?! I did a reconfigure of the knife but
without success!!

Knife.rb is thath:

log_level :info

log_location STDOUT

node_name ‘xxx’

client_key ‘/home/xxx/chef-repo/.chef/thales.pem’

validation_client_name ‘chef-validator’

validation_key ‘/etc/chef/validation.pem’

chef_server_url ‘http://serverxx.domain:4000

cache_type ‘BasicFile’

cache_options( :path => ‘/home/xxx/chef-repo/.chef/checksums’ )

cookbook_path [ ‘~/chef-repo/cookbooks’, ‘~/chef-repo/site-cookbooks’ ]

Regards

Andreas


#5

http://www.ruby-doc.org/core/classes/File.html#M000022

On 14 March 2011 10:24, WEINHAPL Andreas
andreas.weinhapl@thalesgroup.com wrote:

I think there is an easier way to solve this issue:
Knife.rb (won’t work)
cookbook_path [ ‘~/chef-repo/cookbooks’, ‘~/chef-repo/site-cookbooks’ ]

Knife.rb (works really good)
cookbook_path [ ‘/home/xxx/chef-repo/cookbooks’,
’/home/chef-repo/site-cookbooks’ ]

I just use the absolute path for the cookbook…

Many thanks for your help :slight_smile: But please explain your method.

Regards
Andreas

-----Original Message-----
From: AJ Christensen [mailto:aj@junglist.gen.nz]
Sent: Montag, 14. März 2011 14:56
To: chef@lists.opscode.com
Subject: [chef] Re: Chef-Cookbook creation

On 14 March 2011 09:44, WEINHAPL Andreas
andreas.weinhapl@thalesgroup.com wrote:

Hi all,

I have just a little question about knife?! At the installation of the
server you have to configure knife with “knife configure –I” You will
locate
the different *.pem files aso. After that you are able to create a new
cookbook with:

“ knife cookbook create test04”

            ** Creating cookbook test04

** Creating README for cookbook: test04

** Creating metadata for cookbook: test04

After playing with GIT and the root user I will get this if I try to
create
a new cookbook:

** Creating cookbook vendor

/usr/lib/ruby/1.8/chef/knife/cookbook_create.rb:90:in `initialize’: No
such
file or directory - ~/chef-repo/cookbooks/vendor/recipes/default.rb
(Errno::ENOENT)

Use File.expand_path("~/some/shit") to expand the tilde to your home
directory.

Regards,

AJ

    from /usr/lib/ruby/1.8/chef/knife/cookbook_create.rb:90:in `open'

    from /usr/lib/ruby/1.8/chef/knife/cookbook_create.rb:90:in

`create_cookbook’

    from /usr/lib/ruby/1.8/chef/knife/cookbook_create.rb:74:in `run'

    from /usr/lib/ruby/1.8/chef/knife.rb:127:in `run'

    from /usr/lib/ruby/1.8/chef/application/knife.rb:121:in `run'

    from /usr/bin/knife:25

Can anybody help me with this problem?! I did a reconfigure of the knife
but
without success!!

Knife.rb is thath:

log_level :info

log_location STDOUT

node_name ‘xxx’

client_key ‘/home/xxx/chef-repo/.chef/thales.pem’

validation_client_name ‘chef-validator’

validation_key ‘/etc/chef/validation.pem’

chef_server_url ‘http://serverxx.domain:4000

cache_type ‘BasicFile’

cache_options( :path => ‘/home/xxx/chef-repo/.chef/checksums’ )

cookbook_path [ ‘~/chef-repo/cookbooks’, ‘~/chef-repo/site-cookbooks’ ]

Regards

Andreas