popularity question answers views user  
8
TypeError: can't convert Array into String - ruby 1.9.2

Hey all, I’m trying to setup a server with ruby 1.9.2 instead of the default chef version. I’ve got the bootstrap file in chef-repo/boostrap/ubuntu10.04_ruby192.erb.
When I try and run this command, it fails. Anyone have any idea what I’m doing wrong?

bash-3.2$ knife bootstrap ec2-50-16-81-106.compute-1.amazonaws.com -x ubuntu --distro      ubuntu10.04-ruby192
Bootstrapping Chef on ec2-50-16-81-106.compute-1.amazonaws.com
ERROR: TypeError: can't convert Array into String
more →
3 4.8k  
6
Run chef-client on the new client node

FATAL: 1 node found, but do not have the required attribute to stablish the connection. Try setting another attribute to open the connection using —attribute.

more →
3 2.0k  
4
Cannot install chef-server 11 on centos 6

Hello,

trying to install chef-server 11 on centos 6 running the provided installer, but getting the following error message. I am stuck. Anyone can help?

[2013-02-13T16:49:30+01:00] FATAL: Mixlib::ShellOut::ShellCommandFailed: execute[/opt/chef-server/embedded/bin/chpst -u chef_server -U chef_server /opt/chef-server/embedded/bin/rabbitmqctl wait /var/opt/chef-server/rabbitmq/db/rabbit@localhost.pid] (chef-server::rabbitmq line 80) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received ‘2’ —— Begin output of /opt/chef-server/embedded/bin/chpst -u chef_server -U chef_server /opt/chef-server/embedded/bin/rabbitmqctl wait /var/opt/chef-server/rabbitmq/db/rabbit@localhost.pid —— STDOUT: Waiting for rabbit@localhost … pid is 2586 … STDERR: Error: process_not_running —— End output of /opt/chef-server/embedded/bin/chpst -u chef_server -U chef_server /opt/chef-server/embedded/bin/rabbitmqctl wait /var/opt/chef-server/rabbitmq/db/rabbit@localhost.pid —— Ran /opt/chef-server/embedded/bin/chpst -u chef_server -U chef_server /opt/chef-server/embedded/bin/rabbitmqctl wait /var/opt/chef-server/rabbitmq/db/rabbit@localhost.pid returned 2

Thanks, claudio

more →
0 422  
4
Cannot get updated ipaddress for EC2 instance started after stopped

I’m developing a recipe targeting to get the update IP address for an EC2 instance as it’s just started. To achieve this, I make chef-client a system service which located under /etc/init.d/chef-client (this is default when ec2 instance is bootstrapped) and assign the run_list to the node. However, as a result I found that node[‘ipaddress’] still gets its old address rather than the new one. The reason might because chef node retrieved the value from chef server directly which still have old value. And if I run chef-client on the node again, node[‘ipaddress’] can get the updated ip value.

My question is 1. How to get updated ipaddress for the first time when the chef-client gets started as a system service. 2. If node[‘ipaddress’] get value from chef-server then how to get ip address from ohai run? I ask this because I observe that ohai always output correct value. 3. Is there any way to delay chef-client execution as a system service?

Greatly appreciate your comments!

more →
1 1.0k  
4
Sharing code, definitions and other helpers between cookbook repos

I’m writing a couple of cookbook repos and would like to share some recipes and helpers (like definitions/* of cookbooks) between them. As I understand from CHEF-2308 the file-by-file merging and shadowing feature of the site-cookbooks directory is deprecated.

What would a DRY and simple to understand approach to sharing cookbook code be?

I’m pushing my cookbooks with rsync and running them with chef-solo, so I’m not bound by what the current Chef server supports.

I’m thinking of something modular like the site-cookbooks was, so that it’d be clear what helpers are shared and what’s repo specific. I’m trying to avoid mixing them into one file/directory like ‘knife cookbook vendor’ does with its git branch and merge approach.

Cheers

more →
1 2.4k  
3
Problem with deploy_revision and symlinks

Edit: Is this a bug or intended behavior somehow? I’ve not used Capistrano before and am not sure how closely deploy / deploy_revision fits into its paradigm.

I’m having a similar problem as described at this SO post where Chef is not able to create symlinks in deploy_revision. It seems as though Chef tries to create the symlinks to the releases/{HASH} directory instead of the repository_cache folder, since it’s done pre-migration. I can only get the error to go away if I manually create the hash release folder prior to running chef-client.

$ sudo chef-client -l info
...snip...
Error executing action `deploy` on resource 'deploy_revision[/var/www/vhosts/redacted.com]'


Chef::Exceptions::FileNotFound
Cannot symlink /var/www/vhosts/redacted.com/shared/config.json to /var/www/vhosts/redacted.com/releases/98faa472067f4fb120d97a7cf0eb486a1435f2c9/config.json before migrate: No such file or directory - (/var/www/vhosts/redacted.com/shared/config.json, /var/www/vhosts/redacted.com/releases/98faa472067f4fb120d97a7cf0eb486a1435f2c9/config.json)

I have created the shared/config.json file prior to deploy_revision being run. You can see if I create the releases/98faa472067f4fb120d97a7cf0eb486a1435f2c9 directory before running chef-client, there is no error:

$ sudo -H -u website mkdir -pv /var/www/vhosts/redacted.com/releases/98faa472067f4fb120d97a7cf0eb486a1435f2c9/
$ sudo chef-client -l info
...snip...
  * template[/var/www/vhosts/redacted.com/shared/config.json] action create[2013-03-14T18:07:04+00:00] INFO: Processing template[/var/www/vhosts/redacted.com/shared/config.json] action create (redacted::code line 26) (up to date)
  * deploy_revision[/var/www/vhosts/redacted.com] action deploy[2013-03-14T18:07:04+00:00] INFO: Processing deploy_revision[/var/www/vhosts/redacted.com] action deploy (redacted::code line 75)
...snip...
    - link shared paths into current release:  [2013-03-14T18:07:04+00:00] INFO: deploy_revision[/var/www/vhosts/redacted.com] made pre-migration symlinks

    - make pre-migration symliinks: config.json => config.json, node_modules => node_modules[2013-03-14T18:07:04+00:00]
...snip...
[2013-03-14T18:07:19+00:00] INFO: Chef Run complete in 21.972962944 seconds
[2013-03-14T18:07:19+00:00] INFO: Running report handlers
[2013-03-14T18:07:19+00:00] INFO: Report handlers complete
Chef Client finished, 6 resources updated

How am I supposed to make symlinks before the migration with deploy_revision?

FWIW, using symlink or symlink_before_migrate seems to make no difference.

Interestingly, using the force_deploy action fixes this problem, but I really don’t want to have my code redeploy every time chef runs if I’m not upgrading the git reference point.

Is this a bug in chef-client or am I not understanding the correct usage of deploy_revision?

Edit: here’s the compiled resource that fails without making that directory first:

Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/redacted/recipes/code.rb:75:in `from_file'

deploy_revision("/var/www/vhosts/redacted.com") do
  provider Chef::Provider::Deploy::Revision
  action [:deploy]
  retries 0
  retry_delay 2
  deploy_to "/var/www/vhosts/redacted.com"
  repository_cache "cached-copy"
  symlinks {"config.json"=>"config.json", "node_modules"=>"node_modules"}
  revision "develop"
  rollback_on_error true
  remote "origin"
  enable_submodules true
  scm_provider Chef::Provider::Git
  keep_releases 5
  cookbook_name "redacted"
  recipe_name "code"
  repo "git@github.com:redacted/redacted.git"
  user "website"
  group "website"
  before_restart #<Proc:0x9086e44@/var/chef/cache/cookbooks/redacted/recipes/code.rb:94>
  shared_path "/var/www/vhosts/redacted.com/shared"
  destination "/var/www/vhosts/redacted.com/shared/cached-copy"
  current_path "/var/www/vhosts/redacted.com/current"
end
more →
0 175  
3
Abandoned cookbooks

There seem to be cookbooks that have been uploaded at one point in time, and have never been updated, nor respond to any inquiries regarding updates.

I have taken on primary maintenance of one such cookbook, have updated it considerably, and would like to share it back.

Is there a method or process to determine ‘ownership’ of a given cookbook, and delegate that to another interested party if it is neglected?

Thanks, -M

more →
0 362  
3
Why does my profile picture not update?

I changed my profile picture, but it didn’t update in the various thumbnails where it should, it just looks like the faceless Opscode guy.

more →
2 1.9k  
3
How to find out `os` name?

Where can i find the complete list of os i can use in cookbooks. e.g. in metadata,rb file , the method support takes an argument , the os name.

more →
1 1.7k  
3 3 2.0k