From dd079ec88fae6b301adc6ac72c55d822d4e4fe85 Mon Sep 17 00:00:00 2001 From: zen Date: Wed, 1 May 2024 21:58:14 +0200 Subject: [PATCH] correction multiple --- .../app/controllers/accounts_controller.rb | 10 + .../app/controllers/engine_controller.rb | 92 +++++----- .../app/controllers/hosts_controller.rb | 8 +- .../installtemplates_controller.rb | 6 + .../app/controllers/logs_controller.rb | 7 + .../app/controllers/pages_controller.rb | 6 + .../app/controllers/scripts_controller.rb | 14 +- .../app/controllers/sites_controller.rb | 8 + src/autogen/app/models/user.rb | 2 + .../views/devise/registrations/edit.html.erb | 2 +- .../app/views/devise/sessions/new.html.erb | 3 +- src/autogen/app/views/hosts/_form.html.erb | 9 +- src/autogen/app/views/hosts/_host.html.erb | 171 ++++++++++++------ src/autogen/app/views/hosts/_hostraw.html.erb | 21 ++- src/autogen/app/views/hosts/index.html.erb | 18 +- src/autogen/app/views/hosts/show.html.erb | 13 +- .../app/views/partials/_top-menu.html.erb | 5 +- src/autogen/app/views/scripts/_form.html.erb | 36 ++-- src/autogen/app/views/sites/_form.html.erb | 40 ++-- 19 files changed, 308 insertions(+), 163 deletions(-) diff --git a/src/autogen/app/controllers/accounts_controller.rb b/src/autogen/app/controllers/accounts_controller.rb index 265eaa2..cddac89 100644 --- a/src/autogen/app/controllers/accounts_controller.rb +++ b/src/autogen/app/controllers/accounts_controller.rb @@ -1,4 +1,6 @@ class AccountsController < ApplicationController + before_action :authenticate_user! + before_action :check_group before_action :set_account, only: %i[ show edit update destroy ] before_action :set_pass, only: %i[ update ] # GET /accounts or /accounts.json @@ -79,4 +81,12 @@ class AccountsController < ApplicationController def account_params params.require(:account).permit(:name, :login, :password, :sshpubkey,:encpassword) end + def account_params + params.require(:account).permit(:name, :login, :password, :sshpubkey,:encpassword) + end + def check_group + if current_user.group != "admin" + redirect_back_or_to("/") + end + end end diff --git a/src/autogen/app/controllers/engine_controller.rb b/src/autogen/app/controllers/engine_controller.rb index 097a6b4..ec7919d 100644 --- a/src/autogen/app/controllers/engine_controller.rb +++ b/src/autogen/app/controllers/engine_controller.rb @@ -7,51 +7,56 @@ class EngineController < ApplicationController end def generate_boot - if @host - sourceip=request.headers['REMOTE_ADDR'] - log=Log.new({source: "#{sourceip}", crit: "info",message: "#{@host.uuid} Request boot script"}) - log.save() - @host.mac = params[:mac] - @host.install_ip = params[:install_ip] - boot_script = @host.installtemplate.boot.content - template = @host.installtemplate - @site = @host.site - host = @host - @template = @host.installtemplate - if @host.toinstall - @host.update({status: "Computer Booting"}) - end - @api_uri = get_uri(@site) - result = render inline: boot_script, layout: false, content_type: 'text/plain' - @host.update({lastbootgenerated: result}) + if @host + sourceip=request.headers['X-Forwarded-for'] + log=Log.new({source: "#{sourceip}", crit: "info",message: "#{@host.uuid}: Request boot script"}) + log.save() + @host.mac = params[:mac] + @host.install_ip = params[:ip] + @host.access_ip = sourceip + boot_script = @host.installtemplate.boot.content + template = @host.installtemplate + @site = @host.site + host = @host + @template = @host.installtemplate + if @host.toinstall + @host.update({status: "Computer Booting"}) end + @script_name = @host.installtemplate.boot.name + @api_uri = get_uri(@site) + result = render inline: boot_script, layout: false, content_type: 'text/plain' + @host.update({lastbootgenerated: result}) end + end def generate_install if @host - sourceip=request.headers['REMOTE_ADDR'] - log=Log.new({source: "#{sourceip}", crit: "info",message: "#{@host.uuid} Request Install script"}) + sourceip=request.headers['X-Forwarded-for'] + log=Log.new({source: "#{sourceip}", crit: "info",message: "#{@host.hostname},UUDI:#{@host.uuid}: Request Install script"}) log.save() script = @host.installtemplate.install.content template = @host.installtemplate @site = @host.site @template = @host.installtemplate host = @host + @host.access_ip = "#{sourceip}" @host.update({status: "System Install"}) + @script_name = @host.installtemplate.boot.name @api_uri = get_uri(@site) result = render inline: script, layout: false, content_type: 'text/plain' @host.update({lastinstallgenerated: result}) else - log=Log.new({source: "#{sourceip}", crit: "info",message: "Request Install script"}) + log=Log.new({source: sourceip, crit: "info",message: "#{@host.hostname},UUDI:#{@host.uuid}: Error on Request Install script"}) log.save() end end def generate_postinstall if @host - sourceip=request.headers['REMOTE_ADDR'] - log=Log.new({source: "#{sourceip}", crit: "info",message: "#{@host.uuid} Request Postinstall script"}) + sourceip=request.headers['X-Forwarded-for'] + log=Log.new({source: sourceip, crit: "info",message: "#{@host.hostname},UUDI:#{@host.uuid}: Request Postinstall script"}) log.save() + @host.access_ip = "#{sourceip}" @host.update({status: "System Post Install"}) script = @host.installtemplate.postinstall.content template = @host.installtemplate @@ -59,6 +64,7 @@ class EngineController < ApplicationController @site = @host.site host = @host @template = @host.installtemplate + @script_name = @host.installtemplate.boot.name @api_uri = get_uri(@site) result = render inline: script, layout: false, content_type: 'text/plain' @host.update({lastpostinstallgenerated: result}) @@ -66,10 +72,10 @@ class EngineController < ApplicationController end def generate_installed - sourceip=request.headers['REMOTE_ADDR'] - log=Log.new({source: "#{sourceip}", crit: "info",message: "#{@host.uuid} Install Finished."}) + sourceip=request.headers['X-Forwarded-for'] + log=Log.new({source: sourceip, crit: "info",message: "#{@host.hostname},UUDI:#{@host.uuid}: Send install Finished."}) log.save() - if @host.update({status: "Installation Finish", installed: true, toinstall: false, interface: params[:interface],ip: params[:install_ip]}) + if @host.update({status: "Installation Finish", installed: true, toinstall: false, interface: params[:interface],ip: params[:ip],access_ip: sourceip}) render plain: "ok" else render json: @host.errors @@ -78,10 +84,10 @@ class EngineController < ApplicationController def update_info @host = Host.find_by(uuid: params[:uuid]) - sourceip=request.headers['REMOTE_ADDR'] - log=Log.new({source: "#{sourceip}", crit: "info",message: "#{@host.uuid} update info."}) + sourceip=request.headers['X-Forwarded-for'] + log=Log.new({source: sourceip, crit: "info",message: "#{@host.hostname},UUDI:#{@host.uuid}: Send refresh informations."}) log.save() - if @host.update({interface: params[:interface],ip: params[:ip], hostname: params[:hostname], access_ip: "#{sourceip}"}) + if @host.update({interface: params[:interface],ip: params[:ip], hostname: params[:hostname], access_ip: sourceip}) render plain: "ok" else render json: @host.errors @@ -95,14 +101,13 @@ class EngineController < ApplicationController end def generate_file - sourceip=request.headers['REMOTE_ADDR'] - log=Log.new({source: "#{sourceip}", crit: "info",message: "Request #{params[:filename]}"}) + sourceip=request.headers['X-Forwarded-for'] + log=Log.new({source: sourceip, crit: "info",message: "#{@host.hostname},UUDI:#{@host.uuid}: Request ressource #{params[:filename]}"}) log.save() if @host script = Script.find_by({name: params[:filename], stage: "ressource"}) @site = @host.site @template = @host.installtemplate - host = @host @api_uri = get_uri(@site) result = render inline: script.content, layout: false, content_type: 'text/plain' end @@ -112,18 +117,19 @@ class EngineController < ApplicationController def set_host_by_uuid @host = Host.find_by(uuid: params[:uuid]) if ! @host - logger.debug "> NEW HOST DETECTED !!!" - sourceip=request.headers['REMOTE_ADDR'] - log=Log.new({source: "#{sourceip}", crit: "warning",message: "New host with uuid #{params[:uuid]} Detected."}) - log.save() - @template = Installtemplate.find_by(name:"default") - @site = Site.find_by(name:"default") - @account = Account.find_by(name:"default") - # Generate random lusk key - random_string=SecureRandom.urlsafe_base64(24) - # Create new host - @host = Host.new(hostname: "New host detected",uuid: params["uuid"], install_ip: params["ip"], installtemplate: @template,site: @site, mac: params["mac"], status: "discover", discover: true,installed: false, toinstall: false,rootaccount: @account, mainaccount: @account, product: params["p"], serial: params["s"], lusk_key: random_string) - @host.save! + sourceip=request.headers['X-Forwarded-for'] + log=Log.new({source: sourceip, crit: "warning",message: "New host with uuid #{params[:uuid]} Detected."}) + log.save() + log=Log.new({source: "Engine", crit: "info",message: "Generate default configuration for #{params[:uuid]} requested from #{sourceip}."}) + log.save() + @template = Installtemplate.find_by(name:"default") + @site = Site.find_by(name:"default") + @account = Account.find_by(name:"default") + # Generate random lusk key + random_string=SecureRandom.urlsafe_base64(24) + # Create new host + @host = Host.new(hostname: "New host detected",uuid: params["uuid"], install_ip: params["ip"], access_ip: sourceip,installtemplate: @template,site: @site, mac: params["mac"], status: "discover", discover: true,installed: false, toinstall: false,rootaccount: @account, mainaccount: @account, product: params["p"], serial: params["s"], lusk_key: random_string) + @host.save! end end # Only allow a list of trusted parameters through. diff --git a/src/autogen/app/controllers/hosts_controller.rb b/src/autogen/app/controllers/hosts_controller.rb index 5cbae86..0adc4d3 100644 --- a/src/autogen/app/controllers/hosts_controller.rb +++ b/src/autogen/app/controllers/hosts_controller.rb @@ -1,5 +1,6 @@ class HostsController < ApplicationController before_action :authenticate_user! + before_action :check_group before_action :set_host, only: %i[ show edit update destroy ] before_action :set_host_by_uuid, only: %i[ generate_boot generate_install generate_postinstall generate_metadata ] @@ -40,7 +41,7 @@ class HostsController < ApplicationController def update puts host_params respond_to do |format| - log=Log.new({source: "admin", crit: "info",message: "User xxx update #{host_params[:hostname]}"}) + log=Log.new({source: "host", crit: "info",message: "User #{current_user.name}, Update #{host_params[:hostname]}"}) log.save() if @host.update(host_params) format.html { redirect_to host_url(@host), notice: "Host was successfully updated." } @@ -148,4 +149,9 @@ class HostsController < ApplicationController def host_params params.require(:host).permit(:uuid, :hostname, :ip, :install_ip,:access_ip,:status, :mac, :discover, :installed, :interface , :installtemplate, :site , :installtemplate_id, :site_id, :rootaccount_id, :mainaccount_id,:toinstall, :lusk_key,:lusk_device, :lusk_encrypt, :host_device,:lang) end + def check_group + if current_user.group != "admin" + redirect_back_or_to("/") + end + end end diff --git a/src/autogen/app/controllers/installtemplates_controller.rb b/src/autogen/app/controllers/installtemplates_controller.rb index 3bc3bf1..7179f5f 100644 --- a/src/autogen/app/controllers/installtemplates_controller.rb +++ b/src/autogen/app/controllers/installtemplates_controller.rb @@ -1,6 +1,7 @@ class InstalltemplatesController < ApplicationController before_action :authenticate_user! before_action :set_installtemplate, only: %i[ show edit update destroy ] + before_action :check_group # GET /installtemplates or /installtemplates.json def index @@ -68,4 +69,9 @@ class InstalltemplatesController < ApplicationController def installtemplate_params params.require(:installtemplate).permit(:name, :ostype, :osversion, :repository, :nfsroot, :kernel, :initrd, :rootfile, :boot_id, :install_id, :postinstall_id, :lang) end + def check_group + if current_user.group != "admin" + redirect_back_or_to("/") + end + end end diff --git a/src/autogen/app/controllers/logs_controller.rb b/src/autogen/app/controllers/logs_controller.rb index 31fdeb7..d5aff47 100644 --- a/src/autogen/app/controllers/logs_controller.rb +++ b/src/autogen/app/controllers/logs_controller.rb @@ -1,5 +1,7 @@ class LogsController < ApplicationController before_action :authenticate_user! + before_action :check_group + before_action :set_log, only: %i[ show edit update destroy ] # GET /logs or /logs.json @@ -72,4 +74,9 @@ class LogsController < ApplicationController def log_params params.require(:log).permit(:source, :crit, :message) end + def check_group + if current_user.group != "admin" + redirect_back_or_to("/") + end + end end diff --git a/src/autogen/app/controllers/pages_controller.rb b/src/autogen/app/controllers/pages_controller.rb index 2daa56d..77b1d09 100644 --- a/src/autogen/app/controllers/pages_controller.rb +++ b/src/autogen/app/controllers/pages_controller.rb @@ -1,5 +1,11 @@ class PagesController < ApplicationController + before_action :authenticate_user! def index @hostslist = Host.all end + def check_group + if current_user.group != "admin" + redirect_back_or_to("/") + end + end end diff --git a/src/autogen/app/controllers/scripts_controller.rb b/src/autogen/app/controllers/scripts_controller.rb index 66de860..cb75424 100644 --- a/src/autogen/app/controllers/scripts_controller.rb +++ b/src/autogen/app/controllers/scripts_controller.rb @@ -1,5 +1,6 @@ class ScriptsController < ApplicationController before_action :authenticate_user! + before_action :check_group before_action :set_script, only: %i[ show edit update destroy ] @@ -24,7 +25,8 @@ class ScriptsController < ApplicationController # POST /scripts or /scripts.json def create @script = Script.new(script_params) - + log=Log.new({source: "Script", crit: "info",message: "User #{current_user.name}, Create #{script_params[:stage]} Script #{script_params[:name]}"}) + log.save() respond_to do |format| if @script.save format.html { redirect_to script_url(@script), notice: "Script was successfully created." } @@ -39,6 +41,8 @@ class ScriptsController < ApplicationController # PATCH/PUT /scripts/1 or /scripts/1.json def update respond_to do |format| + log=Log.new({source: "Script", crit: "info",message: "User #{current_user.name}, Update #{script_params[:stage]} Script #{script_params[:name]}"}) + log.save() if @script.update(script_params) format.html { redirect_to script_url(@script), notice: "Script was successfully updated." } format.json { render :show, status: :ok, location: @script } @@ -52,7 +56,8 @@ class ScriptsController < ApplicationController # DELETE /scripts/1 or /scripts/1.json def destroy @script.destroy! - + log=Log.new({source: "Script", crit: "warning",message: "User #{current_user.name}, Delete #{script_params[:stage]} Script #{script_params[:name]}"}) + log.save() respond_to do |format| format.html { redirect_to scripts_url, notice: "Script was successfully destroyed." } format.json { head :no_content } @@ -69,4 +74,9 @@ class ScriptsController < ApplicationController def script_params params.require(:script).permit(:name, :stage, :lang, :content, :lock, :description) end + def check_group + if current_user.group != "admin" + redirect_back_or_to("/") + end + end end diff --git a/src/autogen/app/controllers/sites_controller.rb b/src/autogen/app/controllers/sites_controller.rb index 352ffd5..041e7b7 100644 --- a/src/autogen/app/controllers/sites_controller.rb +++ b/src/autogen/app/controllers/sites_controller.rb @@ -1,5 +1,7 @@ class SitesController < ApplicationController before_action :authenticate_user! + before_action :check_group + before_action :set_site, only: %i[ show edit update destroy ] # GET /sites or /sites.json @@ -69,5 +71,11 @@ class SitesController < ApplicationController params.require(:site).permit(:name, :domain, :gateway, :nameserver, :network, :netmask, :api_ip, :api_port, :api_url, :fileserver_uri, :fileserver_basepath, :timezone, :apiurl, :cfenginehub, :nfsserver_path, :country) end + def check_group + if current_user.group != "admin" + redirect_back_or_to("/") + end + end + end diff --git a/src/autogen/app/models/user.rb b/src/autogen/app/models/user.rb index f3c127f..613cebb 100644 --- a/src/autogen/app/models/user.rb +++ b/src/autogen/app/models/user.rb @@ -8,6 +8,7 @@ class User ## Database authenticatable field :email, type: String, default: "" field :encrypted_password, type: String, default: "" + field :name, type: String, default: "" ## Recoverable field :reset_password_token, type: String @@ -33,5 +34,6 @@ class User # field :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts # field :unlock_token, type: String # Only if unlock strategy is :email or :both # field :locked_at, type: Time + field :group, type: String, default: "" include Mongoid::Timestamps end diff --git a/src/autogen/app/views/devise/registrations/edit.html.erb b/src/autogen/app/views/devise/registrations/edit.html.erb index 669204f..1097d30 100644 --- a/src/autogen/app/views/devise/registrations/edit.html.erb +++ b/src/autogen/app/views/devise/registrations/edit.html.erb @@ -45,4 +45,4 @@ <%= link_to "Back", :back %> - \ No newline at end of file + diff --git a/src/autogen/app/views/devise/sessions/new.html.erb b/src/autogen/app/views/devise/sessions/new.html.erb index f1148fc..a2bddda 100644 --- a/src/autogen/app/views/devise/sessions/new.html.erb +++ b/src/autogen/app/views/devise/sessions/new.html.erb @@ -6,7 +6,6 @@
<%= f.email_field :email, autofocus: true, autocomplete: "email" , class: "input is-small" , placeholder: :email %>
-
<%= f.password_field :password, autocomplete: "current-password" ,class: "input is-small" , placeholder: :password%>
@@ -26,4 +25,4 @@ <%= render "devise/shared/links" %> - \ No newline at end of file + diff --git a/src/autogen/app/views/hosts/_form.html.erb b/src/autogen/app/views/hosts/_form.html.erb index 414e198..c8bd617 100644 --- a/src/autogen/app/views/hosts/_form.html.erb +++ b/src/autogen/app/views/hosts/_form.html.erb @@ -1,4 +1,3 @@ -<%# _form.html.erb %>
@@ -109,7 +108,7 @@
- <%= form.text_field :install_ip , { class: "input"} %> + <%= form.text_field :install_ip , { class: "input", disabled: true } %>

Ip during install of host, Refered by @host.install_ip in script

@@ -123,7 +122,7 @@
- <%= form.text_field :status , { class: "input"} %> + <%= form.text_field :status , { class: "input" , disabled: true } %>

Host status, Refered by @host.status in script

@@ -137,7 +136,7 @@
- <%= form.text_field :mac , { class: "input"} %> + <%= form.text_field :mac , { class: "input", disabled: true } %>

MAc Adress, Refered by @host.mac in script

@@ -171,7 +170,7 @@
<%= form.label :lusk_key, class: "label is-small" %> - <%= form.text_field :lusk_key , { class: "input"} %> + <%= form.text_field :lusk_key , { class: "input", disabled: true } %>

Lusk encrypt key, Refered by @host.lusk_key in script

diff --git a/src/autogen/app/views/hosts/_host.html.erb b/src/autogen/app/views/hosts/_host.html.erb index 2d9b52d..c343c30 100644 --- a/src/autogen/app/views/hosts/_host.html.erb +++ b/src/autogen/app/views/hosts/_host.html.erb @@ -1,69 +1,120 @@ -
-
-

- <%= host.hostname %> -

- -
-
-
-

- Ip: - <%= host.ip %> -

+

<%= notice %>

+
+
-

- Status: - <%= host.status %> -

+
+ <% if @host.errors.any? %> +
+

<%= pluralize(@host.errors.count, "error") %> prohibited this host from being saved:

+
    + <% @host.errors.each do |error| %> +
  • <%= error.full_message %>
  • + <% end %> +
+
+ <% end %> -

- Mac: - <%= host.mac %> -

-

- Discover: - <%= host.discover %> -

+
+

+ Hostname: + <%= @host.hostname %> +

-

- Installed: - <%= host.installed %> -

+

+ UUID: + <%= @host.uuid %> +

+

+ Serial: + <%= @host.product %> +

+

+ Serial: + <%= @host.serial %> +

+

+ MAC: + <%= @host.mac %> +

+

+ Interface: + <%= @host.interface %> +

+

+ IP: + <%= @host.ip %> +

+

+ IP Access: + <%= @host.access_ip %> +

+

+ Install IP: + <%= @host.install_ip %> +

+

+ Status: + <%= @host.status %> +

+

+ Device: + <%= @host.host_device %> +

+

+ Lusk Encryption: + <%= @host.lusk_encrypt %> +

+

+ Lusk Device to Encrypt: + <%= @host.lusk_device %> +

+

+ Lusk Key: + <%= @host.lusk_key %> +

-

- Interface: - <%= host.interface %> -

-

- Install Template: - <% if defined?host.installtemplate.name %> - <%= host.installtemplate.name %> - <% else %> - not set - <% end %> -

+

+ Site + <%= @host.site.name %> +

+

+ Lang + <%= @host.lang %> +

-

- Site: - <% if defined?host.site.name %> - <%= host.site.name %> - <% else %> - not set - <% end %> -

+

+ Root Account + <%= @host.rootaccount.name %> +

+ +

+ Main Account + <%= @host.mainaccount.name %> +

+ +

+ Discover + <%= @host.discover %> +

+ +

+ Installed + <%= @host.installed %> +

+ +

+ Toinstall + <%= @host.toinstall %> +

+
+
+ <%= button_to "Edit Host", edit_host_path(@host), method: :get, class: "button is-small is-primary" %> + <%= button_to "Edit Template",edit_installtemplate_path(@host.installtemplate_id), method: :get, class: "button is-small is-primary", form: {target: '_blank'}%> + <%= button_to "Edit Boot", edit_script_path(@host.installtemplate.boot), method: :get, class: "button is-small is-primary" %> + <%= button_to "Edit Install", edit_script_path(@host.installtemplate.install), method: :get, class: "button is-small is-primary" %> + <%= button_to "Edit Post Install", edit_script_path(@host.installtemplate.postinstall), method: :get, class: "button is-small is-primary" %> +
-
- - - - diff --git a/src/autogen/app/views/hosts/_hostraw.html.erb b/src/autogen/app/views/hosts/_hostraw.html.erb index 68166f9..3cbb313 100644 --- a/src/autogen/app/views/hosts/_hostraw.html.erb +++ b/src/autogen/app/views/hosts/_hostraw.html.erb @@ -1,9 +1,20 @@ + <%= host.hostname %> - <%= host.status %> + <%= host.status %> <%= host.installtemplate.name %> - <%= button_to "Edit", edit_host_path(host), method: :get, class: "button is-small is-primary" %> - - - + +
+ <%= button_to "View", host_path(host), method: :get, class: "button is-small is-success"%> + <%= button_to "Edit", edit_host_path(host), method: :get, class: "button is-small is-primary" %> + <%= button_to "Delete", host_path(host), method: :delete, class: "button is-small is-danger" %> +
+ + +
+ + + +
+ diff --git a/src/autogen/app/views/hosts/index.html.erb b/src/autogen/app/views/hosts/index.html.erb index c0d044f..d1b6531 100644 --- a/src/autogen/app/views/hosts/index.html.erb +++ b/src/autogen/app/views/hosts/index.html.erb @@ -8,20 +8,22 @@ Hostname Status Template - + Action + View Generated Script - <% @hosts.each do |host| %> + <% @hosts.each do |host| %> <%= render :partial => 'hostraw', :locals => { :host => host} %> - <% end %> + <% end %> -
-

Render

-
-        
-
+
+
+

Render

+
+    
+
diff --git a/src/autogen/app/views/hosts/show.html.erb b/src/autogen/app/views/hosts/show.html.erb index 0cb1e3f..60a6006 100644 --- a/src/autogen/app/views/hosts/show.html.erb +++ b/src/autogen/app/views/hosts/show.html.erb @@ -1,12 +1,9 @@

<%= notice %>

- +
<%= render @host %> - -
- - -
+
+
+<%= link_to "Back to hosts", "/hosts", class: "button is-success is-small is-pulled-left" %> +
diff --git a/src/autogen/app/views/partials/_top-menu.html.erb b/src/autogen/app/views/partials/_top-menu.html.erb index c7e877a..b7837a8 100644 --- a/src/autogen/app/views/partials/_top-menu.html.erb +++ b/src/autogen/app/views/partials/_top-menu.html.erb @@ -48,8 +48,10 @@ - - - diff --git a/src/autogen/app/views/scripts/_form.html.erb b/src/autogen/app/views/scripts/_form.html.erb index 5163528..72fb095 100644 --- a/src/autogen/app/views/scripts/_form.html.erb +++ b/src/autogen/app/views/scripts/_form.html.erb @@ -17,6 +17,8 @@
<%= form.text_field :name , { class: "input"} %>
+

Name of script (@script.name )

+
@@ -25,45 +27,51 @@
<%= form.text_field :stage , { class: "input"} %>
-
+

Stage of script [boot,install,postinstall, ressources](@script.stage )

+ +
ma
<%= form.text_field :lang , { class: "input"} %>
+

Langage of script (ipxe,preseed, yaml,bash ...)(@script.lang )

+
- + <% if script.lock == true %> + + <% else %> + + + <% end %>
+

Script himself (@script.content )

+
- -
+ <%= form.label :lock, class: "checkbox" %> + <%= form.check_box :lock %> +
+
- +
- + <%= link_to "Return", "/scripts", class: "button is-success" %>
<% end %>
-<%= button_to "Destroy", @script, method: :delete, class: "button is-danger" %> \ No newline at end of file +<%= button_to "Delete", script_path( @script), method: :delete, class: "button is-small is-danger" %> diff --git a/src/autogen/app/views/sites/_form.html.erb b/src/autogen/app/views/sites/_form.html.erb index fb545ab..4d2822d 100644 --- a/src/autogen/app/views/sites/_form.html.erb +++ b/src/autogen/app/views/sites/_form.html.erb @@ -5,12 +5,16 @@ <%= form.text_field :name , { class: "input"} %>
+

Site name, Refered by @site.name in script

+
<%= form.text_field :domain , { class: "input"} %>
+

Site dns domain (@site.domain)

+
@@ -18,6 +22,7 @@
<%= form.text_field :gateway , { class: "input"} %>
+

Site Gateway (@site.gateway)

@@ -25,6 +30,8 @@
<%= form.text_field :nameserver , { class: "input"} %>
+

Site Nameserver (@site.nameserver)

+
@@ -33,27 +40,24 @@
<%= form.text_field :network , { class: "input"} %>
+

Site Network (@site.network)

<%= form.text_field :netmask , { class: "input"} %>
+

Site Netmask (@site.netmask)

-
- <%= form.label :api_url, class: "label" %> -
- <%= form.text_field :api_url , { class: "input"} %> -
-
<%= form.label :nfsserver_path, class: "label" %>
<%= form.text_field :nfsserver_path , { class: "input"} %>
+

Site nfs server path (@site.nfsserver_path)

@@ -63,6 +67,7 @@
<%= form.text_field :api_ip , { class: "input"} %>
+

Api ip (@site.api_ip)

@@ -70,14 +75,18 @@
<%= form.text_field :api_port , { class: "input"} %>
+

Api port (@site.api_ip)

+
- -
- <%= form.text_field :api_url , { class: "input"} %> + +
+ <%= form.text_field :api_url , { class: "input"} %> +
+

Api url (@site.api_url) ( if defined, replace acces by ip:port )

+

Generique Api access is @site.api_uri ( if api_url is defined = @site.api_url else = http://site.api_ip:site.api.port )

-
@@ -85,14 +94,17 @@
<%= form.text_field :fileserver_uri , { class: "input"} %>
-
+

Web server with local content to download ( kernel, isos ..) (@site.fileserver_uri )

+
<%= form.text_field :fileserver_basepath , { class: "input"} %>
+

Content directory on local webserver (@site.fileserver_basepath )

+
@@ -101,6 +113,8 @@
<%= form.text_field :cfenginehub , { class: "input"} %>
+

cfengine url (@site.cfenginehub )

+ <%= link_to "Goto cfengine hub", "http://#{@site.cfenginehub}", class: "button is-info", :target => "_blank" %> @@ -110,6 +124,8 @@
<%= form.text_field :country , { class: "input"} %>
+

Country of site (@site.country )

+
@@ -117,6 +133,8 @@
<%= form.text_field :timezone , { class: "input"} %>
+

Timezone of site (@site.timezone )

+