lib/command/maintenance.rb in cpflow-3.0.1 vs lib/command/maintenance.rb in cpflow-4.0.0

- old
+ new

@@ -15,28 +15,16 @@ - Optionally specify the maintenance workload through `maintenance_workload` in the `.controlplane/controlplane.yml` file (defaults to 'maintenance') - Maintenance mode is only supported for domains that use path based routing mode and have a route configured for the prefix '/' on either port 80 or 443 DESC WITH_INFO_HEADER = false - def call # rubocop:disable Metrics/MethodLength - one_off_workload = config[:one_off_workload] - maintenance_workload = config.current[:maintenance_workload] || "maintenance" + def call + puts maintenance_mode.enabled? ? "on" : "off" + end - domain_data = if config.domain - cp.fetch_domain(config.domain) - else - cp.find_domain_for([one_off_workload, maintenance_workload]) - end - unless domain_data - raise "Can't find domain. " \ - "Maintenance mode is only supported for domains that use path based routing mode " \ - "and have a route configured for the prefix '/' on either port 80 or 443." - end + private - if cp.domain_workload_matches?(domain_data, maintenance_workload) - puts "on" - else - puts "off" - end + def maintenance_mode + @maintenance_mode ||= MaintenanceMode.new(self) end end end