[chef] Re: Re: Stop multiple services


Chronological Thread 
  • From: ram karthik < >
  • To:
  • Subject: [chef] Re: Re: Stop multiple services
  • Date: Sun, 14 Sep 2014 09:24:18 -0700

Ranjib,

svc without quote also returns the same error . /root/svc is a static file . I am not sure about any other method for reading a file to a array and iterating through the array . Let me know how I can do without using ruby_block,

Thanks,


On Sun, Sep 14, 2014 at 1:49 AM, Ranjib Dey < " target="_blank"> > wrote:
instead of service "svc" it should be service svc , without quote.

why you are wrapping the service resources inside a ruby_block? You can puts the file reading bits in recipe directly (unless /root/svc is being populated during the converge time)

On Sun, Sep 14, 2014 at 1:45 AM, < " target="_blank"> > wrote:
I have multiple services that I need to stop , my code is as below ,

ruby_block "stopsvc" do
        block do
                services = File.readlines("/root/svc")
                services.each do |svc|
                                        require
Chef::Provider::Service::Init::Redhat
                                        service "svc" do
                                        action [ :stop, :disable]
                                        end
                end
        end
end

"can't convert Class into String" is the error I am seeing . Please point what
I need ,





Archive powered by MHonArc 2.6.16.

§