Sha256: 6b2a1ddc08692571c7ab4317cfe115477774c02b0873a1d2c9fa9c2f4e9e236d

Contents?: true

Size: 1.11 KB

Versions: 13

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

require "json"

module Neetob
  class CLI
    module NeetoDeploy
      class Certificates < CLI::Base
        attr_accessor :app

        def initialize(app)
          super()
          @app = app
        end

        def run
          certificates_command_result = `neetodeploy certificates list -a #{app}`
          parseable_result = certificates_command_result.strip.gsub("=>", ":")

          parsed_certificates_result = JSON.parse(parseable_result)

          return parsed_certificates_result if Thread.current[:audit_mode]

          if parsed_certificates_result.empty?
            ui.error("No certificates found for the app with name \"#{app}\".")
          else
            parsed_certificates_result.each do |certificate|
              if certificate["expires_before_30_days"]
                ui.error("Certificate #{certificate["name"]} is expiring in less than 30 days.")
              else
                ui.success("Certificate #{certificate["name"]} is valid for over 30 days in the future.")
              end
            end
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

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