Module: PuppetdbForeman::HostExtensions
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/puppetdb_foreman/host_extensions.rb
Instance Method Summary collapse
-
#deactivate_host ⇒ Object
rubocop:disable Metrics/MethodLength.
Instance Method Details
#deactivate_host ⇒ Object
rubocop:disable Metrics/MethodLength
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/models/puppetdb_foreman/host_extensions.rb', line 12 def deactivate_host # rubocop:disable Metrics/MethodLength logger.debug "Deactivating host #{name} in PuppetDB" return true unless Puppetdb.enabled? unless Puppetdb.configured? errors.add(:base, _('PuppetDB plugin is enabled but not configured. Please configure it before trying to delete a host.')) # rubocop:disable Layout/LineLength end begin Puppetdb.client.deactivate_node(name) rescue StandardError => e errors.add(:base, _("Could not deactivate host on PuppetDB: #{e}")) false end end |