Class: Actions::ForemanChef::Client::Destroy
- Inherits:
-
EntryAction
- Object
- EntryAction
- Actions::ForemanChef::Client::Destroy
- Defined in:
- app/lib/actions/foreman_chef/client/destroy.rb
Instance Method Summary collapse
Instance Method Details
#humanized_input ⇒ Object
28 29 30 |
# File 'app/lib/actions/foreman_chef/client/destroy.rb', line 28 def humanized_input input[:fqdn] end |
#humanized_name ⇒ Object
24 25 26 |
# File 'app/lib/actions/foreman_chef/client/destroy.rb', line 24 def humanized_name _("Delete client") end |
#plan(fqdn, proxy) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/lib/actions/foreman_chef/client/destroy.rb', line 6 def plan(fqdn, proxy) if ::Setting[:auto_deletion] && proxy.present? client_exists_in_chef = proxy.show_client(fqdn) if client_exists_in_chef plan_self :chef_proxy_id => proxy.id, :fqdn => fqdn end end rescue => e ::Foreman::Logging.exception('Unable to communicate with Chef proxy', e) raise ::ForemanChef::ProxyException.new(N_('Unable to communicate with Chef proxy, %s' % e.)) end |
#run ⇒ Object
18 19 20 21 22 |
# File 'app/lib/actions/foreman_chef/client/destroy.rb', line 18 def run proxy = ::SmartProxy.unscoped.find_by_id(input[:chef_proxy_id]) action_logger.debug "Deleting client #{input[:fqdn]} on proxy #{proxy.name} at #{proxy.url}" self.output = proxy.delete_client(input[:fqdn]) end |