Sha256: b522cb6aa8c343805b49aa630403f157139a0e35c29d9169b0f96a951a05c3d8

Contents?: true

Size: 1.88 KB

Versions: 12

Compression:

Stored size: 1.88 KB

Contents

# frozen_string_literal: true

module Neetob
  class CLI
    module MonthlyAudit
      module InstancesAndAddons
        module NeetoDeploy
          class AutoScalingEnabled < CLI::Base
            def initialize
              super()
            end

            def run
              ui.success "### 3.1.4. Checking whether auto-scaling is enabled"

              apps_data = [["App", "Autoscaling config", "Comments", "Audit Passed"]]
              ui.info("\n", print_to_audit_log: false)
              Neetob::CLI::Sre::Base::APPS_LIST[:neetodeploy].select { |app| app.include?("production") }.each do |app|
                ui.info("Checking auto_scaling config for #{app}", print_to_audit_log: false)
                autoscaling_config_result = Neetob::CLI::NeetoDeploy::AutoscalingConfig.new(app).run
                audit_passed = nil
                comments = nil
                autoscaling_config = nil
                if autoscaling_config_result.is_a?(Hash) && autoscaling_config_result["error"] == "Forbidden"
                  audit_passed = "No"
                  comments = "You do not have permission to access the config for this app."
                else
                  autoscaling_config = JSON.parse(autoscaling_config_result.gsub("=>", ":"))
                  autoscaling_turned_on_for_web = autoscaling_config["web"]
                  autoscaling_turned_on_for_worker = autoscaling_config["worker"]

                  audit_passed = autoscaling_turned_on_for_web && autoscaling_turned_on_for_worker ? "Yes" : "No"
                  if audit_passed == "No"
                    comments = "Auto-scaling is not enabled for web and/or worker dynos."
                  end
                end
                apps_data << [app, autoscaling_config, comments, audit_passed]
              end
              ui.print_table(apps_data)
            end
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
neetob-0.5.28 lib/neetob/cli/monthly_audit/instances_and_addons/neeto_deploy/auto_scaling_enabled.rb
neetob-0.5.27 lib/neetob/cli/monthly_audit/instances_and_addons/neeto_deploy/auto_scaling_enabled.rb
neetob-0.5.26 lib/neetob/cli/monthly_audit/instances_and_addons/neeto_deploy/auto_scaling_enabled.rb
neetob-0.5.25 lib/neetob/cli/monthly_audit/instances_and_addons/neeto_deploy/auto_scaling_enabled.rb
neetob-0.5.24 lib/neetob/cli/monthly_audit/instances_and_addons/neeto_deploy/auto_scaling_enabled.rb
neetob-0.5.23 lib/neetob/cli/monthly_audit/instances_and_addons/neeto_deploy/auto_scaling_enabled.rb
neetob-0.5.22 lib/neetob/cli/monthly_audit/instances_and_addons/neeto_deploy/auto_scaling_enabled.rb
neetob-0.5.21 lib/neetob/cli/monthly_audit/instances_and_addons/neeto_deploy/auto_scaling_enabled.rb
neetob-0.5.20 lib/neetob/cli/monthly_audit/instances_and_addons/neeto_deploy/auto_scaling_enabled.rb
neetob-0.5.19 lib/neetob/cli/monthly_audit/instances_and_addons/neeto_deploy/auto_scaling_enabled.rb
neetob-0.5.18 lib/neetob/cli/monthly_audit/instances_and_addons/neeto_deploy/auto_scaling_enabled.rb
neetob-0.5.17 lib/neetob/cli/monthly_audit/instances_and_addons/neeto_deploy/auto_scaling_enabled.rb