Generate bootdisk subnet

Problem:
I try to generate a subnet bootdisk but I have this error :

Failed to render boot disk template: undefined method `content_source' for #<#<Class:0x0000000011913758>:0x0000000011912c40> Did you mean? contains_erb?

What that means ?

Expected outcome:
My iso file is generate like this “bootdisk_subnet_subnet-niort-posix.covea.priv.iso”

Foreman and Proxy versions:
1.20.2

Foreman and Proxy plugin versions:

# rpm -qa | grep hammer
tfm-rubygem-hammer_cli_foreman_docker-0.0.4-4.el7.noarch
tfm-rubygem-hammer_cli_foreman_virt_who_configure-0.0.3-3.el7.noarch
tfm-rubygem-hammer_cli_katello-0.15.0-1.el7.noarch
tfm-rubygem-hammer_cli_foreman_bootdisk-0.1.3-7.el7.noarch
tfm-rubygem-hammer_cli-0.15.1-1.el7.noarch
tfm-rubygem-hammer_cli_foreman_tasks-0.0.13-1.fm1_20.el7.noarch
tfm-rubygem-hammer_cli_foreman-0.15.1-1.el7.noarch

Other relevant data:
Debug command :

# hammer -d bootdisk subnet --subnet subnet-niort-posix.covea.priv
[ INFO 2019-06-18T16:11:03 Init] Initialization of Hammer CLI (0.15.1) has started...
[DEBUG 2019-06-18T16:11:03 Init] Running at ruby 2.5.3-p105
[ INFO 2019-06-18T16:11:03 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded
[ INFO 2019-06-18T16:11:03 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded
[ INFO 2019-06-18T16:11:03 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_admin.yml has been loaded
[ INFO 2019-06-18T16:11:03 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_admin_logging_core.yml has been loaded
[ INFO 2019-06-18T16:11:03 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_admin_logging_katello.yml has been loaded
[ INFO 2019-06-18T16:11:03 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_bootdisk.yml has been loaded
[ INFO 2019-06-18T16:11:03 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_docker.yml has been loaded
[ INFO 2019-06-18T16:11:03 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_tasks.yml has been loaded
[ INFO 2019-06-18T16:11:03 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_virt_who_configure.yml has been loaded
[ INFO 2019-06-18T16:11:03 Init] Configuration from the file /etc/hammer/cli.modules.d/katello.yml has been loaded
[ INFO 2019-06-18T16:11:03 Init] Configuration from the file /root/.hammer/cli.modules.d/foreman.yml has been loaded
[DEBUG 2019-06-18T16:11:04 SSLoptions] SSL options: {
    :ssl_ca_file => "/etc/pki/katello/certs/katello-server-ca.crt",
     :verify_ssl => true
}
[DEBUG 2019-06-18T16:11:04 API] Global headers: {
        :content_type => "application/json",
              :accept => "application/json;version=2",
    "Accept-Language" => "en"
}
[DEBUG 2019-06-18T16:11:04 API] Follow redirects: never
[DEBUG 2019-06-18T16:11:04 Connection] Registered: foreman
[ INFO 2019-06-18T16:11:04 Modules] Extension module hammer_cli_foreman (0.15.1) loaded.
[ INFO 2019-06-18T16:11:04 Modules] Extension module hammer_cli_foreman_admin (0.0.8) loaded.
[ INFO 2019-06-18T16:11:04 Modules] Extension module hammer_cli_foreman_bootdisk (0.1.3) loaded.
[ INFO 2019-06-18T16:11:04 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed.
[ INFO 2019-06-18T16:11:04 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created.
[ INFO 2019-06-18T16:11:04 Modules] Extension module hammer_cli_katello (0.15.0) loaded.
[DEBUG 2019-06-18T16:11:04 Init] Using locale 'en'
[DEBUG 2019-06-18T16:11:04 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.15.1/locale'
[DEBUG 2019-06-18T16:11:04 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.15.1/locale'
[DEBUG 2019-06-18T16:11:04 Init] 'mo' files for locale domain 'hammer_cli_foreman_docker' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_docker-0.0.4/locale'
[DEBUG 2019-06-18T16:11:04 Init] 'mo' files for locale domain 'hammer-cli-foreman-virt-who-configure' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman_virt_who_configure-0.0.3/locale'
[DEBUG 2019-06-18T16:11:04 Init] 'mo' files for locale domain 'hammer-cli-katello' loaded from '/opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_katello-0.15.0/locale'
[ INFO 2019-06-18T16:11:04 HammerCLI::MainCommand] Called with options: {"option_debug"=>true}
[ INFO 2019-06-18T16:11:04 HammerCLIForemanBootdisk::Bootdisk] Called with options: {}
[ INFO 2019-06-18T16:11:04 API] Server: https://foreman_master
[ INFO 2019-06-18T16:11:04 API] GET /api/subnets
[DEBUG 2019-06-18T16:11:04 API] Params: {
    :search => "name = \"subnet-niort-posix.covea.priv\""
}
[DEBUG 2019-06-18T16:11:04 API] Headers: {
    :params => {
        :search => "name = \"subnet-niort-posix.covea.priv\""
    }
}
[DEBUG 2019-06-18T16:11:04 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth
[DEBUG 2019-06-18T16:11:04 API] Response: {
       "total" => 2,
    "subtotal" => 1,
        "page" => 1,
    "per_page" => 20,
      "search" => "name = \"subnet-niort-posix.covea.priv\"",
        "sort" => {
           "by" => nil,
        "order" => nil
    },
     "results" => [
        [0] {
                    "network" => "10.231.0.0",
               "network_type" => "IPv4",
                       "cidr" => 22,
                       "mask" => "255.255.252.0",
                   "priority" => nil,
                     "vlanid" => 115,
                        "mtu" => 1500,
                    "gateway" => "10.231.0.3",
                "dns_primary" => "x.x.x.x",
              "dns_secondary" => "x.x.x.x",
                       "from" => "",
                         "to" => "",
                 "created_at" => "2019-06-14 08:08:56 UTC",
                 "updated_at" => "2019-06-14 08:08:56 UTC",
                       "ipam" => "None",
                  "boot_mode" => "DHCP",
                         "id" => 1,
                       "name" => "subnet-niort-posix.covea.priv",
                "description" => "",
            "network_address" => "10.231.0.0/22",
                    "dhcp_id" => nil,
                  "dhcp_name" => nil,
                    "tftp_id" => 4,
                  "tftp_name" => "smart_proxy",
                "httpboot_id" => nil,
              "httpboot_name" => nil,
                     "dns_id" => nil,
                "template_id" => 4,
              "template_name" => "smart_proxy",
                       "dhcp" => nil,
                       "tftp" => {
                "name" => "smart_proxy",
                  "id" => 4,
                 "url" => "https://smart_proxy:9090"
            },
                   "httpboot" => nil,
                        "dns" => nil,
                   "template" => {
                "name" => "smart_proxy",
                  "id" => 4,
                 "url" => "https://smart_proxy:9090"
            }
        }
    ]
}
[DEBUG 2019-06-18T16:11:04 API] Response headers: {
                                 :date => "Tue, 18 Jun 2019 14:11:04 GMT",
                               :server => "Apache/2.4.6 (CentOS)",
                      :foreman_version => "1.20.2",
                  :foreman_api_version => "2",
                      :apipie_checksum => "4386d06443d19fad941df8c94665d9096738e49c",
                        :cache_control => "max-age=0, private, must-revalidate",
                         :x_request_id => "48c00f9c-8989-418f-8e12-dfd7b3327064",
                            :x_runtime => "0.047431",
            :strict_transport_security => "max-age=631139040; includeSubdomains",
                      :x_frame_options => "sameorigin",
               :x_content_type_options => "nosniff",
                     :x_xss_protection => "1; mode=block",
                   :x_download_options => "noopen",
    :x_permitted_cross_domain_policies => "none",
              :content_security_policy => "default-src 'self'; child-src 'self'; connect-src 'self' ws: wss:; img-src 'self' data: *.gravatar.com; script-src 'unsafe-eval' 'unsafe-inline' 'self'; style-src 'unsafe-inline' 'self'",
                         :x_powered_by => "Phusion Passenger 4.0.53",
                           :set_cookie => [
        [0] "_session_id=f66358246aace5f7beb563bf2eb795b9; path=/; secure; HttpOnly; SameSite=Lax"
    ],
                                 :etag => "W/\"7605e2f1b9d23fa411d522bf5e0139dd-gzip\"",
                               :status => "200 OK",
                                 :vary => "Accept-Encoding",
                     :content_encoding => "gzip",
                       :content_length => "457",
                         :content_type => "application/json; charset=utf-8"
}
[ INFO 2019-06-18T16:11:04 HammerCLIForemanBootdisk::Bootdisk::SubnetCommand] Called with options: {"option_subnet_name"=>"subnet-niort-posix.covea.priv", "option_subnet_id"=>1}
[ INFO 2019-06-18T16:11:04 API] Server: https://foreman_master
[ INFO 2019-06-18T16:11:04 API] GET /bootdisk/api/subnets/1
[DEBUG 2019-06-18T16:11:04 API] Params: {}
[DEBUG 2019-06-18T16:11:04 API] Headers: {
    :params => {}
}
[DEBUG 2019-06-18T16:11:04 API] Using authenticator: HammerCLIForeman::Api::InteractiveBasicAuth
[ERROR 2019-06-18T16:11:04 API] 500 Internal Server Error
[DEBUG 2019-06-18T16:11:04 API] {
    "error" => {
        "message" => "Internal Server Error: the server was unable to finish the request. This may be caused by unavailability of some required service, incorrect API call or a server-side bug. There may be more information in the server's logs."
    }
}
[DEBUG 2019-06-18T16:11:04 Exception] Using exception handler HammerCLIForeman::ExceptionHandler#handle_internal_error
[ERROR 2019-06-18T16:11:04 Exception] Internal Server Error: the server was unable to finish the request. This may be caused by unavailability of some required service, incorrect API call or a server-side bug. There may be more information in the server's logs.
Failed to download subnet disk image:
  Internal Server Error: the server was unable to finish the request. This may be caused by unavailability of some required service, incorrect API call or a server-side bug. There may be more information in the server's logs.
[ERROR 2019-06-18T16:11:04 Exception]

RestClient::InternalServerError (500 Internal Server Error):
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/abstract_response.rb:223:in `exception_with_response'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/abstract_response.rb:103:in `return!'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/api.rb:353:in `block in rest_client_call_block'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/request.rb:807:in `process_result'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/request.rb:725:in `block in transmit'
    /opt/rh/rh-ruby25/root/usr/share/ruby/net/http.rb:910:in `start'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/request.rb:715:in `transmit'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/request.rb:145:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/request.rb:52:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/rest-client-2.0.1/lib/restclient/resource.rb:51:in `get'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/api.rb:327:in `call_client'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/api.rb:240:in `http_call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/api.rb:190:in `call_action'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/api.rb:185:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/apipie-bindings-0.2.2/lib/apipie_bindings/resource.rb:21:in `call'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.15.1/lib/hammer_cli/apipie/command.rb:51:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli_foreman-0.15.1/lib/hammer_cli_foreman/commands.rb:168:in `send_request'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.15.1/lib/hammer_cli/apipie/command.rb:34:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.15.1/lib/hammer_cli/abstract.rb:29:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.15.1/lib/hammer_cli/abstract.rb:29:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:63:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.15.1/lib/hammer_cli/abstract.rb:29:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/clamp-1.1.2/lib/clamp/command.rb:132:in `run'
    /opt/theforeman/tfm/root/usr/share/gems/gems/hammer_cli-0.15.1/bin/hammer:147:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'

Can you share the error in production.log? The one you pasted comes from hammer, that’s not much relevant.

@TimoGoebel or @Shimon_Shtein have you seen this? this is weird, entity is nil.

@lzap: Didn’t you fix this in https://github.com/theforeman/foreman_bootdisk/commit/b6e51fe8ab17a938c615ee96bbf489e5d31e5ba4?

1 Like

Oh that explains it, this patch did go into v15 but not v14. You can hotfix your instance, if you need this in Satellite create a BZ/case.

Correction, it was fixed in Satellite 6.5 already. It’s just broken in 1.20, upgrade to 1.21+ or hotfix your instance please.

Thanks for your reply and your quick help.

I upgraded my server to Foreman 1.22 and my proxy was in 1.21 … Okey, it’s work well … So, I decided to upgraded my proxy to 1.22 by following this Foreman :: Plugin Manuals but I have a error message
that I do not understand well :

foreman-installer --scenario foreman-proxy-content --upgrade --certs-tar-file /root/proxy.fqdn-certs.tar --certs-update-all --certs-regenerate true --certs-deploy true 
Please unset the following environment variables before running the installer: http_proxy, https_proxy, ssl_cert_file
Your system does not meet configuration criteria

I specify that I upgraded all packages on my system (include puppet 4 to puppet 6)

I suggest you to create properly entitled new post, this is not I am familiar with. To give you one hint - search for ERROR string in the log, there should be some reason.