theforeman/foreman_maintain

View on GitHub
definitions/procedures/maintenance_mode/enable_maintenance_mode.rb

Summary

Maintainability
A
25 mins
Test Coverage
module Procedures::MaintenanceMode
  class EnableMaintenanceMode < ForemanMaintain::Procedure
    include ForemanMaintain::Concerns::Firewall::MaintenanceMode
    metadata do
      label :enable_maintenance_mode
      description 'Add maintenance_mode tables/chain to nftables/iptables'
      tags :pre_migrations
      after :sync_plans_disable
    end

    def run
      if feature(:instance).firewall
        feature(:instance).firewall.enable_maintenance_mode
      else
        notify_and_ask_to_install_firewall_utility
      end
    end
  end
end