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

[WIP] Automate Expression Methods #6655

Closed
wants to merge 13 commits into from
Closed

Conversation

mkanoor
Copy link
Contributor

@mkanoor mkanoor commented Feb 13, 2016

Adding support for Expression Methods

Expression Methods allow you to use Advance Search Filters as Automate Methods, substituting the user_input from Automate Objects. The advantages of this approach is that the methods run directly in the worker and don't have the overhead of forking a DRb process to run the Automate Methods.

  1. Create an expression using the ManageIQ Explorer and any values that need to be set at runtime from automate, mark then as user input. These are positional arguments.
  2. Save the expression e.g if my_search (user_admin_my_search)
  3. Create a new Automate Method and set the method location to expression
  4. In the data field for the method set the expression name (user_admin_my_search)
  5. In the Input Arugments create arg1,arg2,arg3... for each of the user input fields from Step 1
  6. Create a field called attributes with the list of attributes that you would like to collect from the search objects. e.g (name, id)

Inputs Arguments

  • arg1 The first argument in the expression
  • arg2 The second argument in the expression
  • arg n The nth argument in the expression
  • attributes A comma delimited list of attributes to select from the resultant objects
    or
  • distinct A comma delimited list of attributes which are distinct in the resultant objects

Optional arguments

  • result_obj The object where the result data should be stored (default: current object)
  • result_attr The name of the attribute which stores the result (default: method_result)
  • result_type The result type hash or array (default: hash)
  • on_empty The method behavior when the search returns an empty list
    warn | error | abort
  • default The default value in case the result is empty and you select warn

After the method ends
$evm.root['ae_result'] = 'ok' | 'error' | 'warn'

@chessbyte chessbyte changed the title WIP: Automate Expression Methods [WIP] Automate Expression Methods Feb 14, 2016
@mkanoor
Copy link
Contributor Author

mkanoor commented Feb 26, 2016

filter_expression

Create an expression and save it.

expression_method

Method Location is set as expression
Method Data has the name of the expression
Input Parameters contain substitution from the inbound object

simulation_results

The results of the query go into an attribute called method_result as an array

@mkanoor mkanoor force-pushed the expression_ui branch 2 times, most recently from d4cbdc5 to 57be733 Compare March 16, 2016 19:03
@chessbyte chessbyte closed this Mar 16, 2016
@chessbyte chessbyte reopened this Mar 16, 2016
@chessbyte chessbyte assigned blomquisg and gmcculloug and unassigned blomquisg May 11, 2016
@mkanoor mkanoor force-pushed the expression_ui branch 3 times, most recently from 13d0174 to 13ebdc8 Compare May 24, 2016 13:43
@miq-bot
Copy link
Member

miq-bot commented Jul 12, 2016

<pr_mergeability_checker />This pull request is not mergeable. Please rebase and repush.

@miq-bot
Copy link
Member

miq-bot commented Oct 3, 2016

<pr_mergeability_checker />This pull request is not mergeable. Please rebase and repush.

@miq-bot
Copy link
Member

miq-bot commented Dec 6, 2016

<pr_mergeability_checker />This pull request is not mergeable. Please rebase and repush.

Adding support for Expression Methods
Provided default arguments
@miq-bot
Copy link
Member

miq-bot commented Dec 16, 2016

Checked commits mkanoor/manageiq@3cfdab4~...a01abdd with ruby 2.2.5, rubocop 0.37.2, and haml-lint 0.16.1
14 files checked, 5 offenses detected

app/controllers/application_controller/filter.rb

app/controllers/miq_ae_class_controller.rb

lib/miq_automation_engine/engine/miq_ae_expression_method.rb

spec/lib/miq_automation_engine/miq_ae_expression_method_spec.rb

@miq-bot
Copy link
Member

miq-bot commented Dec 22, 2016

<pr_mergeability_checker />This pull request is not mergeable. Please rebase and repush.

@gmcculloug
Copy link
Member

Replaced by:
Added support for expression methods (#15537)
Expression method UI changes (ManageIQ/manageiq-ui-classic#1668)
Support for expression methods (ManageIQ/manageiq-automation_engine#49)
Export Import of Expression Methods (ManageIQ/manageiq-automation_engine#50)

@gmcculloug gmcculloug closed this Jul 12, 2017
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.

5 participants