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

Add belongsto filter for other network models #16151

Merged

Conversation

lpichler
Copy link
Contributor

@lpichler lpichler commented Oct 9, 2017

same thing as was done in #16063
but for other models in Network menu

belongsto filter is H & C tab in the group setting as is shown on the picture:
group
Description of bug:
We have selected network manager but for some models this filter is not applied:
and we have 2 network manager one is openstack and second azure

before:
example for CloudSubnet, you can see also CloudSubnet for openstack network manager
screen shot 2017-10-09 at 16 20 54

we need to see only Azure's CloudSubnets
so I added this rule other models as we did in #16063
after:
screen shot 2017-10-09 at 16 19 58 1

Links

EUWE BZ:https://bugzilla.redhat.com/show_bug.cgi?id=1465093
FINE BZ:https://bugzilla.redhat.com/show_bug.cgi?id=1463422

@miq-bot add_label blocker, rbac, bug, fine, euwe
@miq-bot assign @gtanzillo

when we will filter these network models by RBAC
we will need apply filter entered in belongsto filter
(H & C tab in group setting) - this array will help
to handle this situation.
@lpichler lpichler changed the title Add belongsto filter for other newtwork models Add belongsto filter for other network models Oct 9, 2017
@miq-bot
Copy link
Member

miq-bot commented Oct 9, 2017

@lpichler Cannot apply the following labels because they are not recognized: fine, euwe

end

it 'lists no cloud networks' do
it 'doesn\'t list cloud networks' do
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 most specs use " to avoid these issues.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 changed to ", in the separated commit, thanks

Copy link
Member

Choose a reason for hiding this comment

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

It looks like this is another one. The last commit fixes a different escaped single quote.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes I missed one context

@lpichler lpichler force-pushed the add_belongsto_filter_for_newtwork_model branch from 6df1b54 to daf00cd Compare October 9, 2017 16:31
@lpichler
Copy link
Contributor Author

lpichler commented Oct 9, 2017

if [ExtManagementSystem, Host].any? { |x| vcmeta.kind_of?(x) } && klass <= VmOrTemplate ||
vcmeta.kind_of?(ManageIQ::Providers::NetworkManager) && klass <= CloudNetwork
if ([ExtManagementSystem, Host].any? { |x| vcmeta.kind_of?(x) } && klass <= VmOrTemplate) ||
(vcmeta.kind_of?(ManageIQ::Providers::NetworkManager) && NETWORK_MODELS_FOR_BELONGSTO_FILTER.any? { |association_class| klass <= association_class.safe_constantize })
Copy link
Member

Choose a reason for hiding this comment

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

As discussed, as a followup for master, we'll give this conditional a method name that hopefully makes more sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 🗒

SecurityGroup
FloatingIp
NetworkPort
LoadBalancer
Copy link
Member

Choose a reason for hiding this comment

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

For the future, we should find a way to not hardcode this list because we'll need to update this list the moment we add something new.

Copy link
Member

Choose a reason for hiding this comment

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

Can this be sorted alphabetically?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jrafanie 👍 absolutely agree, @bdunne 👍

NetworkRouter
SecurityGroup
ManageIQ::Providers::NetworkManager
).freeze
Copy link
Member

Choose a reason for hiding this comment

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

Can you use the rbac filterer's constant instead of having another hardcoded list?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

FactoryGirl.create(network_model.underscore, :ext_management_system => network_manager_1)
end

context "when records match belognsto filter" do
Copy link
Member

Choose a reason for hiding this comment

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

I know you moved this but it's typo'd: belongsto

end
end

context "when records don't match belognsto filter" do
Copy link
Member

Choose a reason for hiding this comment

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

same typo

@lpichler lpichler force-pushed the add_belongsto_filter_for_newtwork_model branch from daf00cd to d1205f2 Compare October 9, 2017 20:11
and put it on the same level as
context 'when records match belognsto filter'
context 'when records don\'t match belognsto filter'
exception is network manager
- it is already created in upper block
we need to add together cases with are using
cloud_network and cloud_network_1 models
@lpichler lpichler force-pushed the add_belongsto_filter_for_newtwork_model branch from d1205f2 to 881f347 Compare October 9, 2017 20:14
@lpichler
Copy link
Contributor Author

lpichler commented Oct 9, 2017

@jrafanie @bdunne added your suggestions, typos fixed

NetworkRouter,
SecurityGroup,
ManageIQ::Providers::NetworkManager
].freeze
Copy link
Member

Choose a reason for hiding this comment

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

Sorry @lpichler, I wasn't clear. Can you do described_class::NETWORK_MODELS_FOR_BELONGSTO_FILTER + ManageIQ::Providers::NetworkManager so we're not duplicating the hardcoded list here and the code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 oh yes sure, I read it badly

@lpichler lpichler force-pushed the add_belongsto_filter_for_newtwork_model branch from 881f347 to 3fd9feb Compare October 9, 2017 20:59
@miq-bot
Copy link
Member

miq-bot commented Oct 9, 2017

Checked commits lpichler/manageiq@f9fc44f~...3fd9feb with ruby 2.3.3, rubocop 0.47.1, and haml-lint 0.20.0
2 files checked, 0 offenses detected
Everything looks fine. 🍰

Copy link
Member

@jrafanie jrafanie left a comment

Choose a reason for hiding this comment

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

LGTM once green

@bdunne bdunne merged commit cf2f4e7 into ManageIQ:master Oct 10, 2017
@bdunne bdunne assigned bdunne and unassigned gtanzillo Oct 10, 2017
@bdunne bdunne added this to the Sprint 71 Ending Oct 16, 2017 milestone Oct 10, 2017
@lpichler lpichler deleted the add_belongsto_filter_for_newtwork_model branch October 10, 2017 14:02
@lpichler
Copy link
Contributor Author

@miq-bot add_label euwe/yes, fine/yes, @simaishi

@miq-bot
Copy link
Member

miq-bot commented Oct 10, 2017

@lpichler Cannot apply the following label because they are not recognized: @simaishi

simaishi pushed a commit that referenced this pull request Oct 23, 2017
…work_model

Add belongsto filter for other network models
(cherry picked from commit cf2f4e7)

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

Euwe backport details:

$ git log -1
commit a5e250fb7326597c7ae19155cd329c1d58ac8f40
Author: Brandon Dunne <[email protected]>
Date:   Tue Oct 10 09:53:29 2017 -0400

    Merge pull request #16151 from lpichler/add_belongsto_filter_for_newtwork_model
    
    Add belongsto filter for other network models
    (cherry picked from commit cf2f4e7b0096844e55f9c87f14085775860deea7)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1465093

simaishi pushed a commit that referenced this pull request Nov 13, 2017
…work_model

Add belongsto filter for other network models
(cherry picked from commit cf2f4e7)

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

Fine backport details:

$ git log -1
commit 88c03d39af0ffd49e3de9dce8e837218dd99e511
Author: Brandon Dunne <[email protected]>
Date:   Tue Oct 10 09:53:29 2017 -0400

    Merge pull request #16151 from lpichler/add_belongsto_filter_for_newtwork_model
    
    Add belongsto filter for other network models
    (cherry picked from commit cf2f4e7b0096844e55f9c87f14085775860deea7)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1463422

d-m-u pushed a commit to d-m-u/manageiq that referenced this pull request Jun 6, 2018
…for_newtwork_model

Add belongsto filter for other network models
(cherry picked from commit cf2f4e7)

https://bugzilla.redhat.com/show_bug.cgi?id=1463422
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.

6 participants