Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix userid in transformation throttler launch #439

Conversation

ghost
Copy link

@ghost ghost commented Oct 3, 2018

In the existing implementation, the user_id passed to create_automation_request is hard coded to 1. And that's obviously a bad idea. In the real world, the id of the admin user is derived from the region number, as all the ids in the VMDB.

A constant information is that the userid is admin, so it allows to retrieve the correct user object from the VMDB and use its id instead of 1. This PR implements that change.

Associated RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=1594196

@ghost
Copy link
Author

ghost commented Oct 3, 2018

@miq-bot add-label transformation, bug, hammer/yes

@miq-bot
Copy link
Member

miq-bot commented Oct 3, 2018

Checked commit fabiendupont@5fd8107 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
2 files checked, 0 offenses detected
Everything looks fine. 🍪

@gmcculloug gmcculloug self-assigned this Oct 3, 2018
it "with default values" do
allow(ae_service).to receive(:vmdb).with(:user).and_return(svc_vmdb_handle)
allow(svc_vmdb_handle).to receive(:find_by).with(:userid => 'admin').and_return(svc_model_user)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can do this with less stubbing.

Instead of a let block just replace these two allow lines with
user_admin = FactoryGirl.create(:user, :userid => 'admin')

Then update the hash below with the variable name for the user object:
:user_id => user_admin.id,

@gmcculloug
Copy link
Member

@fdupont-redhat Please squash that last commit and we'll be ready to merge.

@ghost ghost force-pushed the v2v_fix_admin_userid_in_throttler_launch branch from 9459ef1 to 9191e62 Compare October 4, 2018 11:57
@gmcculloug gmcculloug merged commit 5688461 into ManageIQ:master Oct 4, 2018
@gmcculloug gmcculloug added this to the Sprint 96 Ending Oct 8, 2018 milestone Oct 4, 2018
simaishi pushed a commit that referenced this pull request Oct 5, 2018
…hrottler_launch

Fix userid in transformation throttler launch

(cherry picked from commit 5688461)

https://bugzilla.redhat.com/show_bug.cgi?id=1594196
@simaishi
Copy link
Contributor

simaishi commented Oct 5, 2018

Hammer backport details:

$ git log -1
commit e130743043012631bcd4f0bc26ef41a9103f5115
Author: Greg McCullough <gmccullo@redhat.com>
Date:   Thu Oct 4 16:47:07 2018 -0400

    Merge pull request #439 from fdupont-redhat/v2v_fix_admin_userid_in_throttler_launch
    
    Fix userid in transformation throttler launch
    
    (cherry picked from commit 5688461f40a7e4a0b1f507202b910e8a0ffbea5b)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1594196

@ghost ghost deleted the v2v_fix_admin_userid_in_throttler_launch branch October 15, 2018 20:20
ghost pushed a commit to fabiendupont/manageiq-content that referenced this pull request Oct 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants