Hammer Could not load the API description from the server

Problem:
Could not load the API description from the server:
Failed to open TCP connection to : (getaddrinfo: Name or service not known)

  • is the server down?
  • was ‘foreman-rake apipie:cache’ run on the server when using apipie cache? (typical production settings)
    Warning: An error occured while loading module hammer_cli_foreman.

Expected outcome:

Foreman and Proxy versions:

RH8.8 with Foreman v 3.7 and Katello v 4.9

This is a new installation.
Have ran the command foreman-rake apipie:cache
/root/.hammer/cli.modules.d/foreman.yml has been configured.
All modules in /etc/hammer/cli.modules.d are enabled.
foreman-maintain health check fails at the hammer-setup stage. I’m assuming due to the error.
Hammer log contains the above error.
Have restarted foreman server.
foreman-maintain service status returns OK.

Other relevant data:
hammer -d returns:

[ERROR 2023-09-13T11:33:50 API] Failed to open TCP connection to : (getaddrinfo: Name or service not known)
[DEBUG 2023-09-13T11:33:50 API] #<SocketError: Failed to open TCP connection to : (getaddrinfo: Name or service not known)>
[DEBUG 2023-09-13T11:33:50 HammerCLIForeman::CommandExtensions::OptionSources] Added predefined options for HammerCLIForeman::Command:
[ INFO 2023-09-13T11:33:50 Extensions] Applied HammerCLIForeman::CommandExtensions::OptionSources for all except nothing on HammerCLIForeman::Command.
[DEBUG 2023-09-13T11:33:50 HammerCLIForeman::CommandExtensions::Fields] Added predefined options for HammerCLIForeman::ListCommand: [:fields]
[ INFO 2023-09-13T11:33:50 Extensions] Applied HammerCLIForeman::CommandExtensions::Fields for all except nothing on HammerCLIForeman::ListCommand.
[DEBUG 2023-09-13T11:33:50 HammerCLIForeman::CommandExtensions::Fields] Added predefined options for HammerCLIForeman::InfoCommand: [:fields]
[ INFO 2023-09-13T11:33:50 Extensions] Applied HammerCLIForeman::CommandExtensions::Fields for all except nothing on HammerCLIForeman::InfoCommand.
[DEBUG 2023-09-13T11:33:50 HammerCLIForeman::CommandExtensions::UpdateCommon] Added predefined options for HammerCLIForeman::UpdateCommand:
[ INFO 2023-09-13T11:33:50 Extensions] Applied HammerCLIForeman::CommandExtensions::UpdateCommon for all except nothing on HammerCLIForeman::UpdateCommand.
[ INFO 2023-09-13T11:33:50 API] Server: https://foremanserver.com
[ INFO 2023-09-13T11:33:50 API] GET /apidoc/v2.en_GB.json
[DEBUG 2023-09-13T11:33:50 API] Params: {}
[DEBUG 2023-09-13T11:33:50 API] Headers: {
:accept => “application/json”,
:params => {}

Any assisstance would be appreciated.

You seem to have some sort of DNS/name resolution problem. It looks like your Foreman server cannot resolve it’s own name.

Turns out our proxy server was blocking requests to the Foreman server.
Unsetting the proxy variable resolved the problem.