Class: ObsDeploy::CLI::Commands::GetPendingMigration

Inherits:
Dry::CLI::Command
  • Object
show all
Defined in:
lib/obs_deploy/cli/commands/get_pending_migration.rb

Instance Method Summary collapse

Instance Method Details

#call(url:, targeturl:, ignore_certificate:) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/obs_deploy/cli/commands/get_pending_migration.rb', line 12

def call(url:, targeturl:, ignore_certificate:, **)
  if ignore_certificate
    OpenSSL::SSL.send(:remove_const, :VERIFY_PEER)
    OpenSSL::SSL.const_set(:VERIFY_PEER, OpenSSL::SSL::VERIFY_NONE)
  end

  migrations = ObsDeploy::CheckDiff.new(server: url, target_server: targeturl).migrations

  if migrations.empty?
    puts 'No pending migrations'
    exit(0)
  else
    puts migrations
    exit(1)
  end
end