Class: ForemanPuppet::Api::V2::HostsBulkActionsController

Inherits:
PuppetBaseController
  • Object
show all
Includes:
Api::V2::BulkHostsExtension
Defined in:
app/controllers/foreman_puppet/api/v2/hosts_bulk_actions_controller.rb

Instance Method Summary collapse

Instance Method Details

#change_puppet_proxyObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/controllers/foreman_puppet/api/v2/hosts_bulk_actions_controller.rb', line 24

def change_puppet_proxy
  error_hosts = ::BulkHostsManager.new(hosts: @hosts).change_puppet_proxy(@proxy, ca_proxy?)
  process_bulk_puppet_proxy_response(
    error_hosts,
    success_message: format(n_(
      'Updated host: changed %{proxy_type}',
      'Updated hosts: changed %{proxy_type}',
      @hosts.count
    ), proxy_type: proxy_type),
    error_message: format(n_(
      'Failed to change %{proxy_type} for %{count} host',
      'Failed to change %{proxy_type} for %{count} hosts',
      error_hosts.count
    ), proxy_type: proxy_type, count: error_hosts.count)
  )
end

#remove_puppet_proxyObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'app/controllers/foreman_puppet/api/v2/hosts_bulk_actions_controller.rb', line 44

def remove_puppet_proxy
  error_hosts = ::BulkHostsManager.new(hosts: @hosts).change_puppet_proxy(nil, ca_proxy?)
  process_bulk_puppet_proxy_response(
    error_hosts,
    success_message: format(n_(
      'Updated host: removed %{proxy_type}',
      'Updated hosts: removed %{proxy_type}',
      @hosts.count
    ), proxy_type: proxy_type),
    error_message: format(n_(
      'Failed to remove %{proxy_type} for %{count} host',
      'Failed to remove %{proxy_type} for %{count} hosts',
      error_hosts.count
    ), proxy_type: proxy_type, count: error_hosts.count)
  )
end