Class: ForemanPuppet::Api::V2::PuppetclassesController
Instance Method Summary
collapse
#puppetclass_params
#puppetclass_lookup_key_params
Instance Method Details
#create ⇒ Object
70
71
72
73
|
# File 'app/controllers/foreman_puppet/api/v2/puppetclasses_controller.rb', line 70
def create
@puppetclass = Puppetclass.new(puppetclass_params)
process_response @puppetclass.save
end
|
#destroy ⇒ Object
87
88
89
|
# File 'app/controllers/foreman_puppet/api/v2/puppetclasses_controller.rb', line 87
def destroy
process_response @puppetclass.destroy
end
|
#index ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'app/controllers/foreman_puppet/api/v2/puppetclasses_controller.rb', line 24
def index
values = Puppetclass.authorized(:view_puppetclasses).search_for(*search_options) unless nested_obj
values ||= case nested_obj
when Host::Base, Hostgroup
nested_obj.puppet.all_puppetclasses
else
nested_obj.puppetclasses.search_for(*search_options)
end
@total = Puppetclass.count unless nested_obj
@total ||= case nested_obj
when Host::Base, Hostgroup
values.count
else
nested_obj.puppetclasses.count
end
@subtotal = values.count
if params[:style] == 'list'
@puppetclasses = values
render :list
else
@puppetclasses = Puppetclass.classes2hash_v2(values.paginate(paginate_options))
end
end
|
#resource_class ⇒ Object
91
92
93
|
# File 'app/controllers/foreman_puppet/api/v2/puppetclasses_controller.rb', line 91
def resource_class
ForemanPuppet::Puppetclass
end
|
#show ⇒ Object
58
59
|
# File 'app/controllers/foreman_puppet/api/v2/puppetclasses_controller.rb', line 58
def show
end
|
#update ⇒ Object
79
80
81
82
|
# File 'app/controllers/foreman_puppet/api/v2/puppetclasses_controller.rb', line 79
def update
class_params = puppetclass_params.merge(smart_class_parameter_ids: @puppetclass.smart_class_parameters.map(&:id))
process_response @puppetclass.update(class_params)
end
|