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

Remove all VMware MKS console-related records from SettingSchanges #166

Merged
merged 1 commit into from
Apr 25, 2018

Conversation

skateman
Copy link
Member

@skateman skateman commented Feb 6, 2018

This feature has been dropped in fine and later, however, the migration was missing. There's also a PR for EUWE: ManageIQ/manageiq#16909

https://bugzilla.redhat.com/show_bug.cgi?id=1513592

@miq-bot assign @bdunne
@miq-bot add_label fine/yes, gaprindashvili/yes

let(:server) { server_stub.create }

before do
settings_stub.create(:resource => server, :key => '/server/remote_console_type', :value => 'MKS')
Copy link
Member

Choose a reason for hiding this comment

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

This can be inside the it since there's only 1 test.

@@ -0,0 +1,7 @@
class DropWebmks < ActiveRecord::Migration[5.0]
class SettingsChange < ApplicationRecord; end
Copy link
Member

Choose a reason for hiding this comment

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

I think we want ActiveRecord::Base to be the parent class in this case since migrations shouldn't be using any models. cc @Fryguy

class SettingsChange < ApplicationRecord; end

def up
SettingsChange.where(:resource_type => 'MiqServer', :key => '/server/remote_console_type', :value => 'MKS').delete_all
Copy link
Member

Choose a reason for hiding this comment

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

We don't need the :resource_type. Removing that from the scope would probably be a good idea in case someone added it to a zone settings.

@skateman skateman force-pushed the drop-mks branch 3 times, most recently from 4a89df3 to a670999 Compare February 8, 2018 16:12
let(:server) { server_stub.create }

it 'resets the remote_console_type to default' do
settings_stub.create(:resource => server, :key => '/server/remote_console_type', :value => 'MKS')
Copy link
Member

Choose a reason for hiding this comment

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

Now the tests are failing because you either need to specify :resource_type and :resource_id or define the relation in the class defined above.

@skateman skateman force-pushed the drop-mks branch 2 times, most recently from 2663b83 to 3c73b2f Compare February 9, 2018 13:00
class SettingsChange < ActiveRecord::Base; end

def up
SettingsChange.where(:key => '/server/remote_console_type', :value => 'MKS').delete_all
Copy link
Contributor

Choose a reason for hiding this comment

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

you can wrap it with say_with_time

Copy link
Member

@bdunne bdunne left a comment

Choose a reason for hiding this comment

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

👍 LGTM, @Fryguy

@Fryguy
Copy link
Member

Fryguy commented Mar 20, 2018

Migrations cannot be backported. If these records are in the database is there a problem with that?

settings_stub.create(:resource_id => server.id, :resource_type => server.class, :key => '/server/remote_console_type', :value => 'MKS')
migrate

expect(settings_stub.where(:key => '/server/remote_console_type', :value => 'MKS').count).to be_zero
Copy link
Member

Choose a reason for hiding this comment

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

expect(stuff).to_not exist

@Fryguy
Copy link
Member

Fryguy commented Mar 20, 2018

Code-wise looks good to me, but I want to understand the backport strategy before merging.

Copy link
Member

@Fryguy Fryguy left a comment

Choose a reason for hiding this comment

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

See above

@Fryguy Fryguy self-assigned this Mar 20, 2018
@skateman
Copy link
Member Author

@Fryguy well we had a discussion with @bdunne at the original euwe-only PR, check it out.

@skateman
Copy link
Member Author

@Fryguy I moved out the schema code from the #16909. After a little bit of thinking I don't think this is really necessary but it would not do any harm, so your call to merge or close.

@miq-bot
Copy link
Member

miq-bot commented Apr 25, 2018

Checked commit skateman@c7f75ab 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. 👍

@Fryguy Fryguy added data and removed fine/yes labels Apr 25, 2018
@Fryguy Fryguy merged commit 7ea561f into ManageIQ:master Apr 25, 2018
@Fryguy Fryguy added this to the Sprint 85 Ending May 7, 2018 milestone Apr 25, 2018
@skateman skateman deleted the drop-mks branch April 25, 2018 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants