Sha256: e8d49b53d1f9305e16a160049a02d5627ec43403b14c6ba4ee69b4754ede8980

Contents?: true

Size: 1.24 KB

Versions: 18

Compression:

Stored size: 1.24 KB

Contents

module ForemanSalt
  class SaltAutosignController < ::ForemanSalt::ApplicationController
    def index
      setup
      autosign = @api.autosign_list
      @autosign = autosign.paginate :page => params[:page], :per_page => Setting[:entries_per_page]
    end

    def new
      setup
    end

    def create
      setup

      if @api.autosign_create(params[:id])
        process_success(:success_redirect => hash_for_smart_proxy_salt_autosign_index_path, :success_msg => _("Autosign created for #{params[:id]}"),
                        :object_name => params[:id])
      else
        process_error(:redirect => hash_for_smart_proxy_salt_autosign_index_path)
      end
    end

    def destroy
      setup

      if @api.autosign_remove(params[:id])
        process_success(:success_redirect => hash_for_smart_proxy_salt_autosign_index_path, :success_msg => _("Autosign deleted for #{params[:id]}"),
                        :object_name => params[:id])
      else
        process_error(:redirect => hash_for_smart_proxy_salt_autosign_index_path)
      end
    end

    private

    def setup
      @proxy = SmartProxy.authorized(:view_smart_proxies_salt_autosign).find(params[:smart_proxy_id])
      @api = ProxyAPI::Salt.new(:url => @proxy.url)
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
foreman_salt-14.0.0 app/controllers/foreman_salt/salt_autosign_controller.rb
foreman_salt-13.2.4 app/controllers/foreman_salt/salt_autosign_controller.rb
foreman_salt-13.2.3 app/controllers/foreman_salt/salt_autosign_controller.rb
foreman_salt-13.2.2 app/controllers/foreman_salt/salt_autosign_controller.rb
foreman_salt-13.2.1 app/controllers/foreman_salt/salt_autosign_controller.rb
foreman_salt-13.2.0 app/controllers/foreman_salt/salt_autosign_controller.rb
foreman_salt-13.1.0 app/controllers/foreman_salt/salt_autosign_controller.rb
foreman_salt-13.0.0 app/controllers/foreman_salt/salt_autosign_controller.rb
foreman_salt-12.0.0 app/controllers/foreman_salt/salt_autosign_controller.rb
foreman_salt-11.0.1 app/controllers/foreman_salt/salt_autosign_controller.rb
foreman_salt-11.0.0 app/controllers/foreman_salt/salt_autosign_controller.rb
foreman_salt-10.3.1 app/controllers/foreman_salt/salt_autosign_controller.rb
foreman_salt-10.3.0 app/controllers/foreman_salt/salt_autosign_controller.rb
foreman_salt-10.2.0 app/controllers/foreman_salt/salt_autosign_controller.rb
foreman_salt-10.1.0 app/controllers/foreman_salt/salt_autosign_controller.rb
foreman_salt-9.0.1 app/controllers/foreman_salt/salt_autosign_controller.rb
foreman_salt-10.0.0 app/controllers/foreman_salt/salt_autosign_controller.rb
foreman_salt-9.0.0 app/controllers/foreman_salt/salt_autosign_controller.rb