Skip to content

Commit

Permalink
Merge pull request #8912 from AparnaKarve/reverify_auth_status
Browse files Browse the repository at this point in the history
Add a button for re-checking authentication status for providers
(cherry picked from commit 027cf91)
  • Loading branch information
Fryguy authored and chessbyte committed Jun 7, 2016
1 parent 13d98f0 commit 0c83fa3
Show file tree
Hide file tree
Showing 12 changed files with 102 additions and 1 deletion.
14 changes: 14 additions & 0 deletions app/controllers/ems_common.rb 100644 → 100755
Expand Up @@ -433,6 +433,20 @@ def button
end
return
end
if params[:pressed] == "ems_cloud_recheck_auth_status" ||
params[:pressed] == "ems_infra_recheck_auth_status" ||
params[:pressed] == "ems_container_recheck_auth_status"
@record = find_by_id_filtered(model, params[:id])
result, details = @record.authentication_check_types_queue(@record.authentication_for_summary.pluck(:authtype),
:save => true)
if result
add_flash(_("Authentication status will be saved and workers will be restarted for this #{ui_lookup(:table => controller_name)}"))
else
add_flash(_("Re-checking Authentication status for this #{ui_lookup(:table => "ems_cloud")} was not successful: %{details}") % {:details => details}, :error)
end
render_flash
return
end

custom_buttons if params[:pressed] == "custom_button"

Expand Down
@@ -0,0 +1,5 @@
class ApplicationHelper::Button::EmsCloudRecheckAuthStatus < ApplicationHelper::Button::Basic
def skip?
!@record.is_available?(:authentication_status)
end
end
@@ -0,0 +1,5 @@
class ApplicationHelper::Button::EmsContainerRecheckAuthStatus < ApplicationHelper::Button::Basic
def skip?
!@record.is_available?(:authentication_status)
end
end
@@ -0,0 +1,5 @@
class ApplicationHelper::Button::EmsInfraRecheckAuthStatus < ApplicationHelper::Button::Basic
def skip?
!@record.is_available?(:authentication_status)
end
end
16 changes: 16 additions & 0 deletions app/helpers/application_helper/toolbar/ems_cloud_center.rb
Expand Up @@ -71,4 +71,20 @@ class ApplicationHelper::Toolbar::EmsCloudCenter < ApplicationHelper::Toolbar::B
]
),
])
button_group('ems_cloud_authentication', [
select(
:ems_cloud_authentication_choice,
'fa fa-lock fa-lg',
t = N_('Authentication'),
t,
:items => [
button(
:ems_cloud_recheck_auth_status,
'fa fa-search fa-lg',
N_('Re-check Authentication Status for this #{ui_lookup(:table=>"ems_cloud")}'),
N_('Re-check Authentication Status'),
:klass => ApplicationHelper::Button::EmsCloudRecheckAuthStatus),
]
),
])
end
16 changes: 16 additions & 0 deletions app/helpers/application_helper/toolbar/ems_container_center.rb
Expand Up @@ -77,4 +77,20 @@ class ApplicationHelper::Toolbar::EmsContainerCenter < ApplicationHelper::Toolba
]
),
])
button_group('ems_container_authentication', [
select(
:ems_container_authentication_choice,
'fa fa-lock fa-lg',
t = N_('Authentication'),
t,
:items => [
button(
:ems_container_recheck_auth_status,
'fa fa-search fa-lg',
N_('Re-check Authentication Status for this #{ui_lookup(:table=>"ems_container")}'),
N_('Re-check Authentication Status'),
:klass => ApplicationHelper::Button::EmsContainerRecheckAuthStatus),
]
),
])
end
16 changes: 16 additions & 0 deletions app/helpers/application_helper/toolbar/ems_infra_center.rb
Expand Up @@ -82,4 +82,20 @@ class ApplicationHelper::Toolbar::EmsInfraCenter < ApplicationHelper::Toolbar::B
]
),
])
button_group('ems_infra_authentication', [
select(
:ems_infra_authentication_choice,
'fa fa-lock fa-lg',
t = N_('Authentication'),
t,
:items => [
button(
:ems_infra_recheck_auth_status,
'fa fa-search fa-lg',
N_('Re-check Authentication Status for this #{ui_lookup(:table=>"ems_infra")}'),
N_('Re-check Authentication Status'),
:klass => ApplicationHelper::Button::EmsInfraRecheckAuthStatus),
]
),
])
end
4 changes: 4 additions & 0 deletions app/models/manageiq/providers/cloud_manager.rb
Expand Up @@ -55,6 +55,10 @@ def validate_timeline
{:available => true, :message => nil}
end

def validate_authentication_status
{:available => true, :message => nil}
end

def stop_event_monitor_queue_on_credential_change
if event_monitor_class && !self.new_record? && self.credentials_changed?
_log.info("EMS: [#{name}], Credentials have changed, stopping Event Monitor. It will be restarted by the WorkerMonitor.")
Expand Down
4 changes: 4 additions & 0 deletions app/models/manageiq/providers/container_manager.rb
Expand Up @@ -58,5 +58,9 @@ def validate_timeline
def validate_performance
{:available => true, :message => nil}
end

def validate_authentication_status
{:available => true, :message => nil}
end
end
end
4 changes: 4 additions & 0 deletions app/models/manageiq/providers/infra_manager.rb
Expand Up @@ -46,5 +46,9 @@ def self.ems_timeouts(type, service = nil)
def validate_timeline
{:available => true, :message => nil}
end

def validate_authentication_status
{:available => true, :message => nil}
end
end
end
12 changes: 12 additions & 0 deletions db/fixtures/miq_product_features.yml 100644 → 100755
Expand Up @@ -364,6 +364,10 @@
:description: Refresh Cloud Providers
:feature_type: control
:identifier: ems_cloud_refresh
- :name: Re-check Authentication Status
:description: Re-check Authentication Status of Cloud Providers
:feature_type: control
:identifier: ems_cloud_recheck_auth_status
- :name: Modify
:description: Modify Cloud Providers
:feature_type: admin
Expand Down Expand Up @@ -712,6 +716,10 @@
:description: Refresh Infrastructure Providers
:feature_type: control
:identifier: ems_infra_refresh
- :name: Re-check Authentication Status
:description: Re-check Authentication Status of Infrastructure Providers
:feature_type: control
:identifier: ems_infra_recheck_auth_status
- :name: Modify
:description: Modify Infrastructure Providers
:feature_type: admin
Expand Down Expand Up @@ -3204,6 +3212,10 @@
:description: Manage Policies of Containers Providers
:feature_type: control
:identifier: ems_container_protect
- :name: Re-check Authentication Status
:description: Re-check Authentication Status of Containers Providers
:feature_type: control
:identifier: ems_container_recheck_auth_status
- :name: Modify
:description: Modify Containers Providers
:feature_type: admin
Expand Down
2 changes: 1 addition & 1 deletion spec/models/miq_product_feature_spec.rb
Expand Up @@ -2,7 +2,7 @@
require 'pathname'

describe MiqProductFeature do
let(:expected_feature_count) { 1030 }
let(:expected_feature_count) { 1033 }

# - container_dashboard
# - miq_report_widget_editor
Expand Down

0 comments on commit 0c83fa3

Please sign in to comment.