Skip to content

Commit ebf9748

Browse files
lukeseawalkerdemartinofra
authored andcommitted
Setup proxy in event handler
Signed-off-by: Luca Carrogu <[email protected]>
1 parent cff90b1 commit ebf9748

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

cookbooks/aws-parallelcluster-byos/resources/execute_event_handler.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ def build_static_env(target_cluster_config, target_launch_templates, target_inst
180180
# PCLUSTER_CLUSTER_CONFIG_OLD
181181
# TODO: to be implemented
182182

183+
env.merge!(setup_proxy(:cluster, :proxy))
183184
env
184185
end
185186

@@ -190,6 +191,16 @@ def build_hash_from_node(name, raise_if_not_found, *path_in_node)
190191
var && !var.empty? ? { name => var } : {}
191192
end
192193

194+
def setup_proxy(*path_in_node)
195+
var = node.dig(*path_in_node)
196+
197+
if var && !var.empty?
198+
{ 'http_proxy' => var, 'HTTP_PROXY' => var, 'https_proxy' => var, 'HTTPS_PROXY' => var, 'no_proxy' => "localhost,127.0.0.1,169.254.169.254", 'NO_PROXY' => "localhost,127.0.0.1,169.254.169.254" }
199+
else
200+
{}
201+
end
202+
end
203+
193204
def command_with_retries(command, retries, user, cwd, env)
194205
retries_count = 0
195206
cmd = Mixlib::ShellOut.new(command, user: user, cwd: cwd, env: env)

0 commit comments

Comments
 (0)