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

Apply dialog tags to VMs created during orchestration provisioning #16299

Merged
merged 1 commit into from
Oct 27, 2017

Conversation

gmcculloug
Copy link
Member

VM Lifecycle provisioning (and associated service provisioning) allow users to select tags and those tags are automatically applied to the resulting VMs. Orchestration provisioning supports tag select, through service dialogs, but the resulting VMs do not have the tags applied as part of the post provisioning steps.

This PR uses the standard dialog field naming scheme (dialog_tag__) to determine which tags are applied to the created VMs.

For example:

  • Field dialog_tag_0_env would apply the selected tag (or tags for multi-select tag categories) to all VMs created for a single service or bundle service provision request.
  • Field dialog_tag_1_env tags would apply to VMs created during a single service provision or a service provisioned in a bundle with a provisioning order of 1.
  • Field dialog_tag_2_env tags would only be applied to VMs that belong to a service that is part of a bundle and have a provisioning order of 2.

Links [Optional]

tag_ids = provisioning_tag_ids
return if tag_ids.empty?

vm_ids = direct_vms.collect(&:id)
Copy link
Contributor

Choose a reason for hiding this comment

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

Although direct_vms and all_vms return the same, isn't all_vms more meaningful?

tag_sequence = match[:sequence].to_i
value.scan(DIALOG_TAG_VALUE_REGEX).flatten if tag_sequence.zero? || tag_sequence == provision_sequence
end
end.compact.map!(&:to_i)
Copy link
Contributor

Choose a reason for hiding this comment

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

They don't need to be converted to integers, do they?

@gmcculloug gmcculloug force-pushed the orchestraion_provisioning_tags branch from 998c849 to b05499b Compare October 26, 2017 13:35
@gmcculloug
Copy link
Member Author

@bzwei Updated based on your comments.

Copy link
Contributor

@bzwei bzwei left a comment

Choose a reason for hiding this comment

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

LGTM. I think the test failure is not relevant.

@gmcculloug
Copy link
Member Author

@mkanoor @tinaafitz Please review. Tests are green now.

end
end

context `with a vm` do
Copy link
Contributor

Choose a reason for hiding this comment

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

@gmcculloug Should these be apostrophes or a back tick.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, my markdown past haunts me. I'll clean up both, thanks.

context `with a vm` do
before { expect(service).to receive(:all_vms).and_return([vm]) }

context `with a single service and dialog tag options` do
Copy link
Contributor

Choose a reason for hiding this comment

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

@gmcculloug apostrophe?

@gmcculloug gmcculloug force-pushed the orchestraion_provisioning_tags branch from b05499b to 195afd5 Compare October 27, 2017 19:40
@miq-bot
Copy link
Member

miq-bot commented Oct 27, 2017

Checked commit gmcculloug@195afd5 with ruby 2.3.3, rubocop 0.47.1, and haml-lint 0.20.0
4 files checked, 0 offenses detected
Everything looks fine. ⭐

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.

@gmcculloug looks good.

@mkanoor mkanoor merged commit ae78a87 into ManageIQ:master Oct 27, 2017
@mkanoor mkanoor added this to the Sprint 72 Ending Oct 30, 2017 milestone Oct 27, 2017
@gmcculloug gmcculloug deleted the orchestraion_provisioning_tags branch January 1, 2020 23:45
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