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

Bug 1546535: include shared external networks in list on router create #17305

Merged
merged 1 commit into from
Jun 14, 2018

Conversation

sseago
Copy link
Contributor

@sseago sseago commented Apr 16, 2018

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

When generating the list of networks for router external gateway
network, include shared networks owned by other tenants.

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

When generating the list of networks for router external gateway
network, include shared networks owned by other tenants.
@miq-bot
Copy link
Member

miq-bot commented Apr 16, 2018

Checked commit sseago@bed4a6a with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 0 offenses detected
Everything looks fine. 🍰

@@ -50,6 +50,10 @@ def self.class_by_ems(ext_management_system, _external = false)
ext_management_system && ext_management_system.class::CloudNetwork
end

def self.tenant_id_clause_format(tenant_ids)
["((tenants.id IN (?) OR cloud_networks.shared IS TRUE) AND ext_management_systems.tenant_mapping_enabled IS TRUE) OR ext_management_systems.tenant_mapping_enabled IS FALSE OR ext_management_systems.tenant_mapping_enabled IS NULL", tenant_ids]
Copy link
Member

@bdunne bdunne Apr 17, 2018

Choose a reason for hiding this comment

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

Where does tenants come from? I see a belongs_to :cloud_tenant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bdunne The reference comes from the included CloudTenancyMixin -- this method overrides tenant_id_clause_format in the mixin to add the part about cloud_networks, but the rest is right from there. As for the actual source of the tenants table in the query mix, it looks like that comes from this reference in cloud_tenant.rb: "has_one :source_tenant, :as => :source, :class_name => 'Tenant' "

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bdunne Any other issues with the PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

hi @bdunne, anything @sseago needs to change about this PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we write this in AREL? We try to avoid raw sql when possible.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Ladas I was trying to keep the implementation as close as possible to the method I'm overriding, which currently uses raw sql. If that gets updated to use AREL, then this should be modified to do the same: https://github.com/ManageIQ/manageiq/blob/master/app/models/mixins/cloud_tenancy_mixin.rb#L16-L18

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good then, the refactoring should start in the original method. 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

In light of @Ladas's comment, can this be merged?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't have merge rights for this repo, @bdunne ?

@bdunne bdunne merged commit 30c4dab into ManageIQ:master Jun 14, 2018
@bdunne bdunne added this to the Sprint 88 Ending Jun 18, 2018 milestone Jun 14, 2018
@bdunne bdunne self-assigned this Jun 14, 2018
@JPrause
Copy link
Member

JPrause commented Jun 28, 2018

@miq-bot add_label blocker

simaishi pushed a commit that referenced this pull request Jun 28, 2018
Bug 1546535: include shared external networks in list on router create
(cherry picked from commit 30c4dab)

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

Gaprindashvili backport details:

$ git log -1
commit 69a5bce7d0e0e804b7faf01497ab08df76fb01a7
Author: Brandon Dunne <[email protected]>
Date:   Thu Jun 14 10:07:12 2018 -0400

    Merge pull request #17305 from sseago/add_shared_networks
    
    Bug 1546535: include shared external networks in list on router create
    (cherry picked from commit 30c4dabb2b2e78f4c37981a28edd5e86da239550)
    
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1596248
    Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1596249

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.

7 participants