correction multiple

main
zen 2024-05-01 21:58:14 +02:00
parent 7d6b4393c3
commit dd079ec88f
19 changed files with 308 additions and 163 deletions

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -45,4 +45,4 @@
<%= link_to "Back", :back %>
</div>
</div>
</div>
</div>

View File

@ -6,7 +6,6 @@
<div class="field">
<%= f.email_field :email, autofocus: true, autocomplete: "email" , class: "input is-small" , placeholder: :email %>
</div>
<div class="field">
<%= f.password_field :password, autocomplete: "current-password" ,class: "input is-small" , placeholder: :password%>
</div>
@ -26,4 +25,4 @@
<%= render "devise/shared/links" %>
</div>
</div>
</div>
</div>

View File

@ -1,4 +1,3 @@
<%# _form.html.erb %>
<div class="columns">
<div class="column">
<div class="box">
@ -109,7 +108,7 @@
<div class="field-body">
<div class="field">
<div class="control">
<%= form.text_field :install_ip , { class: "input"} %>
<%= form.text_field :install_ip , { class: "input", disabled: true } %>
</div>
<p class="help">Ip during install of host, Refered by @host.install_ip in script</p>
</div>
@ -123,7 +122,7 @@
<div class="field-body">
<div class="field">
<div class="control">
<%= form.text_field :status , { class: "input"} %>
<%= form.text_field :status , { class: "input" , disabled: true } %>
</div>
<p class="help">Host status, Refered by @host.status in script</p>
</div>
@ -137,7 +136,7 @@
<div class="field-body">
<div class="field">
<div class="control">
<%= form.text_field :mac , { class: "input"} %>
<%= form.text_field :mac , { class: "input", disabled: true } %>
</div>
<p class="help">MAc Adress, Refered by @host.mac in script</p>
</div>
@ -171,7 +170,7 @@
</div>
<div class="control">
<%= form.label :lusk_key, class: "label is-small" %>
<%= form.text_field :lusk_key , { class: "input"} %>
<%= form.text_field :lusk_key , { class: "input", disabled: true } %>
<p class="help">Lusk encrypt key, Refered by @host.lusk_key in script</p>
</div>

View File

@ -1,69 +1,120 @@
<div class="card" id="<%= dom_id host %>">
<header class="card-header">
<p class="card-header-title">
<%= host.hostname %>
</p>
<button class="card-header-icon" aria-label="more options">
<span class="icon">
<i class="fas fa-angle-down" aria-hidden="true"></i>
</span>
</button>
</header>
<div class="card-content">
<div class="content">
<p>
<strong>Ip:</strong>
<%= host.ip %>
</p>
<p style="color: green"><%= notice %></p>
<div class="columns">
<div class="column">
<p>
<strong>Status:</strong>
<%= host.status %>
</p>
<div class="box">
<% if @host.errors.any? %>
<div style="color: red">
<h2><%= pluralize(@host.errors.count, "error") %> prohibited this host from being saved:</h2>
<ul>
<% @host.errors.each do |error| %>
<li><%= error.full_message %></li>
<% end %>
</ul>
</div>
<% end %>
<p>
<strong>Mac:</strong>
<%= host.mac %>
</p>
<p>
<strong>Discover:</strong>
<%= host.discover %>
</p>
<div id="<%= dom_id @host %>">
<p>
<strong>Hostname:</strong>
<%= @host.hostname %>
</p>
<p>
<strong>Installed:</strong>
<%= host.installed %>
</p>
<p>
<strong>UUID:</strong>
<%= @host.uuid %>
</p>
<p>
<strong>Serial:</strong>
<%= @host.product %>
</p>
<p>
<strong>Serial:</strong>
<%= @host.serial %>
</p>
<p>
<strong>MAC:</strong>
<%= @host.mac %>
</p>
<p>
<strong>Interface:</strong>
<%= @host.interface %>
</p>
<p>
<strong>IP:</strong>
<%= @host.ip %>
</p>
<p>
<strong>IP Access:</strong>
<%= @host.access_ip %>
</p>
<p>
<strong>Install IP:</strong>
<%= @host.install_ip %>
</p>
<p>
<strong>Status:</strong>
<%= @host.status %>
</p>
<p>
<strong>Device:</strong>
<%= @host.host_device %>
</p>
<p>
<strong>Lusk Encryption:</strong>
<%= @host.lusk_encrypt %>
</p>
<p>
<strong>Lusk Device to Encrypt:</strong>
<%= @host.lusk_device %>
</p>
<p>
<strong>Lusk Key:</strong>
<%= @host.lusk_key %>
</p>
<p>
<strong>Interface:</strong>
<%= host.interface %>
</p>
<p>
<strong>Install Template:</strong>
<% if defined?host.installtemplate.name %>
<%= host.installtemplate.name %>
<% else %>
not set
<% end %>
</p>
<p>
<strong>Site</strong>
<%= @host.site.name %>
</p>
<p>
<strong>Lang</strong>
<%= @host.lang %>
</p>
<p>
<strong>Site:</strong>
<% if defined?host.site.name %>
<%= host.site.name %>
<% else %>
not set
<% end %>
</p>
<p>
<strong>Root Account</strong>
<%= @host.rootaccount.name %>
</p>
<p>
<strong>Main Account</strong>
<%= @host.mainaccount.name %>
</p>
<p>
<strong>Discover</strong>
<%= @host.discover %>
</p>
<p>
<strong>Installed</strong>
<%= @host.installed %>
</p>
<p>
<strong>Toinstall</strong>
<%= @host.toinstall %>
</p>
</div>
<div class="buttons has-addons">
<%= 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'}%></tr>
<%= 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" %>
</div>
</div>
</div>
<button class="button">
<%= link_to "Edit this host", edit_host_path(host) %>
</button>
</div>

View File

@ -1,9 +1,20 @@
<tr>
<td><%= host.hostname %></td>
<td><%= host.status %></td>
<td><span class="tag is-info"><%= host.status %></span></td>
<td><%= host.installtemplate.name %></td>
<td><%= button_to "Edit", edit_host_path(host), method: :get, class: "button is-small is-primary" %></td>
<td><button id=<%= host.uuid %> class="getIpxeScript button is-small is-primary">IPXE</button></td>
<td><button id=<%= host.uuid %> class="getInstallScript button is-small is-primary">Install</button></td>
<td><button id=<%= host.uuid %> class="getPostinstallScript button is-small is-primary">Postinstall</button></td>
<td>
<div class="buttons has-addons">
<%= 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" %>
</div>
</td>
<td>
<div class="buttons has-addons">
<button id=<%= host.uuid %> class="getIpxeScript button is-small is-primary">IPXE</button>
<button id=<%= host.uuid %> class="getInstallScript button is-small is-primary">Install</button>
<button id=<%= host.uuid %> class="getPostinstallScript button is-small is-primary">Postinstall</button>
</div>
</td>
</tr>

View File

@ -8,20 +8,22 @@
<th colspan="1">Hostname</th>
<th colspan="1">Status</th>
<th colspan="1">Template</th>
<th colspan="1"></th>
<th colspan="1">Action</th>
<th colspan="1">View Generated Script</th>
</tr>
</thead>
<tbody>
<% @hosts.each do |host| %>
<% @hosts.each do |host| %>
<%= render :partial => 'hostraw', :locals => { :host => host} %>
<% end %>
<% end %>
</tbody>
</table>
<div id="script_div">
<h2>Render</h2>
<pre style="overflow:scroll; max-height:500px" id="script_result">
</pre>
</div>
</div>
<div id="script_div">
<h2>Render</h2>
<pre style="overflow:scroll; max-height:500px" id="script_result">
</pre>
</div>

View File

@ -1,12 +1,9 @@
<section>
<p style="color: green"><%= notice %></p>
</section>
<section>
<%= render @host %>
<div>
<button class="button">
<%= link_to "Back to hosts", hosts_path %>
</button>
</div>
</section>
<section>
<%= link_to "Back to hosts", "/hosts", class: "button is-success is-small is-pulled-left" %>
</section>

View File

@ -48,8 +48,10 @@
<div class="navbar-item">
<div class="buttons">
<% if !user_signed_in? %>
>
<%= link_to "Login", new_user_session_path, class: "button is-light" %>
<% else %>
<h1>Bonjour <%= current_user.name %></h2>
<%= link_to "Profil", edit_user_registration_path, class: "button is-light" %>
<%= button_to "Logout", destroy_user_session_path, method: :delete, class: "button is-light" %>
<% end %>
@ -58,6 +60,3 @@
</div>
</div>
</nav>

View File

@ -17,6 +17,8 @@
<div class="control">
<%= form.text_field :name , { class: "input"} %>
</div>
<p class="help">Name of script (@script.name )</p>
</div>
<div class="field is-grouped">
@ -25,45 +27,51 @@
<div class="control">
<%= form.text_field :stage , { class: "input"} %>
</div>
</div>
<p class="help">Stage of script [boot,install,postinstall, ressources](@script.stage )</p>
</div>ma
<div class="field">
<label class="label">Lang</label>
<div class="control">
<%= form.text_field :lang , { class: "input"} %>
</div>
<p class="help">Langage of script (ipxe,preseed, yaml,bash ...)(@script.lang )</p>
</div>
</div>
<div class="field">
<div>
<label class="label">Content</label>
<textarea class="textarea" name="script[content]" id="script_content" rows="15"><%= script.content %></textarea>
<% if script.lock == true %>
<textarea disabled class="textarea" name="script[content]" id="script_content" rows="15"><%= script.content %></textarea>
<% else %>
<textarea class="textarea" name="script[content]" id="script_content" rows="15"><%= script.content %></textarea>
<% end %>
</div>
<p class="help">Script himself (@script.content )</p>
</div>
<div class="control">
<label class="checkbox">
<% if script.lock %>
<input type="checkbox" name="script[lock]", id="script_lock", checked>
<% else %>
<input type="checkbox" name="script[lock]", id="script_lock">
<% end %>
Lock
</label>
</div>
<%= form.label :lock, class: "checkbox" %>
<%= form.check_box :lock %>
</div>
<div class="control">
<div class="field">
<div>
<label class="label">Description</label>
<textarea class="textarea" name="script[description]" id="script_description" rows="2"><%= script.description %></textarea>
<textarea class="textarea readonly" name="script[description]" id="script_description" rows="2"><%= script.description %></textarea>
</div>
</div>
<div class="control">
<button class="button is-link">Submit</button>
<button class="button is-link">Submit</button>
<%= link_to "Return", "/scripts", class: "button is-success" %>
</div>
<% end %>
</div>
<%= button_to "Destroy", @script, method: :delete, class: "button is-danger" %>
<%= button_to "Delete", script_path( @script), method: :delete, class: "button is-small is-danger" %>

View File

@ -5,12 +5,16 @@
<%= form.text_field :name , { class: "input"} %>
</div>
</div>
<p class="help">Site name, Refered by @site.name in script</p>
<div class="field is-grouped">
<div class="field">
<label class="label">Domain</label>
<div class="control">
<%= form.text_field :domain , { class: "input"} %>
</div>
<p class="help">Site dns domain (@site.domain)</p>
</div>
<div class="field">
@ -18,6 +22,7 @@
<div class="control">
<%= form.text_field :gateway , { class: "input"} %>
</div>
<p class="help">Site Gateway (@site.gateway)</p>
</div>
<div class="field">
@ -25,6 +30,8 @@
<div class="control">
<%= form.text_field :nameserver , { class: "input"} %>
</div>
<p class="help">Site Nameserver (@site.nameserver)</p>
</div>
</div>
<div class="field is-grouped">
@ -33,27 +40,24 @@
<div class="control">
<%= form.text_field :network , { class: "input"} %>
</div>
<p class="help">Site Network (@site.network)</p>
</div>
<div class="field">
<label class="label">Netmask</label>
<div class="control">
<%= form.text_field :netmask , { class: "input"} %>
</div>
<p class="help">Site Netmask (@site.netmask)</p>
</div>
</div>
<div class="field">
<%= form.label :api_url, class: "label" %>
<div class="control">
<%= form.text_field :api_url , { class: "input"} %>
</div>
</div>
<div class="field">
<%= form.label :nfsserver_path, class: "label" %>
<div class="control">
<%= form.text_field :nfsserver_path , { class: "input"} %>
</div>
<p class="help">Site nfs server path (@site.nfsserver_path)</p>
</div>
@ -63,6 +67,7 @@
<div class="control">
<%= form.text_field :api_ip , { class: "input"} %>
</div>
<p class="help">Api ip (@site.api_ip)</p>
</div>
<div class="field">
@ -70,14 +75,18 @@
<div class="control">
<%= form.text_field :api_port , { class: "input"} %>
</div>
<p class="help">Api port (@site.api_ip)</p>
</div>
<div class="field">
<label class="label">api_url</label>
<div class="control">
<%= form.text_field :api_url , { class: "input"} %>
<label class="label">api_url</label>
<div class="control">
<%= form.text_field :api_url , { class: "input"} %>
</div>
<p class="help">Api url (@site.api_url) ( if defined, replace acces by ip:port )</p>
<p class="help">Generique Api access is @site.api_uri ( if api_url is defined = @site.api_url else = http://site.api_ip:site.api.port )</p>
</div>
</div>
</div>
<div class="field is-grouped">
<div class="field">
@ -85,14 +94,17 @@
<div class="control">
<%= form.text_field :fileserver_uri , { class: "input"} %>
</div>
</div>
<p class="help">Web server with local content to download ( kernel, isos ..) (@site.fileserver_uri )</p>
</div>
<div class="field">
<label class="label">fileserver_basepath</label>
<div class="control">
<%= form.text_field :fileserver_basepath , { class: "input"} %>
</div>
<p class="help">Content directory on local webserver (@site.fileserver_basepath )</p>
</div>
</div>
@ -101,6 +113,8 @@
<div class="control">
<%= form.text_field :cfenginehub , { class: "input"} %>
</div>
<p class="help">cfengine url (@site.cfenginehub )</p>
</div>
<%= link_to "Goto cfengine hub", "http://#{@site.cfenginehub}", class: "button is-info", :target => "_blank" %>
@ -110,6 +124,8 @@
<div class="control">
<%= form.text_field :country , { class: "input"} %>
</div>
<p class="help">Country of site (@site.country )</p>
</div>
<div class="field">
@ -117,6 +133,8 @@
<div class="control">
<%= form.text_field :timezone , { class: "input"} %>
</div>
<p class="help">Timezone of site (@site.timezone )</p>
</div>
<div class="control">