Machine_execute returning undefined method


#1

I’m trying to elegantly stop and then start a running service on a remote box.

any attempts to use ‘machine_execute’ results in an exception stating there’s an undefined method and searching the exception yields some results fr Vagrant (which i’m not using) and ports not being open (which shouldn’t be an issue).

This is my simple test case that is failing and then beneath it is the full chain that I’d like to use.

I’ve tried simplifying it as much as possible to little avail. Thanks in advance for any help.

machine execute "service #{solrCore} restart" do
machine 'machineName'
end

this is the full example I was trying:

  machine_execute 'pwd' do
    machine "machineName"
    command 'pwd'
    Chef::Resource::Notification.new('stop', :run, self)
end


#define the service - does nothing
service solrCore do
    action :nothing
end

#do something that triggers
machine_execute 'start' do
    machine "machineName"
    command 'pwd' #test
    Chef::Log.info('triggers start')
    action :nothing
    notifies :start, run_context.resource_collection.find(:service => "#{solrCore}")
end

execute 'stop' do
    # some stuff
    # on success...
    machine "machineName"
    command 'pwd' #test
    Chef::Log.info('triggers restart')
    notifies :stop, run_context.resource_collection.find(:service => "#{solrCore}"), :immediately
    notifies :run, 'machine_execute[start]'
end