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

Ems event groups - allow provider settings (deeper_merge edition) #14177

Conversation

durandom
Copy link
Member

@durandom durandom commented Mar 3, 2017

Allow provider plugins to participate in setting up EmsEvent.event_groups

In order to provide settings for event_handling.event_groups every provider had to include its event names into settings.yml - which grew massively to beyond recognition.

To split these into settings.yml in the provider repos I have to hook into the event_groups method (see [1] for reasons).
This patch iterates over all registered provider plugins and looks for the same event_handling.event_groups structure under the provider name key.

Eg.

:ems:
  :ems_amazon:
     :event_handling:
        :event_groups:
          :addition:
            :critical:
            - AWS_EC2_Instance_CREATE
            - AWS_EC2_Instance_UPDATE
            - AWS_EC2_Instance_DELETE
          :power:
            :critical:
            - AWS_EC2_Instance_running
            - AWS_EC2_Instance_shutting-down
            - AWS_EC2_Instance_stopped

Then it merges the hash and more important merges the arrays of events.

Follows the suggestion in [1]

[1] ManageIQ/manageiq-providers-amazon#138

This is the same as #13942 - just with DeepMerge.deep_merge!

@durandom
Copy link
Member Author

durandom commented Mar 3, 2017

@miq-bot add_labels enhancement, pluggable providers
@miq-bot assign @Fryguy

@miq-bot
Copy link
Member

miq-bot commented Mar 3, 2017

Checked commit durandom@afb3b91 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
3 files checked, 0 offenses detected
Everything looks good. 🍪

provider_event_groups = provider_settings.fetch_path(:event_handling, :event_groups)
next unless provider_event_groups
DeepMerge.deep_merge!(
provider_event_groups.to_hash, event_groups,
Copy link
Member

Choose a reason for hiding this comment

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

Should this be core_event_groups?

Copy link
Member Author

Choose a reason for hiding this comment

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

nope, its each_with_object(core_event_groups) and event_groups is the memo object...

Copy link
Member

Choose a reason for hiding this comment

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

Ah ok, I missed that bit

@Fryguy Fryguy merged commit acb8c76 into ManageIQ:master Mar 6, 2017
@Fryguy Fryguy added this to the Sprint 56 Ending Mar 13, 2017 milestone Mar 6, 2017
@durandom durandom deleted the ems_event_allow_provider_settings_deeper_merge branch March 6, 2017 20:57
@durandom durandom mentioned this pull request Apr 21, 2017
38 tasks
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.

3 participants