popularity question answers views user  
1
how to use chef to build server through ruby code

Hi, I’m looking at chef for a new SaaS project and can see how to create a new server with knife. But is there a way to do this through ruby?

we have a ruby server that needs to periodically create new servers. While we can use the fog library to create the actual server on EC2, its not clear how to install the chef-client. knife can do this but its not clear that knife has an interface/api that ruby code can call. I guess my code could run knife as a shell command but I’m hoping for something a bit more elegant.

thanks in advance

more →
1 735  
1
Call knife commands from a Ruby script without shelling out

(Also asked on StackOverflow.com)

I’ve inherited some shell scripts that are helpful for setting up our application environment using Chef and knife. That’s nice.

But what I’d really like to do is have the power and flexibility of a Ruby script to do the same thing.

If I shell out to knife I lose the real time output of the command.

It seems like I should be able to call all of knife’s functionality from within Ruby by including the ‘chef’ gem and maybe the ‘cloudstack-fog’ plug-in I use.

But I haven’t found any examples or API documentation. Trying to dig through the chef gem source is an exercise in frustration.

Shouldn’t I be able to do the equivalent of a knife cloudstack server create -E … etc. from a Ruby script?

more →
0 166  
0
How to execute Terminal commands in recipe

Hi all,

i want to execute Terminal commands in a recipe and i donĀ“t know how to write the ruby file. I already tried to upload and run this recipe: package “install-faban” do

command "wget http://java.net/downloads/faban/faban-kit/faban-kit-022311.tar.gz"

command "untar -xzf faban-kit-022311.tar.gz"

command "cd faban/"
#Install required Faban Services
#Glassfish
command "cp cp samples/services/GlassfishService/build/GlassfishService.jar services"
#MySQL
command "cp samples/services/MysqlService/build/MysqlService.jar services"
#Memcached
command "cp samples/services/MemcachedService/build/MemcachedService.jar services"

end

but after running the client the error NoMethodError: undefined Method ‘command’ came up.

Can somebody help?

more →
1 239  
-1
Chef and Ruby 1.9.3

Hello!

How to install chef with/on ruby 1.9.3? All my attempts to install chef install Ruby 1.8.

Debian GNU/Linux wheezy/sid

Linux chef 3.2.0-4-amd64 #1 SMP Debian 3.2.32-1 x86_64 GNU/Linux

$ cat /etc/apt/sources.list.d/opscode.list

deb http://apt.opscode.com/ wheezy-0.10 main

more →
0 86