-
Notifications
You must be signed in to change notification settings - Fork 900
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12602 from gmcculloug/custom_attributes_service_m…
…odel Expose custom_attribute methods to ext_management_system service model. (cherry picked from commit bd01f6e) https://bugzilla.redhat.com/show_bug.cgi?id=1410851
Showing
7 changed files
with
24 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 3 additions & 16 deletions
19
lib/miq_automation_engine/service_models/miq_ae_service_miq_group.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,11 @@ | ||
module MiqAeMethodService | ||
class MiqAeServiceMiqGroup < MiqAeServiceModelBase | ||
require_relative "mixins/miq_ae_service_custom_attribute_mixin" | ||
include MiqAeServiceCustomAttributeMixin | ||
|
||
expose :users, :association => true | ||
expose :vms, :association => true | ||
expose :tenant, :association => true | ||
expose :filters, :method => :get_filters | ||
|
||
def custom_keys | ||
object_send(:miq_custom_keys) | ||
end | ||
|
||
def custom_get(key) | ||
object_send(:miq_custom_get, key) | ||
end | ||
|
||
def custom_set(key, value) | ||
ar_method do | ||
@object.miq_custom_set(key, value) | ||
@object.save | ||
end | ||
value | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
lib/miq_automation_engine/service_models/mixins/miq_ae_service_custom_attribute_mixin.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module MiqAeServiceCustomAttributeMixin | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
expose :custom_keys, :method => :miq_custom_keys | ||
expose :custom_get, :method => :miq_custom_get | ||
expose :custom_set, :method => :miq_custom_set, :override_return => true | ||
end | ||
end |