Sha256: 9a1335c8dd7812efe97d6fb17809a13f03f0c43a1ee20d44fd09b9aecc0d22c7
Contents?: true
Size: 1.46 KB
Versions: 10
Compression:
Stored size: 1.46 KB
Contents
# UI controller for ansible roles class AnsibleRolesController < ::ApplicationController include Foreman::Controller::AutoCompleteSearch before_action :find_resource, :only => [:destroy] before_action :find_proxy, :only => [:import] before_action :create_importer, :only => [:import, :confirm_import] def index @ansible_roles = resource_base.search_for(params[:search], :order => params[:order]). paginate(:page => params[:page], :per_page => params[:per_page]) end def destroy if @ansible_role.destroy process_success else process_error end end def import changed = @importer.import! if changed.values.all?(&:empty?) notice no_changed_roles_message redirect_to ansible_roles_path else render :locals => { :changed => changed } end end def confirm_import @importer.finish_import(params[:changed]) notice _('Import of roles successfully finished.') redirect_to ansible_roles_path end private def find_proxy return nil unless params[:proxy] @proxy = SmartProxy.authorized(:view_smart_proxies).find(params[:proxy]) end def create_importer @importer = ForemanAnsible::UiRolesImporter.new(@proxy) end def no_changed_roles_message return _('No changes in roles detected.') unless @proxy.present? _('No changes in roles detected on %s.') % @proxy.name end end
Version data entries
10 entries across 10 versions & 1 rubygems