Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1293569

Summary: hammer repository-set enable: undefined method `valid_substitutions?' for #<Katello::Util::CdnVarSubstitutor:0x00000010030588>
Product: Red Hat Satellite Reporter: Jan Hutař <jhutar>
Component: HammerAssignee: Katello Bug Bin <katello-bugs>
Status: CLOSED DUPLICATE QA Contact: Katello QA List <katello-qa-list>
Severity: high Docs Contact:
Priority: unspecified    
Version: NightlyCC: bbuckingham
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-01-15 13:57:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jan Hutař 2015-12-22 08:46:23 UTC
Description of problem:
Some hammer actions fails with "undefined method `valid_substitutions?' for #<Katello::Util::CdnVarSubstitutor:0x00000010030588>"


Version-Release number of selected component (if applicable):
6.1.6 compose Satellite-6.1.0-RHEL-7-20151218.0-Satellite-x86_64
# rpm -qa | grep -i hammer
rubygem-hammer_cli_foreman-0.1.4.15-1.el7sat.noarch
rubygem-hammer_cli_foreman_bootdisk-0.1.2.7-1.el7sat.noarch
rubygem-hammer_cli_foreman_discovery-0.0.1.10-1.el7sat.noarch
rubygem-hammer_cli_katello-0.0.7.19-1.el7sat.noarch
rubygem-hammer_cli_foreman_tasks-0.0.3.5-1.el7sat.noarch
rubygem-hammer_cli_import-0.10.20-1.el7sat.noarch
rubygem-hammer_cli-0.1.4.13-1.el7sat.noarch
rubygem-hammer_cli_gutterball-0.0.1.3-1.el7sat.noarch
rubygem-hammer_cli_foreman_docker-0.0.3.10-1.el7sat.noarch


How reproducible:
always


Steps to Reproduce:
1. # hammer --username <user> --password <pass> repository-set list \
     --product-id 6 | grep "Red Hat Enterprise Linux 6 Server (Kickstart)"
   1952 | kickstart | Red Hat Enterprise Linux 6 Server (Kickstart)
2. # hammer --username <user> --password <pass> repository-set enable \
     --product-id 6 --id 1952 --basearch x86_64 --releasever 6.5
   Could not enable repository:
      undefined method `valid_substitutions?' for #<Katello::Util::CdnVarSubstitutor:0x00000010030588>


Actual results:
First issue is it fails and second is error message talks about "repository" and not "repository set"


Expected results:
Error message should talk about "repository set" and most importantly command itself should work

Note error message correctness can be verified with (I have no product with ID 123):
# hammer --username <user> --password <pass> repository-set enable --product-id 123 --id 1952 --basearch x86_64 --releasever 6.5
Could not enable repository:
  Couldn't find product with id '123'

Comment 2 Jan Hutař 2015-12-22 08:54:56 UTC
This is an issue on both RHEL6 and RHEL7.

Hammer debug output is:

# hammer --debug --verbose --username <user> --password <pass> repository-set enable --product-id 6 --id 1952 --basearch x86_64 --releasever 6.5
[ INFO 2015-12-22 03:35:08 Init] Initialization of Hammer CLI (0.1.4.13) has started...
[DEBUG 2015-12-22 03:35:08 Init] Running at ruby 2.0.0-p598
[ INFO 2015-12-22 03:35:08 Init] Configuration from the file /etc/hammer/cli_config.yml has been loaded
[ INFO 2015-12-22 03:35:08 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman.yml has been loaded
[ INFO 2015-12-22 03:35:08 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_bootdisk.yml has been loaded
[ INFO 2015-12-22 03:35:08 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_discovery.yml has been loaded
[ INFO 2015-12-22 03:35:08 Init] Configuration from the file /etc/hammer/cli.modules.d/foreman_docker.yml has been loaded
[ INFO 2015-12-22 03:35:08 Init] Configuration from the file /etc/hammer/cli.modules.d/gutterball.yml has been loaded
[ INFO 2015-12-22 03:35:08 Init] Configuration from the file /etc/hammer/cli.modules.d/import.yml has been loaded
[ INFO 2015-12-22 03:35:08 Init] Configuration from the file /etc/hammer/cli.modules.d/katello.yml has been loaded
[DEBUG 2015-12-22 03:35:08 Connection] Registered: foreman
[DEBUG 2015-12-22 03:35:08 API] Global headers: {
        :content_type => "application/json",
              :accept => "application/json;version=2",
    "Accept-Language" => "en"
}
[ INFO 2015-12-22 03:35:09 Modules] Extension module hammer_cli_foreman (0.1.4.15) loaded
[ INFO 2015-12-22 03:35:09 Modules] Extension module hammer_cli_foreman_bootdisk (0.1.2.7) loaded
[ INFO 2015-12-22 03:35:09 Modules] Extension module hammer_cli_foreman_discovery (0.0.1.10) loaded
[ INFO 2015-12-22 03:35:09 HammerCLI::MainCommand] subcommand organization (HammerCLIForeman::Organization) was removed.
[ INFO 2015-12-22 03:35:09 HammerCLI::MainCommand] subcommand organization (HammerCLIKatello::Organization) was created.
[ INFO 2015-12-22 03:35:09 Modules] Extension module hammer_cli_gutterball (0.0.1.3) loaded
[ INFO 2015-12-22 03:35:09 Modules] Extension module hammer_cli_import (0.10.20) loaded
[ INFO 2015-12-22 03:35:09 Modules] Extension module hammer_cli_katello (0.0.7.19) loaded
[DEBUG 2015-12-22 03:35:09 Init] Using locale 'en'
[DEBUG 2015-12-22 03:35:09 Init] 'mo' files for locale domain 'hammer-cli' loaded from '/usr/share/gems/gems/hammer_cli-0.1.4.13/locale'
[DEBUG 2015-12-22 03:35:09 Init] 'mo' files for locale domain 'hammer-cli@system' loaded from '/usr/share/locale'
[DEBUG 2015-12-22 03:35:09 Init] 'mo' files for locale domain 'hammer-cli-foreman' loaded from '/usr/share/gems/gems/hammer_cli_foreman-0.1.4.15/locale'
[DEBUG 2015-12-22 03:35:09 Init] 'mo' files for locale domain 'hammer-cli-foreman@system' loaded from '/usr/share/locale'
[DEBUG 2015-12-22 03:35:09 Init] 'mo' files for locale domain 'hammer_cli_foreman_docker' loaded from '/usr/share/gems/gems/hammer_cli_foreman_docker-0.0.3.10/locale'
[DEBUG 2015-12-22 03:35:09 Init] 'mo' files for locale domain 'hammer-cli-katello' loaded from '/usr/share/gems/gems/hammer_cli_katello-0.0.7.19/locale'
[ INFO 2015-12-22 03:35:09 HammerCLI::MainCommand] Called with options: {"option_verbose"=>true, "option_debug"=>true, "option_username"=>"<user>", "option_password"=>"***"}
[ INFO 2015-12-22 03:35:09 HammerCLIKatello::RepositorySetCommand] Called with options: {}
[ INFO 2015-12-22 03:35:09 HammerCLIKatello::RepositorySetCommand::EnableCommand] Called with options: {"option_product_id"=>"6", "option_id"=>"1952", "option_basearch"=>"x86_64", "option_releasever"=>"6.5"}
[ INFO 2015-12-22 03:35:09 API] PUT /katello/api/products/6/repository_sets/1952/enable
[DEBUG 2015-12-22 03:35:09 API] Params: {
      "basearch" => "x86_64",
    "releasever" => "6.5"
}
[DEBUG 2015-12-22 03:35:09 API] Headers: {}
[DEBUG 2015-12-22 03:35:10 API] 500 Internal Server Error
{
    "displayMessage" => "undefined method `valid_substitutions?' for #<Katello::Util::CdnVarSubstitutor:0x00000010045f00>",
            "errors" => [
        [0] "undefined method `valid_substitutions?' for #<Katello::Util::CdnVarSubstitutor:0x00000010045f00>"
    ]
}
[ERROR 2015-12-22 03:35:10 Exception] undefined method `valid_substitutions?' for #<Katello::Util::CdnVarSubstitutor:0x00000010045f00>
Could not enable repository:
  undefined method `valid_substitutions?' for #<Katello::Util::CdnVarSubstitutor:0x00000010045f00>
[ERROR 2015-12-22 03:35:10 Exception] 

RestClient::InternalServerError (500 Internal Server Error):
    /usr/share/gems/gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:48:in `return!'
    /usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:230:in `process_result'
    /usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:178:in `block in transmit'
    /usr/share/ruby/net/http.rb:852:in `start'
    /usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit'
    /usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'
    /usr/share/gems/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'
    /usr/share/gems/gems/rest-client-1.6.7/lib/restclient/resource.rb:76:in `put'
    /usr/share/gems/gems/apipie-bindings-0.0.11/lib/apipie_bindings/api.rb:279:in `call_client'
    /usr/share/gems/gems/apipie-bindings-0.0.11/lib/apipie_bindings/api.rb:210:in `http_call'
    /usr/share/gems/gems/apipie-bindings-0.0.11/lib/apipie_bindings/api.rb:160:in `call'
    /usr/share/gems/gems/apipie-bindings-0.0.11/lib/apipie_bindings/resource.rb:14:in `call'
    /usr/share/gems/gems/hammer_cli-0.1.4.13/lib/hammer_cli/apipie/command.rb:43:in `send_request'
    /usr/share/gems/gems/hammer_cli_foreman-0.1.4.15/lib/hammer_cli_foreman/commands.rb:185:in `send_request'
    /usr/share/gems/gems/hammer_cli-0.1.4.13/lib/hammer_cli/apipie/command.rb:34:in `execute'
    /usr/share/gems/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/share/gems/gems/hammer_cli-0.1.4.13/lib/hammer_cli/abstract.rb:23:in `run'
    /usr/share/gems/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/share/gems/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/share/gems/gems/hammer_cli-0.1.4.13/lib/hammer_cli/abstract.rb:23:in `run'
    /usr/share/gems/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute'
    /usr/share/gems/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run'
    /usr/share/gems/gems/hammer_cli-0.1.4.13/lib/hammer_cli/abstract.rb:23:in `run'
    /usr/share/gems/gems/clamp-0.6.2/lib/clamp/command.rb:125:in `run'
    /usr/share/gems/gems/hammer_cli-0.1.4.13/bin/hammer:108:in `<top (required)>'
    /usr/bin/hammer:23:in `load'
    /usr/bin/hammer:23:in `<main>'

Comment 4 Brad Buckingham 2016-01-15 13:57:04 UTC

*** This bug has been marked as a duplicate of bug 1295572 ***