Bug 1223345

Summary: hammer import organization of an existing name fails to use any recover strategy
Product: Red Hat Satellite Reporter: Lukas Pramuk <lpramuk>
Component: TransitionsAssignee: Christine Fouant <cfouant>
Status: CLOSED CURRENTRELEASE QA Contact: Lukas Pramuk <lpramuk>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: UnspecifiedCC: bbuckingham, bkearney, cperry, ggainey
Target Milestone: UnspecifiedKeywords: Regression, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
URL: http://projects.theforeman.org/issues/10696
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-08-12 14:00: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:

Description Lukas Pramuk 2015-05-20 11:32:17 UTC
Description of problem:
hammer import organization of an existing name fails to use any recover strategy

Version-Release number of selected component (if applicable):
Satellite-6.1.0-RHEL-6-20150513.0
rubygem-hammer_cli_import-0.10.6.5-1.el6_6sat.noarch

How reproducible:
100%

Steps to Reproduce:
1. Sat6 has an organization already created manually (for reproducer we can use a CLI)
# hammer import organization --verbose --csv-file users.csv
Importing from users.csv
Creating new organization: ORGANIZATION
Summary
  Created 1 organization.

2. Reset the import tool
# rm -rf ~/.transition_data/

3. Import org of the same name
# hammer import organization --verbose --csv-file users.csv
Importing from users.csv
Creating new organization: ORGANIZATION
Caught RestClient::InternalServerError:500 Internal Server Error while processing CSV line:
{"organization_id"=>"1", "organization"=>"ORGANIZATION"}
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/abstract_response.rb:48:in `return!'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:230:in `process_result'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:178:in `transmit'
/usr/lib/ruby/1.8/net/http.rb:543:in `start'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'
/usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/resource.rb:71:in `post'
/usr/lib/ruby/gems/1.8/gems/apipie-bindings-0.0.11/lib/apipie_bindings/api.rb:279:in `send'
/usr/lib/ruby/gems/1.8/gems/apipie-bindings-0.0.11/lib/apipie_bindings/api.rb:279:in `call_client'
/usr/lib/ruby/gems/1.8/gems/apipie-bindings-0.0.11/lib/apipie_bindings/api.rb:210:in `http_call'
/usr/lib/ruby/gems/1.8/gems/apipie-bindings-0.0.11/lib/apipie_bindings/api.rb:161:in `call'
/usr/lib/ruby/gems/1.8/gems/apipie-bindings-0.0.11/lib/apipie_bindings/resource.rb:14:in `call'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_import-0.10.6.5/lib/hammer_cli_import/base.rb:128:in `api_call'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_import-0.10.6.5/lib/hammer_cli_import/base.rb:138:in `api_call'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_import-0.10.6.5/lib/hammer_cli_import/base.rb:143:in `mapped_api_call'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_import-0.10.6.5/lib/hammer_cli_import/base.rb:416:in `_create_entity'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_import-0.10.6.5/lib/hammer_cli_import/base.rb:370:in `create_entity'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_import-0.10.6.5/lib/hammer_cli_import/organization.rb:84:in `import_single_row'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_import-0.10.6.5/lib/hammer_cli_import/base.rb:511:in `call'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_import-0.10.6.5/lib/hammer_cli_import/base.rb:511:in `cvs_iterate'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_import-0.10.6.5/lib/hammer_cli_import/importtools.rb:303:in `call'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_import-0.10.6.5/lib/hammer_cli_import/importtools.rb:303:in `handle_missing_and_supress'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_import-0.10.6.5/lib/hammer_cli_import/base.rb:510:in `cvs_iterate'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_import-0.10.6.5/lib/hammer_cli_import/csvhelper.rb:52:in `csv_each'
/usr/lib/ruby/gems/1.8/gems/fastercsv-1.5.4/lib/faster_csv.rb:1545:in `each'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_import-0.10.6.5/lib/hammer_cli_import/csvhelper.rb:43:in `csv_each'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_import-0.10.6.5/lib/hammer_cli_import/base.rb:509:in `cvs_iterate'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_import-0.10.6.5/lib/hammer_cli_import/base.rb:517:in `import'
/usr/lib/ruby/gems/1.8/gems/hammer_cli_import-0.10.6.5/lib/hammer_cli_import/base.rb:553: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.10/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.10/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.10/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.10/bin/hammer:108
/usr/bin/hammer:19:in `load'
/usr/bin/hammer:19
Summary
  No action taken.

Actual results:
ISE, organization not created

Expected results:
avoid ISE and create organization with differrent name or reuse existing one, depends on chosen recover strategy

Comment 1 RHEL Program Management 2015-05-20 11:32:52 UTC
Since this issue was entered in Red Hat Bugzilla, the release flag has been
set to ? to ensure that it is properly evaluated for this release.

Comment 4 Lukas Pramuk 2015-05-20 12:04:39 UTC
Updated to rubygem-hammer_cli_import-0.10.13-1.el7.noarch
The bug still present (though traceback msg is hidden)

# hammer import organization --verbose --csv-file users.csv
Importing from users.csv
Creating new organization: ORGANIZATION
Caught RestClient::InternalServerError:500 Internal Server Error while processing CSV line:
{"organization_id"=>"1", "organization"=>"ORGANIZATION"}
Summary
  No action taken.

Comment 6 Christine Fouant 2015-06-03 21:11:12 UTC
Created redmine issue http://projects.theforeman.org/issues/10696 from this bug

Comment 7 Bryan Kearney 2015-06-04 06:05:53 UTC
Moving to POST since upstream bug http://projects.theforeman.org/issues/10696 has been closed
-------------
Christine Fouant
Applied in changeset commit:katello|45aec9b88a184ab820ba298f23fa433c695ecd22.

Comment 10 Lukas Pramuk 2015-06-11 11:45:56 UTC
VERIFIED.
rubygem-hammer_cli_import-0.10.17-1.el6_6sat
@Satellite-6.1.0-RHEL-6-20150610.5

by comment#0 reproducer:

...
3. # hammer import organization --verbose --csv-file users.csv
Importing from users.csv
Creating new organization: ORGANIZATION
 Creation of organization failed.
 Recovering by renaming to: "name"="1-ORGANIZATION"
Creating new organization: 1-ORGANIZATION
Summary
  Created 1 organization.

Comment 11 Bryan Kearney 2015-08-11 13:26:02 UTC
This bug is slated to be released with Satellite 6.1.

Comment 12 Bryan Kearney 2015-08-12 14:00:39 UTC
This bug was fixed in version 6.1.1 of Satellite which was released on 12 August, 2015.