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

Export Import of Expression Methods #50

Closed
wants to merge 7 commits into from

Conversation

mkanoor
Copy link
Contributor

@mkanoor mkanoor commented Jul 11, 2017

This PR allows expressions to be exported and imported. The expression files are stored with the extension .expr in the export/import deck

https://www.pivotaltracker.com/n/projects/1613499/stories/148625717

describe MiqAeExpressionMethod do
include Spec::Support::AutomationHelper
let(:user) { FactoryGirl.create(:user_with_group) }
let(:vm1) { FactoryGirl.create(:vm, :name => 'test_2.1', :cpu_shares => 400) }
Copy link
Member

Choose a reason for hiding this comment

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

@mkanoor Could you use the let! for vm1-vm3 here so you don't have to reference them.

Copy link
Member

@tinaafitz tinaafitz left a comment

Choose a reason for hiding this comment

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

@mkanoor Looks good.

@@ -201,6 +201,8 @@ def get_method_filename(method_obj)
"#{method_obj.name}#{FILE_EXTENSIONS[method_obj.language]}"
elsif method_obj['location'] == 'uri'
"#{method_obj.name}.uri"
elsif method_obj['location'] == 'expression'
"#{method_obj.name}.expr"
Copy link
Member

Choose a reason for hiding this comment

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

Is the expression data being saved in YAML format? If so do we need a new file type or can we just use .yaml?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gmcculloug We use the YAML extension to store method properties file, and we fetch all the methods based on the extension.

@mkanoor mkanoor force-pushed the expr_export_import branch 2 times, most recently from d450173 to 2c10f5e Compare July 14, 2017 19:51
@miq-bot
Copy link
Member

miq-bot commented Jul 27, 2017

Checked commits mkanoor/manageiq-automation_engine@0a520fc~...b557ecf with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
3 files checked, 1 offense detected

spec/models/miq_ae_yaml_import_export_spec.rb

@mkanoor
Copy link
Contributor Author

mkanoor commented Jul 27, 2017

The yaml file looks like

---
object_type: method
version: 1.0 
object:
  attributes:
    name: ExpTest
    display_name: 
    description: 
    scope: instance
    language: ruby
    location: expression
    data: |
      --- 
      :db: AvailabilityZone
      :expression:
        "=":
          field: AvailabilityZone-href_slug
          value: :user_input
  inputs:
  - field:
      aetype: 
      name: arg1
      display_name: 
      datatype: 
      priority: 1
      owner: 
      default_value: "${/#prefix}"
      substitute: false
      message: create
      visibility: 
      collect: 
      scope: 
      description: 
      condition: 
      on_entry: 
      on_exit: 
      on_error: 
      max_retries: 
      max_time: 

@mkanoor
Copy link
Contributor Author

mkanoor commented Jul 27, 2017

Closed in favor of #56

@mkanoor mkanoor closed this Jul 27, 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.

4 participants