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

Orchestration stack subcollection #14273

Merged
merged 1 commit into from
Mar 14, 2017
Merged

Orchestration stack subcollection #14273

merged 1 commit into from
Mar 14, 2017

Conversation

jntullo
Copy link

@jntullo jntullo commented Mar 10, 2017

This adds orchestration stack as a subcollection on services

@miq-bot add_label enhancement, api
@miq-bot assign @abellotti

cc: @AllenBW

before do
svc.add_resource!(ot, :name => ResourceAction::PROVISION)
end

Copy link
Member

Choose a reason for hiding this comment

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

probably add the test for failed get (forbidden)

@abellotti
Copy link
Member

LGTM!! 😍 minor test to add, Thanks!!

/cc @imtayadeway

module Subcollections
module OrchestrationStacks
def orchestration_stacks_query_resource(object)
object.respond_to?(:orchestration_stacks) ? object.orchestration_stacks : []
Copy link
Contributor

Choose a reason for hiding this comment

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

Are there services that don't have orchestration stacks? If so, can you add a test to verify what happens when it doesn't?

config/api.yml Outdated
:orchestration_stacks_subcollection_actions:
:get:
- :name: read
:identifier: orchestration_stack_view
Copy link
Contributor

Choose a reason for hiding this comment

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

Since these identifiers don't seem linked in any way to the parent services collection, you could put this configuration under the orchestration stacks section. But not a blocker - I just prefer to think of this section as configuration that's tailored for this parent collection 😄

@@ -625,4 +625,46 @@ def expect_svc_with_vms
end
end
end

describe 'Orchestration Stack subcollection' do
let(:ot) { FactoryGirl.create(:orchestration_stack) }
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, but why "ot"?

@imtayadeway
Copy link
Contributor

@jntullo LGTM, I think just needs one additional test as per https://github.com/ManageIQ/manageiq/pull/14273/files#r105734504 👍

run_get("#{services_url(svc1.id)}/orchestration_stacks", :expand => 'resources')

expected = {
'resources' => []
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this because service.orchestration_stacks # => [] Or because service.orchestration_stacks # => NoMethodError? It looks like the former from what I understand, so wondering if the respond_to? check is needed above?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I see! Okay, since this is not a special case, this spec is not totally necessary (sorry) 😊

additional spec

move orchestration stack actions

update orchestration stacks reference
@miq-bot
Copy link
Member

miq-bot commented Mar 14, 2017

Checked commit jntullo@26ea8ef with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
3 files checked, 0 offenses detected
Everything looks good. 👍

Copy link
Contributor

@imtayadeway imtayadeway left a comment

Choose a reason for hiding this comment

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

LGTM! ✨ 🎈 🍰

@abellotti
Copy link
Member

yep, LGTM!! Thanks @jntullo for the enhancement 🍎

@abellotti abellotti added this to the Sprint 57 Ending Mar 27, 2017 milestone Mar 14, 2017
@abellotti abellotti merged commit 30b9c06 into ManageIQ:master Mar 14, 2017
@jntullo jntullo mentioned this pull request Mar 14, 2017
@jntullo jntullo deleted the enhancement/orchestration_stack_subcollection branch November 28, 2017 19:42
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