Foreman-installer behind a http_proxy

Problem:
Unable to use local proxy
Foreman and Proxy versions:
Foreman 3.1
Distribution and version:
RHEL 8.5
Other relevant data:
Hello everyone,

Hopefully this is something easy, but I’ve been working on setting up a foreman with a discovery image, but unlike my testing environment, on production there’s a http proxy which I do not have control of. Due to this proxy, I’m unable to download the image. See below the output:

[root@machine ~]# foreman-installer \
>   --enable-foreman-proxy-plugin-discovery \
>   --foreman-proxy-plugin-discovery-install-images=true \
>   --foreman-proxy-plugin-discovery-source-url=https://downloads.theforeman.org/discovery/releases/3.5/
2022-02-04 18:36:18 [WARN  ] [boot] Unsetting environment variable 'http_proxy' for the duration of the install.
2022-02-04 18:36:18 [NOTICE] [root] Loading installer configuration. This will take some time.
(...)
2022-02-04 18:43:03 [NOTICE] [configure] 1500 configuration steps out of 2002 steps complete.
2022-02-04 18:45:04 [ERROR ] [configure] /Stage[main]/Foreman_proxy::Plugin::Discovery/Foreman_proxy::Remote_file[/var/lib/tftpboot/boot/fdi-image-latest.tar]/File[/var/lib/tftpboot/boot/fdi-image-latest.tar]: Could not evaluate: Could not retrieve file metadata for https://downloads.theforeman.org/discovery/releases/3.5/fdi-image-latest.tar: Request to https://downloads.theforeman.org/discovery/releases/3.5/fdi-image-latest.tar timed out connect operation after 120.02 seconds

The warning rightfully warns me that the variable is being unset, but without it, I’m unable to download the image. I’ve tried to look up a solution with foreman-installer --full-help but with no luck(it might be there and I had missed it).

Is there a way to preserve the variable in order to not face this error? Or an additional flag to activate? Any other suggestion is welcome too.

Hello all again,

I ended up creating an nginx instance on localhost on a different port and dumped all the needed files there. Not the most elegant of solutions, but it works, and I needed this done.
Thank you anyway for the eventuality that someone that had tried to look into this.

Or set the proxy in /etc/yum.conf

What also works is defining the proxy within the YUM configuration file. That way, after the installer disables the proxy from the environment variables, the package manager will still know the way to reach out the package repositories.

[root@foreman-01]# cat /etc/yum.conf
[main]
gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=True
best=True
skip_if_unavailable=False
proxy=http://proxy.local.com:8080

[root@foreman-01]# foreman-installer --scenario katello --foreman-initial-admin-username admin --foreman-initial-admin-password charter
2024-05-10 16:06:34 [WARN  ] [boot] <Array> ["Unsetting environment variable 'http_proxy' for the duration of the install."]
2024-05-10 16:06:34 [WARN  ] [boot] <Array> ["Unsetting environment variable 'https_proxy' for the duration of the install."]
2024-05-10 16:06:34 [WARN  ] [boot] <Array> ["Unsetting environment variable 'HTTP_PROXY' for the duration of the install."]
2024-05-10 16:06:34 [WARN  ] [boot] <Array> ["Unsetting environment variable 'HTTPS_PROXY' for the duration of the install."]
2024-05-10 16:06:34 [NOTICE] [root] Loading installer configuration. This will take some time.
2024-05-10 16:06:36 [NOTICE] [root] Running installer with log based terminal output at level NOTICE.
2024-05-10 16:06:36 [NOTICE] [root] Use -l to set the terminal output log level to ERROR, WARN, NOTICE, INFO, or DEBUG. See --full-help for definitions.
2024-05-10 16:09:11 [NOTICE] [configure] Starting system configuration.
2024-05-10 16:12:40 [NOTICE] [configure] 250 configuration steps out of 1439 steps complete.