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
Fixes #5802 - HC update/create using system uuids #4175
Fixes #5802 - HC update/create using system uuids #4175
Conversation
thanks! @parthaa. I never would have figured out how to solve the issue causing the failing test. |
systems = System.where(:uuid => uuids) | ||
ids_not_found = Set.new(uuids).subtract(systems.map(&:uuid)) | ||
fail Errors::NotFound.new(_("Systems [%s] not found.") % ids_not_found.to_a.join(',')) unless ids_not_found.blank? | ||
systems.collect { |s| s.id } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The mechanics of converting a set of uuids to ids seems like a good model layer method. Also, you should be able to just do a systems.pluck(:id)
instead of a collect since this is an active record query.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ehelms thanks, moved system_uuids_to_ids to System.uuids_to_ids with test, and updated to use pluck.
@dustint-rh is the UI sending UUIDs? |
@ehelms currently in the ui: This is mostly a change to help cli commands be more consistent by only accepting and displaying uuids. |
@@ -62,6 +62,7 @@ class System < Katello::Model | |||
|
|||
scope :in_environment, lambda { |env| where('environment_id = ?', env) unless env.nil?} | |||
scope :completer_scope, lambda { |options| readable(options[:organization_id])} | |||
scope :by_uuids, lambda {|uuids| where(:uuid => uuids) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick - equivalent spacing for brackets (currently trailing space but no leading).
ACK pending minor comment |
Alter Host Collection api update/create actions to accept system uuids. This is a fix related to hammer-cli-katello commands where some of the commands take uuids and others take the data base id. This allows the cli commands to uniformly take uuids. * also added class_name to relation for system in SystemHostCollection
ty, updated the spacing |
…_uuid Fixes #5802 - HC update/create using system uuids
Alter Host Collection api update/create actions to accept system uuids.
This is a fix related to hammer-cli-katello commands where some of
the commands take uuids and others take the data base id. This allows
the cli commands to uniformly take uuids.
related to Katello/hammer-cli-katello#178