Bug 1192556
| Summary: | Apipie-bindings 0.0.11 breaks hammer-cli-import | ||
|---|---|---|---|
| Product: | Red Hat Satellite | Reporter: | Grant Gainey <ggainey> |
| Component: | Transitions | Assignee: | Grant Gainey <ggainey> |
| Status: | CLOSED ERRATA | QA Contact: | Lukas Pramuk <lpramuk> |
| Severity: | urgent | Docs Contact: | |
| Priority: | urgent | ||
| Version: | Nightly | CC: | bbuckingham, cperry, ggainey, jmontleo, mbacovsk |
| Target Milestone: | Unspecified | Keywords: | Regression, Triaged |
| Target Release: | Unused | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | rubygem-hammer_cli_import-0.10.7-1 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2015-08-12 05:25:39 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: | |||
PR#16 submitted My comment from the PR, just for a record:
Depending on instance variables is error prone, as they are not part of the library interface and can change even between minor versions.
If I understand it correctly the credentials obtained in the code above are used only for calling repository upload-content command from import. I'd suggest to reuse existing connection which will also prevent issues when we e.g. introduce other auth methods to hammer.
I'd suggest to call the upload-content command as follows:
require('hammer_cli_katello/repository')
HammerCLIKatello::Repository::UploadContentCommand.new("", context).run({'id' => <id>, 'path' => <path>})
katello/hammer-cli-import.git: eb7228cf69f213713e5c9766e897d4fd9af4a883 b7580590543f17e2b01ad893bc1637732a100453 VERIFIED. rubygem-hammer_cli_import-0.10.6.3-1.el6_6sat # hammer import organization --verbose --csv-file /tmp/exports/users.csv --upload-manifests-from '/tmp/manifests'' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.4/lib/hammer_cli/./apipie/../abstract.rb:68: warning: already initialized constant DEFAULT_LABEL_INDENT Importing from /tmp/exports/users.csv Creating new organization: RED HAT SATELLITE ENGINEERING Uploading manifest /tmp/manifests/RED_HAT_SATELLITE_ENGINEERING.zip to org-id 3 Waiting for the task [4b8d6deb-4594-4913-affb-ef5e30b47bcb] ................. Creating new organization: Organization #2 Uploading manifest /tmp/manifests/Organization__2.zip to org-id 4 Waiting for the task [6f5e9af6-4a48-4f7c-829b-7b83f52f4714] .......... Creating new organization: Organization #3 Uploading manifest /tmp/manifests/Organization__3.zip to org-id 5 Waiting for the task [3946507d-7ec2-48f4-8924-41d71e3d97d8] .......... Summary Created 3 organizations. Uploaded 3 manifests. This bug is slated to be released with Satellite 6.1. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHSA-2015:1592 |
Description of problem: Something changed in apipie-bindings that causes hammer-cli-import's usethereof to break with Error: undefined method `[]' for nil:NilClass Version-Release number of selected component (if applicable): hammer-cli-import-0.10.6 ruby193-rubygem-apipie-params-0.0.3-2.el6sat.noarch rubygem-apipie-bindings-0.0.11-1.el6_6sat.noarch How reproducible: Anything that attempts to actually use apipie-bindings, in hammer-import - e.g.: hammer -v import organization --csv-file /tmp/exports/users.csv --debug --verbose Actual results: [root@ibm-ls21-04 tmp]# hammer -v import organization --csv-file /tmp/exports/users.csv --debug --verbose /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.4/lib/hammer_cli/./apipie/../abstract.rb:68: warning: already initialized constant DEFAULT_LABEL_INDENT [ERROR 2015-02-13 11:54:08 Exception] Error: undefined method `[]' for nil:NilClass Error: undefined method `[]' for nil:NilClass [ERROR 2015-02-13 11:54:08 Exception] NoMethodError (undefined method `[]' for nil:NilClass): /usr/lib/ruby/gems/1.8/gems/hammer_cli_import-0.10.6/lib/hammer_cli_import/base.rb:118:in `api_init' /usr/lib/ruby/gems/1.8/gems/hammer_cli_import-0.10.6/lib/hammer_cli_import/base.rb:547:in `execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.4/lib/hammer_cli/./apipie/../abstract.rb:23:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.4/lib/hammer_cli/./apipie/../abstract.rb:23:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/subcommand/execution.rb:11:in `execute' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:67:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.4/lib/hammer_cli/./apipie/../abstract.rb:23:in `run' /usr/lib/ruby/gems/1.8/gems/clamp-0.6.2/lib/clamp/command.rb:125:in `run' /usr/lib/ruby/gems/1.8/gems/hammer_cli-0.1.4/bin/hammer:108 /usr/bin/hammer:19:in `load' /usr/bin/hammer:19 Expected results: Creation of organizations (for example) Additional info: The failing line is @api_usr = @api.instance_variable_get('@client').instance_variable_get('@options')[:user] from this initialization method: def api_init @api = HammerCLIForeman.foreman_api_connection.api @api_usr = @api.instance_variable_get('@client').instance_variable_get('@options')[:user] @api_pwd = @api.instance_variable_get('@client').instance_variable_get('@options')[:password] nil end Used to work, no longer does. MUST BE FIXED before 6.1 releases.