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

Do not allow to embed a method into itself in automate #4753

Merged
merged 1 commit into from
Jan 21, 2019

Conversation

skateman
Copy link
Member

@skateman skateman commented Oct 11, 2018

Thanks to the selectable attribute of the miq-tree-selector component, it is possible to prevent to select a specific embedded method(s) in the tree. I am building here a regular expression from all the homonymic methods so the same method in an other domain cannot be selected.

@miq-bot add_reviewer @pkomanek
@miq-bot add_reviewer @h-kataria
@miq-bot add_label bug, hammer/yes

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

@miq-bot
Copy link
Member

miq-bot commented Oct 11, 2018

@skateman 'pkomanek' is an invalid reviewer, ignoring...

@skateman skateman changed the title Do not allow to embed a method into itself in automate [WIP] Do not allow to embed a method into itself in automate Oct 15, 2018
@mzazrivec mzazrivec added the wip label Oct 15, 2018
@mkanoor
Copy link
Contributor

mkanoor commented Oct 17, 2018

@skateman
A user can copy the methods into their own domain, so now we would have the same named methods in multiple domains and none of these methods can be embedded.

There is a method called
MiqAeMethod.get_homonymic_across_domains(@user, '/DOM1/A/B/C/CLASS1/method1')

Which gets a list of all the places where this method exists and we should prevent it from being embedded.

The UI currently uses this to display a list of methods and instances across domains

@mkanoor
Copy link
Contributor

mkanoor commented Oct 17, 2018

The screen shot in the BZ shows the domain overrides.
The back end already filters out duplicates at execution time, the UI should just prevent the user from selecting this at edit time.

@skateman
Copy link
Member Author

skateman commented Oct 18, 2018

@mkanoor yup, I realized this isn't the right way. Not sure if we could do this in the UI with a cheap solution 😕

@skateman skateman changed the title [WIP] Do not allow to embed a method into itself in automate Do not allow to embed a method into itself in automate Dec 14, 2018
@skateman
Copy link
Member Author

@billfitzgerald0120 @mkanoor I updated it to use the method you suggested, but I still think these things should be also validated on the model side.

@miq-bot miq-bot removed the wip label Dec 14, 2018
@miq-bot
Copy link
Member

miq-bot commented Dec 18, 2018

Checked commit skateman@fcbbc90 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
3 files checked, 1 offense detected

**

  • 💣 💥 🔥 🚒 - Linter/Haml - Linter::Haml STDERR:
warning: parser/current is loading parser/ruby23, which recognizes
warning: 2.3.6-compliant syntax, but you are running 2.3.3.
warning: please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.

@mzazrivec
Copy link
Contributor

@mkanoor Are you OK with the current fix? Thanks.

@martinpovolny
Copy link
Member

ping @mkanoor ?

@d-m-u
Copy link
Contributor

d-m-u commented Jan 21, 2019

@mkanoor @gmcculloug @tinaafitz can we please get eyes on this?

@tinaafitz
Copy link
Member

@skateman Looks good.

@h-kataria h-kataria added this to the Sprint 103 Ending Jan 21, 2019 milestone Jan 21, 2019
@h-kataria h-kataria merged commit 617a341 into ManageIQ:master Jan 21, 2019
@h-kataria h-kataria self-assigned this Jan 21, 2019
@skateman skateman deleted the embedded-method-selectable branch January 21, 2019 21:35
simaishi pushed a commit that referenced this pull request Feb 5, 2019
Do not allow to embed a method into itself in automate

(cherry picked from commit 617a341)

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

simaishi commented Feb 5, 2019

Hammer backport details:

$ git log -1
commit c35a21caf7d74bc29d2637fba6d6c648fa3e2a21
Author: Harpreet Kataria <hkataria@redhat.com>
Date:   Mon Jan 21 16:35:37 2019 -0500

    Merge pull request #4753 from skateman/embedded-method-selectable
    
    Do not allow to embed a method into itself in automate
    
    (cherry picked from commit 617a341ed6c8bf0e1055dec565017493891d339f)
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1672691

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.

9 participants