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

Adding support for a format_attributes parameter #14449

Merged
merged 2 commits into from
Mar 27, 2017

Conversation

abellotti
Copy link
Member

@abellotti abellotti commented Mar 22, 2017

Adding support for a format_attributes parameter with syntax:

  format_attributes=attr1=format1,attr2=format2,attr3=format3,....

Implementation to support an stdout virtual attribute on orchestration_stacks with optional attribute rendering as follows:

  GET /api/services/:id/orchestration_stacks
      ?expand=resources
      &attributes=stdout
      &format_attributes=stdout=raw

@abellotti
Copy link
Member Author

abellotti commented Mar 22, 2017

This is an alternate approach to #14389 which sticks to querying the orchestration stack and not implementing POST actions to fetching virtual attributes.

Initial thought was to us providing a virtual attribute in the model for each stdout format provided by AnsibleTower, simply a wrapper call to fetching stdout from the provider with a given parameter, not too much code to add to model each time. No change to API for each, just the model.

With this approach, we're leveraging the virtual attribute accessor mechanism of the API, plus introducing a format_attributes= parameter which allows us to simply pass the specified format down to the generic (get_stdout or whatever it gets named) method in the model that's simply sent over to the provider. No additional code in API or model needed for every format they introduce in the future.

Other general concerns include:

  • since we're synchronous in API, time for provider to render that stdout for us, we don't want to be blocked too long.
  • size of the stdout we're passing through the layers.

/cc @jntullo @gmcculloug @bzwei @Fryguy

@abellotti abellotti changed the title [WIP] Adding support for a format_attributes parameter with syntax: [WIP] Adding support for a format_attributes parameter Mar 22, 2017
@abellotti abellotti force-pushed the api_orchestration_stack_stdout branch from 885adc4 to 8dd2ce4 Compare March 25, 2017 03:51
@abellotti
Copy link
Member Author

/cc @gtanzillo @gmcculloug updated as per meeting today, also added specs.

  format_attributes=attr1=format1,attr2=format2,attr3=format3,....

Implementation to support an stdout virtual attribute on orchestration_stacks
with optional rendering as follows:

  GET /api/services/:id/orchestration_stacks
    ?expand=resources
    &attributes=stdout
    &format_attributes=stdout=raw
@abellotti abellotti force-pushed the api_orchestration_stack_stdout branch from 8dd2ce4 to 0653eaf Compare March 25, 2017 03:59
@miq-bot
Copy link
Member

miq-bot commented Mar 27, 2017

Some comments on commits abellotti/manageiq@0653eaf~...d0701b9

spec/requests/api/services_spec.rb

  • ⚠️ - 665 - Detected allow_any_instance_of. This RSpec method is highly discouraged, please only use when absolutely necessary.
  • ⚠️ - 679 - Detected allow_any_instance_of. This RSpec method is highly discouraged, please only use when absolutely necessary.

@miq-bot
Copy link
Member

miq-bot commented Mar 27, 2017

Checked commits abellotti/manageiq@0653eaf~...d0701b9 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
5 files checked, 0 offenses detected
Everything looks good. 🏆

@abellotti abellotti changed the title [WIP] Adding support for a format_attributes parameter Adding support for a format_attributes parameter Mar 27, 2017
@abellotti abellotti removed the wip label Mar 27, 2017
Copy link
Member

@gtanzillo gtanzillo left a comment

Choose a reason for hiding this comment

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

👍

@gtanzillo gtanzillo added this to the Sprint 57 Ending Mar 27, 2017 milestone Mar 27, 2017
@gtanzillo gtanzillo merged commit e60fd0f into ManageIQ:master Mar 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.

3 participants