Revision bc11c17b
Added by Ewoud Kohl van Wijngaarden over 10 years ago
app/controllers/api/v2/hosts_controller.rb | ||
---|---|---|
resource_class.my_hosts
|
||
end
|
||
|
||
api :GET, "/hosts/:id/puppetrun", "Force a puppet run on the agent."
|
||
api :PUT, "/hosts/:id/puppetrun", "Force a puppet run on the agent."
|
||
param :id, :identifier_dottable, :required => true
|
||
|
||
def puppetrun
|
||
return deny_access unless Setting[:puppetrun]
|
config/routes/api/v2.rb | ||
---|---|---|
end
|
||
resources :hosts, :except => [:new, :edit] do
|
||
get :status, :on => :member
|
||
get :puppetrun, :on => :member
|
||
put :puppetrun, :on => :member
|
||
put :boot, :on => :member
|
||
put :power, :on => :member
|
||
post :facts, :on => :collection
|
test/functional/api/v2/hosts_controller_test.rb | ||
---|---|---|
test "should run puppet for specific host" do
|
||
User.current=nil
|
||
ProxyAPI::Puppet.any_instance.stubs(:run).returns(true)
|
||
get :puppetrun, { :id => hosts(:one).to_param }
|
||
put :puppetrun, { :id => hosts(:one).to_param }
|
||
assert_response :success
|
||
end
|
||
|
Also available in: Unified diff
Fixes #4022: Make api puppetrun a PUT for REST standards