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

Create a CustomAttribute for VmOrTemplate labels. #14202

Merged
merged 1 commit into from
Mar 8, 2017

Conversation

bronaghs
Copy link

@bronaghs bronaghs commented Mar 6, 2017

AWS labels (or potentially any provider's labels ) are gathered and stored as Custom Attributes in the database. They will be displayed in the Summary pages of the UI in the Labels table

This PR takes care of the model changes for this feature. Currently, only AWS VMs and images support tags.

The save_labels_inventory and save_custom_attribute_attribute_inventory methods should be moved out of the save_inventory_containers class and into a generic class but since the dev freeze is 2 weeks away this will have to be done in a separate PR

Pivotal story: https://www.pivotaltracker.com/story/show/139414085

@bronaghs
Copy link
Author

bronaghs commented Mar 6, 2017

@miq-bot add_label enhancement

@miq-bot
Copy link
Member

miq-bot commented Mar 6, 2017

Checked commit bronaghs@a17bb3b with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
2 files checked, 0 offenses detected
Everything looks good. ⭐

@@ -128,6 +128,7 @@ class VmOrTemplate < ApplicationRecord
has_many :direct_services, :through => :service_resources, :source => :service
belongs_to :tenant
has_many :connected_shares, -> { where(:resource_type => "VmOrTemplate") }, :foreign_key => :resource_id, :class_name => "Share"
has_many :labels, -> { where(:section => "labels") }, :class_name => "CustomAttribute", :as => :resource, :dependent => :destroy
Copy link
Member

Choose a reason for hiding this comment

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

@Fryguy "naming is hard" ... At first glance, I was fine with labels, but then I'm not sure if this should be provider_labels, or something indicating that these labels are imported directly from the provider.

Any thoughts here?

@bronaghs
Copy link
Author

bronaghs commented Mar 7, 2017

cc @AparnaKarve

@blomquisg blomquisg merged commit c30c333 into ManageIQ:master Mar 8, 2017
@blomquisg blomquisg added this to the Sprint 56 Ending Mar 13, 2017 milestone Mar 8, 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