Skip to content

Commit

Permalink
Add notifications around security_group_create using the mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
skateman committed Aug 15, 2018
1 parent 6581a32 commit 6a92f41
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/models/manageiq/providers/amazon/network_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class ManageIQ::Providers::Amazon::NetworkManager < ManageIQ::Providers::Network
require_nested :SecurityGroup

include ManageIQ::Providers::Amazon::ManagerMixin
include NotificationMixin

# Auth and endpoints delegations, editing of this type of manager must be disabled
delegate :authentication_check,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ def self.display_name(number = 1)
end

def self.raw_create_security_group(ext_management_system, options, user_id)
ext_management_system.notify_task_start(_('My awesome task is starting.'), user_id)
Ansible::Runner.run(ext_management_system.parent_manager.ansible_env_vars,
{
:vpc_id => options["vpc_id"],
Expand All @@ -15,8 +16,10 @@ def self.raw_create_security_group(ext_management_system, options, user_id)
:security_group_rules_egress => options["security_group_rules_egress"],
},
ext_management_system.parent_manager.ansible_root.join("create_security_group.yml"))
ext_management_system.notify_task_finish(_('My awesome task finished.'), user_id)
rescue => e
_log.error("security_group=[#{options[:name]}], error: #{e}")
ext_management_system.notify_task_fail(_('My awesome task failed.'), user_id)
raise MiqException::MiqSecurityGroupCreateError, e.message, e.backtrace
end
end

0 comments on commit 6a92f41

Please sign in to comment.