From a092ed73a05d6362c1fb49c96f4b1fc1c0e85fb8 Mon Sep 17 00:00:00 2001 From: Joe Rafaniello Date: Mon, 6 May 2024 10:39:06 -0400 Subject: [PATCH] Delay load the net-scp require to avoid bloating eager loading require net/scp seems to be around 5 MB of memory and requires 122 files: 0 <+ net/scp (0.236512) (5308416) (122) If we ever are to eager load plugins, we need to avoid having them requiring client code at code load time. --- app/models/manageiq/providers/amazon/agent_coordinator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/manageiq/providers/amazon/agent_coordinator.rb b/app/models/manageiq/providers/amazon/agent_coordinator.rb index aeccbb218..51b9c8ecc 100644 --- a/app/models/manageiq/providers/amazon/agent_coordinator.rb +++ b/app/models/manageiq/providers/amazon/agent_coordinator.rb @@ -1,6 +1,5 @@ require 'yaml' require 'open3' -require 'net/scp' require 'tempfile' require 'linux_admin' require 'awesome_spawn' @@ -148,6 +147,7 @@ def ssa_queue private def scp_file(ip, username, auth_key, local_file, remote_file) + require 'net/scp' Net::SCP.upload!(ip, username, local_file, remote_file, :ssh => {:key_data => auth_key}) rescue => err _log.error(err.message)