Bug 1389472

Summary: Rake command to import git repository doesn't handle userid/password and self signed certs
Product: Red Hat CloudForms Management Engine Reporter: mkanoor
Component: AutomateAssignee: mkanoor
Status: CLOSED CURRENTRELEASE QA Contact: Dmitry Misharov <dmisharo>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 5.7.0CC: cpelland, jhardy, mfalesni, mkanoor, obarenbo, simaishi, tfitzger
Target Milestone: GAKeywords: TestOnly
Target Release: 5.8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 5.8.0.0 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1390730 (view as bug list) Environment:
Last Closed: 2017-06-12 16:08:11 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:
Bug Depends On:    
Bug Blocks: 1390730    

Description mkanoor 2016-10-27 16:09:45 UTC
Description of problem:
The rake command to import git repository doesn't handle userid password and self signed certs

Version-Release number of selected component (if applicable):


How reproducible:
100%

Steps to Reproduce:
1. bin/rake evm:automate:import PREVIEW=false GIT_URL=<url> USERID=user PASSWORD=password VERIFY_SSL=0
2.
3.

Actual results:
** Using session_store: ActionDispatch::Session::MemCacheStore
Importing automate domain from url https://gitlab.cloudforms.lab.eng.rdu2.redhat.com/mkanoor/SimpleDomain
/Users/madhukanoor/devsrc/manageiq/app/models/git_repository.rb:98:in `rescue in repo_block'
/Users/madhukanoor/devsrc/manageiq/app/models/git_repository.rb:94:in `repo_block'
/Users/madhukanoor/devsrc/manageiq/app/models/git_repository.rb:79:in `init_repo'
/Users/madhukanoor/devsrc/manageiq/app/models/git_repository.rb:15:in `refresh'
/Users/madhukanoor/devsrc/manageiq/lib/miq_automation_engine/models/miq_ae_git_import.rb:50:in `create_repo'
/Users/madhukanoor/devsrc/manageiq/lib/miq_automation_engine/models/miq_ae_git_import.rb:26:in `pre_import'
/Users/madhukanoor/devsrc/manageiq/lib/miq_automation_engine/models/miq_ae_git_import.rb:13:in `import'
/Users/madhukanoor/devsrc/manageiq/lib/tasks/evm_automate.rake:170:in `block (3 levels) in <top (required)>'
/Users/madhukanoor/.gem/ruby/2.2.2/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/Users/madhukanoor/.gem/ruby/2.2.2/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in execute'
/Users/madhukanoor/.gem/ruby/2.2.2/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/Users/madhukanoor/.gem/ruby/2.2.2/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/Users/madhukanoor/.gem/ruby/2.2.2/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/Users/madhukanoor/.rubies/ruby-2.2.2/lib/ruby/2.2.0/monitor.rb:211:in `mon_synchronize'
/Users/madhukanoor/.gem/ruby/2.2.2/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/Users/madhukanoor/.gem/ruby/2.2.2/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/Users/madhukanoor/.gem/ruby/2.2.2/gems/rake-10.5.0/lib/rake/application.rb:150:in `invoke_task'
/Users/madhukanoor/.gem/ruby/2.2.2/gems/rake-10.5.0/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/madhukanoor/.gem/ruby/2.2.2/gems/rake-10.5.0/lib/rake/application.rb:106:in `each'
/Users/madhukanoor/.gem/ruby/2.2.2/gems/rake-10.5.0/lib/rake/application.rb:106:in `block in top_level'
/Users/madhukanoor/.gem/ruby/2.2.2/gems/rake-10.5.0/lib/rake/application.rb:115:in `run_with_threads'
/Users/madhukanoor/.gem/ruby/2.2.2/gems/rake-10.5.0/lib/rake/application.rb:100:in `top_level'
/Users/madhukanoor/.gem/ruby/2.2.2/gems/rake-10.5.0/lib/rake/application.rb:78:in `block in run'
/Users/madhukanoor/.gem/ruby/2.2.2/gems/rake-10.5.0/lib/rake/application.rb:176:in `standard_exception_handling'
/Users/madhukanoor/.gem/ruby/2.2.2/gems/rake-10.5.0/lib/rake/application.rb:75:in `run'
bin/rake:4:in `<main>'
Rugged operation failed

Expected results:
Should import using the given credentials

Additional info:

Comment 3 CFME Bot 2016-10-27 17:56:13 UTC
New commit detected on ManageIQ/manageiq/master:
https://github.com/ManageIQ/manageiq/commit/9a1176d97592eecd89e7ed322ce0dfc600a04830

commit 9a1176d97592eecd89e7ed322ce0dfc600a04830
Author:     Madhu Kanoor <mkanoor>
AuthorDate: Thu Oct 27 12:23:25 2016 -0400
Commit:     Madhu Kanoor <mkanoor>
CommitDate: Thu Oct 27 12:24:48 2016 -0400

    Fixed userid and password issue
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1389472

 lib/miq_automation_engine/models/miq_ae_git_import.rb           | 2 +-
 lib/tasks/evm_automate.rake                                     | 2 +-
 spec/lib/miq_automation_engine/models/miq_ae_git_import_spec.rb | 2 ++
 3 files changed, 4 insertions(+), 2 deletions(-)

Comment 4 CFME Bot 2016-11-01 15:56:05 UTC
New commit detected on ManageIQ/manageiq/euwe:
https://github.com/ManageIQ/manageiq/commit/d149d8a57745263b78ac21c48697502298b323a3

commit d149d8a57745263b78ac21c48697502298b323a3
Author:     Jason Frey <fryguy9>
AuthorDate: Thu Oct 27 13:52:19 2016 -0400
Commit:     Oleg Barenboim <chessbyte>
CommitDate: Tue Nov 1 11:53:52 2016 -0400

    Merge pull request #12249 from mkanoor/userid_password_not_set
    
    Fixed userid and password issue
    (cherry picked from commit cb21c38e5ba891b7a911dd3d9bf8d45c2eade00d)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1389472

 lib/miq_automation_engine/models/miq_ae_git_import.rb           | 2 +-
 lib/tasks/evm_automate.rake                                     | 2 +-
 spec/lib/miq_automation_engine/models/miq_ae_git_import_spec.rb | 2 ++
 3 files changed, 4 insertions(+), 2 deletions(-)

Comment 7 mkanoor 2017-03-14 15:28:21 UTC
Can we test with simple passwords and if it works close this issue out and create a new  BZ saying certain characters like "!" are not supported in Password fields.

Comment 9 mkanoor 2017-03-17 14:58:37 UTC
Can you check with Dave Johnson.

Comment 10 Milan Falešník 2017-04-04 13:14:48 UTC
So, I verified that this works somehow in 5.8.0.8 when I pushed my testing domain into my private bitbucket repo.

There are a couple of weird quirks which happen when it encounters a non-standard situation:
* When https authentication is required but you don't pass the credentials, it throws a traceback instead of a well-formatted error:
/var/www/miq/vmdb/app/models/git_repository.rb:100:in `rescue in repo_block'
/var/www/miq/vmdb/app/models/git_repository.rb:96:in `repo_block'
/var/www/miq/vmdb/app/models/git_repository.rb:81:in `init_repo'
/var/www/miq/vmdb/app/models/git_repository.rb:17:in `refresh'
/var/www/miq/vmdb/lib/miq_automation_engine/models/miq_ae_git_import.rb:51:in `create_repo'
/var/www/miq/vmdb/lib/miq_automation_engine/models/miq_ae_git_import.rb:26:in `pre_import'
/var/www/miq/vmdb/lib/miq_automation_engine/models/miq_ae_git_import.rb:13:in `import'
/var/www/miq/vmdb/lib/tasks/evm_automate.rake:170:in `block (3 levels) in <top (required)>'
/opt/rh/cfme-gemset/gems/rake-12.0.0/lib/rake/task.rb:250:in `block in execute'
/opt/rh/cfme-gemset/gems/rake-12.0.0/lib/rake/task.rb:250:in `each'
/opt/rh/cfme-gemset/gems/rake-12.0.0/lib/rake/task.rb:250:in `execute'
/opt/rh/cfme-gemset/gems/rake-12.0.0/lib/rake/task.rb:194:in `block in invoke_with_call_chain'
/opt/rh/rh-ruby23/root/usr/share/ruby/monitor.rb:214:in `mon_synchronize'
/opt/rh/cfme-gemset/gems/rake-12.0.0/lib/rake/task.rb:187:in `invoke_with_call_chain'
/opt/rh/cfme-gemset/gems/rake-12.0.0/lib/rake/task.rb:180:in `invoke'
/opt/rh/cfme-gemset/gems/rake-12.0.0/lib/rake/application.rb:152:in `invoke_task'
/opt/rh/cfme-gemset/gems/rake-12.0.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
/opt/rh/cfme-gemset/gems/rake-12.0.0/lib/rake/application.rb:108:in `each'
/opt/rh/cfme-gemset/gems/rake-12.0.0/lib/rake/application.rb:108:in `block in top_level'
/opt/rh/cfme-gemset/gems/rake-12.0.0/lib/rake/application.rb:117:in `run_with_threads'
/opt/rh/cfme-gemset/gems/rake-12.0.0/lib/rake/application.rb:102:in `top_level'
/opt/rh/cfme-gemset/gems/rake-12.0.0/lib/rake/application.rb:80:in `block in run'
/opt/rh/cfme-gemset/gems/rake-12.0.0/lib/rake/application.rb:178:in `standard_exception_handling'
/opt/rh/cfme-gemset/gems/rake-12.0.0/lib/rake/application.rb:77:in `run'
bin/rake:4:in `<main>'
wrong argument type nil (expected String)

* if you pass a wrong password, it will look stuck after "Importing automate domain from url ...". I left it running for 10 minutes and nothing happened.

So, I will be filing a BZ on these today probably.

Comment 11 mkanoor 2017-04-17 15:43:17 UTC
Yes please open a ticket on that, from what I recall the rugged API doesn't have a way of categorizing these errors so we get a generic network error.