diff --git a/src/autogen/app/assets/javascript/apicall.js b/src/autogen/app/assets/javascript/apicall.js
new file mode 100644
index 0000000..90bc813
--- /dev/null
+++ b/src/autogen/app/assets/javascript/apicall.js
@@ -0,0 +1,50 @@
+function get_ipxe(id){
+ $.ajax({
+ method: "GET",
+ url: "/host/ipxe",
+ data: { uuid:id}
+ }).done(function(result) {
+
+ $("#script_result").empty().append(result)
+ });
+}
+
+function get_install(id){
+ $.ajax({
+ method: "GET",
+ url: "/host/install",
+ data: { uuid:id}
+ }).done(function(result) {
+
+ $("#script_result").empty().append(result)
+ });
+}
+
+function get_postinstall(id){
+ $.ajax({
+ method: "GET",
+ url: "/host/postinstall",
+ data: { uuid:id}
+ }).done(function(result) {
+
+ $("#script_result").empty().append(result)
+ });
+}
+
+
+
+$( document ).ready(function() {
+ $(document).on("click",".getIpxeScript", function(){
+ var id=$(this).attr('id')
+ get_ipxe(id)
+ });
+ $(document).on("click",".getInstallScript", function(){
+ var id=$(this).attr('id')
+ get_install(id)
+ });
+
+ $(document).on("click",".getPostinstallScript", function(){
+ var id=$(this).attr('id')
+ get_postinstall(id)
+ });
+});
\ No newline at end of file
diff --git a/src/autogen/app/assets/javascript/init.js b/src/autogen/app/assets/javascript/init.js
index 283de1b..c0121cb 100644
--- a/src/autogen/app/assets/javascript/init.js
+++ b/src/autogen/app/assets/javascript/init.js
@@ -1,7 +1,53 @@
+function get_ipxe(id){
+ $.ajax({
+ method: "GET",
+ url: "/host/ipxe",
+ data: { uuid:id}
+ }).done(function(result) {
+
+ $("#script_result").empty().append(result)
+ });
+}
+
+function get_install(id){
+ $.ajax({
+ method: "GET",
+ url: "/host/install",
+ data: { uuid:id}
+ }).done(function(result) {
+
+ $("#script_result").empty().append(result)
+ });
+}
+
+function get_postinstall(id){
+ $.ajax({
+ method: "GET",
+ url: "/host/postinstall",
+ data: { uuid:id}
+ }).done(function(result) {
+
+ $("#script_result").empty().append(result)
+ });
+}
+
$( document ).ready(function() {
$('.toggleable').next().hide();
$(document).on("click",".toggleable", function(){
$(this).toggleClass("is-active");
$(this).next().toggle();
});
+ $(document).on("click",".getIpxeScript", function(){
+ var id=$(this).attr('id')
+ get_ipxe(id)
+ });
+ $(document).on("click",".getInstallScript", function(){
+ var id=$(this).attr('id')
+ get_install(id)
+ });
+
+ $(document).on("click",".getPostinstallScript", function(){
+ var id=$(this).attr('id')
+ get_postinstall(id)
+ });
})
\ No newline at end of file
diff --git a/src/autogen/app/assets/stylesheets/style.css b/src/autogen/app/assets/stylesheets/style.css
new file mode 100644
index 0000000..8dc0758
--- /dev/null
+++ b/src/autogen/app/assets/stylesheets/style.css
@@ -0,0 +1,23 @@
+.scrollDiv {
+ max-height: 80vh;
+ overflow:auto;
+}
+
+table {
+ /* Not required only for visualizing */
+ border-collapse: collapse;
+ width: 100%;
+ }
+
+table thead tr th {
+ /* Important */
+ background-color: white;
+ position: sticky;
+ z-index: 100;
+ top: 0;
+}
+
+td {
+ /* Not required only for visualizing */
+ padding: 1em;
+}
\ No newline at end of file
diff --git a/src/autogen/app/controllers/accounts_controller.rb b/src/autogen/app/controllers/accounts_controller.rb
new file mode 100644
index 0000000..e58bbfc
--- /dev/null
+++ b/src/autogen/app/controllers/accounts_controller.rb
@@ -0,0 +1,80 @@
+class AccountsController < ApplicationController
+ before_action :set_account, only: %i[ show edit update destroy ]
+ before_action :set_pass, only: %i[ update ]
+ # GET /accounts or /accounts.json
+ def index
+ @accounts = Account.all
+ end
+
+ # GET /accounts/1 or /accounts/1.json
+ def show
+ end
+
+ # GET /accounts/new
+ def new
+ @account = Account.new
+ end
+
+ # GET /accounts/1/edit
+ def edit
+ end
+
+ # POST /accounts or /accounts.json
+ def create
+ @account = Account.new(account_params.except(:password))
+
+ respond_to do |format|
+ if @account.save
+ format.html { redirect_to account_url(@account), notice: "Account was successfully created." }
+ format.json { render :show, status: :created, location: @account }
+ else
+ format.html { render :new, status: :unprocessable_entity }
+ format.json { render json: @account.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PATCH/PUT /accounts/1 or /accounts/1.json
+ def update
+ respond_to do |format|
+ logger.debug(account_params)
+ if @account.update(account_params.except(:password))
+ format.html { redirect_to account_url(@account), notice: "Account was successfully updated." }
+ format.json { render :show, status: :ok, location: @account }
+ else
+ format.html { render :edit, status: :unprocessable_entity }
+ format.json { render json: @account.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /accounts/1 or /accounts/1.json
+ def destroy
+ @account.destroy!
+
+ respond_to do |format|
+ format.html { redirect_to accounts_url, notice: "Account was successfully destroyed." }
+ format.json { head :no_content }
+ end
+ end
+
+ private
+ # Use callbacks to share common setup or constraints between actions.
+ def set_account
+ @account = Account.find(params[:id])
+ end
+
+ def set_pass
+ # [IMPORTANT] Salt must be generated for prodution !
+
+ cmdline = "mkpasswd -m sha-512 -S 012345678 #{account_params[:password]}"
+ @account.encpassword = `#{cmdline}`.strip
+ account_params.delete(:password)
+
+ end
+
+ # Only allow a list of trusted parameters through.
+ def account_params
+ params.require(:account).permit(:name, :login, :password, :sshpubkey,:encpassword)
+ end
+end
diff --git a/src/autogen/app/controllers/application_controller.rb b/src/autogen/app/controllers/application_controller.rb
index 1576190..7ba5279 100644
--- a/src/autogen/app/controllers/application_controller.rb
+++ b/src/autogen/app/controllers/application_controller.rb
@@ -1,7 +1,6 @@
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :configure_permitted_parameters, if: :devise_controller?
-
protected
def configure_permitted_parameters
diff --git a/src/autogen/app/controllers/engine_controller.rb b/src/autogen/app/controllers/engine_controller.rb
new file mode 100644
index 0000000..061741a
--- /dev/null
+++ b/src/autogen/app/controllers/engine_controller.rb
@@ -0,0 +1,100 @@
+class EngineController < ApplicationController
+ before_action :set_host_by_uuid, only: %i[ generate_boot generate_install generate_postinstall generate_installed generate_metadata ]
+ def generateglobal
+ gv=Utils::Globalvar.new
+
+ puts gv.Get
+ 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.installip = params[:installip]
+ 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
+ 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"})
+ log.save()
+ script = @host.installtemplate.install.content
+ template = @host.installtemplate
+ @site = @host.site
+ host = @host
+ @template = @host.installtemplate
+ @host.update({status: "System Install"})
+ result = render inline: script, layout: false, content_type: 'text/plain'
+ @host.update({lastinstallgenerated: result})
+ 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"})
+ log.save()
+ @host.update({status: "System Post Install"})
+ script = @host.installtemplate.postinstall.content
+ template = @host.installtemplate
+ @ansible = Account.find_by(name: "ansible")
+ @site = @host.site
+ host = @host
+ @template = @host.installtemplate
+ result = render inline: script, layout: false, content_type: 'text/plain'
+ @host.update({lastpostinstallgenerated: result})
+ end
+ end
+
+ def generate_installed
+ sourceip=request.headers['REMOTE_ADDR']
+ log=Log.new({source: "#{sourceip}", crit: "info",message: "#{@host.uuid} Install Finished."})
+ log.save()
+ if @host.update({status: "Installation Finish", installed: true, toinstall: false, interface: params[:interface],ip: params[:installip]})
+ render plain: "ok"
+ else
+ render json: @host.errors
+ end
+ end
+
+ def generate_metadata
+ @host = Host.find_by(uuid: params[:uuid])
+ script = Script.find_by({name: "metadata",stage: "config"})
+ result = render inline: script.content, layout: false, content_type: 'text/plain'
+ end
+
+ private
+ # Use callbacks to share common setup or constraints between actions.
+ 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")
+ @host = Host.new(hostname: "New host detected",uuid: params["uuid"], installip: params["installip"], installtemplate: @template,site: @site, mac: params["mac"], status: "discover", discover: true,installed: false, toinstall: false,rootaccount: @account, mainaccount: @account)
+ @host.save!
+ end
+ end
+ # Only allow a list of trusted parameters through.
+ def host_params
+ params.require(:host).permit(:uuid, :hostname, :ip, :status, :mac, :discover, :installed, :interface , :installtemplate, :site , :installtemplate_id, :site_id, :rootaccount_id, :mainaccount_id,:toinstall, :installip)
+ end
+
+end
diff --git a/src/autogen/app/controllers/home_controller.rb b/src/autogen/app/controllers/home_controller.rb
deleted file mode 100644
index 95f2992..0000000
--- a/src/autogen/app/controllers/home_controller.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-class HomeController < ApplicationController
- def index
- end
-end
diff --git a/src/autogen/app/controllers/hosts_controller.rb b/src/autogen/app/controllers/hosts_controller.rb
new file mode 100644
index 0000000..11f13f1
--- /dev/null
+++ b/src/autogen/app/controllers/hosts_controller.rb
@@ -0,0 +1,139 @@
+class HostsController < ApplicationController
+ before_action :authenticate_user!
+
+ 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 ]
+
+ # GET /hosts or /hosts.json
+ def index
+ @hosts = Host.asc(:hostname)
+ end
+
+ # GET /hosts/1 or /hosts/1.json
+ def show
+ end
+
+ # GET /hosts/new
+ def new
+ @host = Host.new
+ end
+
+ # GET /hosts/1/edit
+ def edit
+ end
+
+ # POST /hosts or /hosts.json
+ def create
+ @host = Host.new(host_params)
+ respond_to do |format|
+ if @host.save
+ format.html { redirect_to host_url(@host), notice: "Host was successfully created." }
+ format.json { render :show, status: :created, location: @host }
+ else
+ format.html { render :new, status: :unprocessable_entity }
+ format.json { render json: @host.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PATCH/PUT /hosts/1 or /hosts/1.json
+ def update
+ puts host_params
+ respond_to do |format|
+ log=Log.new({source: "admin", crit: "info",message: "User xxx update #{host_params[:hostname]}"})
+ log.save()
+ if @host.update(host_params)
+ format.html { redirect_to host_url(@host), notice: "Host was successfully updated." }
+ format.json { render :show, status: :ok, location: @host }
+ else
+ format.html { render :edit, status: :unprocessable_entity }
+ format.json { render json: @host.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /hosts/1 or /hosts/1.json
+ def destroy
+ @host.destroy!
+
+ respond_to do |format|
+ format.html { redirect_to hosts_url, notice: "Host was successfully destroyed." }
+ format.json { head :no_content }
+ end
+ end
+
+ def generate_boot
+ if @host
+
+ @host.mac = params[:mac]
+ @host.installip = params[:installip]
+ boot_script = @host.installtemplate.boot.content
+ template = @host.installtemplate
+ @site = @host.site
+ host = @host
+ @template = @host.installtemplate
+ result = render inline: boot_script, layout: false, content_type: 'text/plain'
+ @host.update({lastbootgenerated: result})
+
+ end
+ end
+
+ def generate_install
+ if @host
+ script = @host.installtemplate.install.content
+ template = @host.installtemplate
+ @site = @host.site
+ host = @host
+ @template = @host.installtemplate
+ result = render inline: script, layout: false, content_type: 'text/plain'
+ @host.update({lastinstallgenerated: result})
+ end
+ end
+
+ def generate_postinstall
+ if @host
+ script = @host.installtemplate.postinstall.content
+ template = @host.installtemplate
+ @ansible = Account.find_by(name: "ansible")
+ @site = @host.site
+ host = @host
+ @template = @host.installtemplate
+ result = render inline: script, layout: false, content_type: 'text/plain'
+ end
+ end
+
+
+ def generate_metadata
+ @host = Host.find_by(uuid: params[:uuid])
+ script = Script.find_by({name: "metadata",stage: "config"})
+ result = render inline: script.content, layout: false, content_type: 'text/plain'
+ end
+
+ private
+ # Use callbacks to share common setup or constraints between actions.
+
+ def set_host
+ logger.debug "#{params}"
+ @host = Host.find(params[:id])
+ end
+
+ 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")
+ @host = Host.new(hostname: "New host detected",uuid: params["uuid"], installip: params["installip"], installtemplate: @template,site: @site, mac: params["mac"], status: "discover", discover: true,installed: false, toinstall: false,rootuser: @account, mainuser: @account)
+ @host.save!
+ end
+ end
+
+ # Only allow a list of trusted parameters through.
+ def host_params
+ params.require(:host).permit(:uuid, :hostname, :ip, :status, :mac, :discover, :installed, :interface , :installtemplate, :site , :installtemplate_id, :site_id, :rootaccount_id, :mainaccount_id,:toinstall, :installip)
+ end
+end
diff --git a/src/autogen/app/controllers/installtemplates_controller.rb b/src/autogen/app/controllers/installtemplates_controller.rb
new file mode 100644
index 0000000..3bc3bf1
--- /dev/null
+++ b/src/autogen/app/controllers/installtemplates_controller.rb
@@ -0,0 +1,71 @@
+class InstalltemplatesController < ApplicationController
+ before_action :authenticate_user!
+ before_action :set_installtemplate, only: %i[ show edit update destroy ]
+
+ # GET /installtemplates or /installtemplates.json
+ def index
+ @installtemplates = Installtemplate.asc(:name)
+ end
+
+ # GET /installtemplates/1 or /installtemplates/1.json
+ def show
+ end
+
+ # GET /installtemplates/new
+ def new
+ @installtemplate = Installtemplate.new
+ end
+
+ # GET /installtemplates/1/edit
+ def edit
+ end
+
+ # POST /installtemplates or /installtemplates.json
+ def create
+ @installtemplate = Installtemplate.new(installtemplate_params)
+
+ respond_to do |format|
+ if @installtemplate.save
+ format.html { redirect_to installtemplate_url(@installtemplate), notice: "Installtemplate was successfully created." }
+ format.json { render :show, status: :created, location: @installtemplate }
+ else
+ format.html { render :new, status: :unprocessable_entity }
+ format.json { render json: @installtemplate.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PATCH/PUT /installtemplates/1 or /installtemplates/1.json
+ def update
+ respond_to do |format|
+ if @installtemplate.update(installtemplate_params)
+ format.html { redirect_to installtemplate_url(@installtemplate), notice: "Installtemplate was successfully updated." }
+ format.json { render :show, status: :ok, location: @installtemplate }
+ else
+ format.html { render :edit, status: :unprocessable_entity }
+ format.json { render json: @installtemplate.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /installtemplates/1 or /installtemplates/1.json
+ def destroy
+ @installtemplate.destroy!
+
+ respond_to do |format|
+ format.html { redirect_to installtemplates_url, notice: "Installtemplate was successfully destroyed." }
+ format.json { head :no_content }
+ end
+ end
+
+ private
+ # Use callbacks to share common setup or constraints between actions.
+ def set_installtemplate
+ @installtemplate = Installtemplate.find(params[:id])
+ end
+
+ # Only allow a list of trusted parameters through.
+ def installtemplate_params
+ params.require(:installtemplate).permit(:name, :ostype, :osversion, :repository, :nfsroot, :kernel, :initrd, :rootfile, :boot_id, :install_id, :postinstall_id, :lang)
+ end
+end
diff --git a/src/autogen/app/controllers/logs_controller.rb b/src/autogen/app/controllers/logs_controller.rb
new file mode 100644
index 0000000..31fdeb7
--- /dev/null
+++ b/src/autogen/app/controllers/logs_controller.rb
@@ -0,0 +1,75 @@
+class LogsController < ApplicationController
+ before_action :authenticate_user!
+ before_action :set_log, only: %i[ show edit update destroy ]
+
+ # GET /logs or /logs.json
+ def index
+ @logs = Log.desc(:created_at)
+ end
+
+ # GET /logs/1 or /logs/1.json
+ def show
+ end
+
+ # GET /logs/new
+ def new
+ @log = Log.new
+ end
+
+ # GET /logs/1/edit
+ def edit
+ end
+
+ # POST /logs or /logs.json
+ def create
+ @log = Log.new(log_params)
+ respond_to do |format|
+ if @log.save
+ format.html { redirect_to log_url(@log), notice: "Log was successfully created." }
+ format.json { render :show, status: :created, location: @log }
+ else
+ format.html { render :new, status: :unprocessable_entity }
+ format.json { render json: @log.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PATCH/PUT /logs/1 or /logs/1.json
+ def update
+ puts log_params
+ respond_to do |format|
+ if @log.update(log_params)
+ format.html { redirect_to log_url(@log), notice: "Log was successfully updated." }
+ format.json { render :show, status: :ok, location: @log }
+ else
+ format.html { render :edit, status: :unprocessable_entity }
+ format.json { render json: @log.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /logs/1 or /logs/1.json
+ def destroy
+ @log.destroy!
+
+ respond_to do |format|
+ format.html { redirect_to logs_url, notice: "Log was successfully destroyed." }
+ format.json { head :no_content }
+ end
+ end
+
+
+ private
+ # Use callbacks to share common setup or constraints between actions.
+
+ def set_log
+ logger.debug "#{params}"
+ @log = Log.find(params[:id])
+ end
+
+
+ # Only allow a list of trusted parameters through.
+ def log_params
+ params.require(:log).permit(:source, :crit, :message)
+ end
+ end
diff --git a/src/autogen/app/controllers/pages_controller.rb b/src/autogen/app/controllers/pages_controller.rb
new file mode 100644
index 0000000..2daa56d
--- /dev/null
+++ b/src/autogen/app/controllers/pages_controller.rb
@@ -0,0 +1,5 @@
+class PagesController < ApplicationController
+ def index
+ @hostslist = Host.all
+ end
+end
diff --git a/src/autogen/app/controllers/sites_controller.rb b/src/autogen/app/controllers/sites_controller.rb
new file mode 100644
index 0000000..edfafb8
--- /dev/null
+++ b/src/autogen/app/controllers/sites_controller.rb
@@ -0,0 +1,73 @@
+class SitesController < ApplicationController
+ before_action :authenticate_user!
+ before_action :set_site, only: %i[ show edit update destroy ]
+
+ # GET /sites or /sites.json
+ def index
+ @sites = Site.all
+ end
+
+ # GET /sites/1 or /sites/1.json
+ def show
+ end
+
+ # GET /sites/new
+ def new
+ @site = Site.new
+ end
+
+ # GET /sites/1/edit
+ def edit
+ end
+
+ # POST /sites or /sites.json
+ def create
+ @site = Site.new(site_params)
+
+ respond_to do |format|
+ if @site.save
+ format.html { redirect_to site_url(@site), notice: "Site was successfully created." }
+ format.json { render :show, status: :created, location: @site }
+ else
+ format.html { render :new, status: :unprocessable_entity }
+ format.json { render json: @site.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # PATCH/PUT /sites/1 or /sites/1.json
+ def update
+ respond_to do |format|
+ if @site.update(site_params)
+ format.html { redirect_to site_url(@site), notice: "Site was successfully updated." }
+ format.json { render :show, status: :ok, location: @site }
+ else
+ format.html { render :edit, status: :unprocessable_entity }
+ format.json { render json: @site.errors, status: :unprocessable_entity }
+ end
+ end
+ end
+
+ # DELETE /sites/1 or /sites/1.json
+ def destroy
+ @site.destroy!
+
+ respond_to do |format|
+ format.html { redirect_to sites_url, notice: "Site was successfully destroyed." }
+ format.json { head :no_content }
+ end
+ end
+
+ private
+ # Use callbacks to share common setup or constraints between actions.
+ def set_site
+ @site = Site.find(params[:id])
+ end
+
+ # Only allow a list of trusted parameters through.
+ def site_params
+ params.require(:site).permit(:name, :domain, :gateway, :nameserver, :network, :netmask, :server_ip, :server_port, :fileserver_ip, :fileserver_port,:fileserver_basepath, :timezone, :apiurl, :cfenginehub)
+ end
+
+
+end
diff --git a/src/autogen/app/models/account.rb b/src/autogen/app/models/account.rb
new file mode 100644
index 0000000..5670dcc
--- /dev/null
+++ b/src/autogen/app/models/account.rb
@@ -0,0 +1,10 @@
+class Account
+ include Mongoid::Document
+ include Mongoid::Timestamps
+ field :name, type: String
+ field :login, type: String
+ field :encpassword, type: String
+ field :sshpubkey, type: String
+ has_many :rootref, class_name: "Host", inverse_of: :rootuser
+ has_many :userref, class_name: "Host", inverse_of: :mainuser
+end
diff --git a/src/autogen/app/models/host.rb b/src/autogen/app/models/host.rb
new file mode 100644
index 0000000..d0b460d
--- /dev/null
+++ b/src/autogen/app/models/host.rb
@@ -0,0 +1,21 @@
+class Host
+ include Mongoid::Document
+ include Mongoid::Timestamps
+ field :uuid, type: String
+ field :hostname, type: String
+ field :ip, type: String
+ field :installip, type: String
+ field :status, type: String
+ field :mac, type: String
+ field :discover, type: Mongoid::Boolean
+ field :installed, type: Mongoid::Boolean
+ field :toinstall, type: Mongoid::Boolean
+ field :interface, type: String
+ field :lastbootgenerated, type: String , default: ''
+ field :lastinstallgenerated, type: String , default: ''
+ field :lastpostinstallgenerated, type: String, default: ''
+ belongs_to :installtemplate , class_name: "Installtemplate", inverse_of: :hostreferences
+ belongs_to :site , class_name: "Site", inverse_of: :sitereferences
+ belongs_to :rootaccount , class_name: "Account", inverse_of: :rootref
+ belongs_to :mainaccount , class_name: "Account", inverse_of: :accountref
+end
diff --git a/src/autogen/app/models/installtemplate.rb b/src/autogen/app/models/installtemplate.rb
new file mode 100644
index 0000000..4da642b
--- /dev/null
+++ b/src/autogen/app/models/installtemplate.rb
@@ -0,0 +1,18 @@
+class Installtemplate
+ include Mongoid::Document
+ include Mongoid::Timestamps
+ field :name, type: String
+ field :ostype, type: String
+ field :osversion, type: String
+ field :repository, type: String
+ field :nfsroot, type: String
+ field :kernel, type: String
+ field :initrd, type: String
+ field :rootfile, type: String
+ field :lang, type: String
+ has_many :hostreferences, class_name: "Host", inverse_of: :installtemplate
+ belongs_to :boot , class_name: "Script", inverse_of: :bootref
+ belongs_to :install , class_name: "Script", inverse_of: :installref
+ belongs_to :postinstall , class_name: "Script", inverse_of: :postsinstallref
+
+end
diff --git a/src/autogen/app/models/log.rb b/src/autogen/app/models/log.rb
new file mode 100644
index 0000000..c9226de
--- /dev/null
+++ b/src/autogen/app/models/log.rb
@@ -0,0 +1,8 @@
+class Log
+ include Mongoid::Document
+ include Mongoid::Timestamps
+ field :source, type: String
+ field :crit, type: String
+ field :message, type: String
+end
+
\ No newline at end of file
diff --git a/src/autogen/app/models/site.rb b/src/autogen/app/models/site.rb
new file mode 100644
index 0000000..ad0bc48
--- /dev/null
+++ b/src/autogen/app/models/site.rb
@@ -0,0 +1,21 @@
+class Site
+ include Mongoid::Document
+ include Mongoid::Timestamps
+ field :name, type: String
+ field :domain, type: String
+ field :gateway, type: String
+ field :nameserver, type: String
+ field :network, type: String
+ field :netmask, type: String
+ field :server_ip, type: String
+ field :server_port, type: String
+ field :fileserver_ip, type: String
+ field :fileserver_port, type: String
+ field :fileserver_basepath, type: String
+ field :timezone, type: String
+ field :apiurl, type: String
+ field :description, type: String
+ field :cfenginehub, type: String
+ has_many :sitereferences, class_name: "Host", inverse_of: :site
+
+end
diff --git a/src/autogen/app/views/accounts/_account.html.erb b/src/autogen/app/views/accounts/_account.html.erb
new file mode 100644
index 0000000..a6009e0
--- /dev/null
+++ b/src/autogen/app/views/accounts/_account.html.erb
@@ -0,0 +1,20 @@
+
+
+
+ Name:
+ <%= account.name %>
+
+
+
+ Login:
+ <%= account.login %>
+
+
+
+ SSH Key:
+ <%= account.sshpubkey %>
+
+
+
+
+
diff --git a/src/autogen/app/views/accounts/_account.json.jbuilder b/src/autogen/app/views/accounts/_account.json.jbuilder
new file mode 100644
index 0000000..c414bf3
--- /dev/null
+++ b/src/autogen/app/views/accounts/_account.json.jbuilder
@@ -0,0 +1,2 @@
+json.extract! account, :id, :name, :login, :sshpubkey, :password, :created_at, :updated_at
+json.url account_url(account, format: :json)
diff --git a/src/autogen/app/views/accounts/_account_raw.html.erb b/src/autogen/app/views/accounts/_account_raw.html.erb
new file mode 100644
index 0000000..6abd520
--- /dev/null
+++ b/src/autogen/app/views/accounts/_account_raw.html.erb
@@ -0,0 +1,5 @@
+
+<%= account.name %>
+<%= account.login %>
+ <%= button_to "Edit", edit_account_path(account), method: :get, class: "button is-small is-primary" %>
+
diff --git a/src/autogen/app/views/accounts/_form.html.erb b/src/autogen/app/views/accounts/_form.html.erb
new file mode 100644
index 0000000..fab8de3
--- /dev/null
+++ b/src/autogen/app/views/accounts/_form.html.erb
@@ -0,0 +1,51 @@
+
+<%= form_with(model: account) do |form| %>
+ <% if account.errors.any? %>
+
+
<%= pluralize(account.errors.count, "error") %> prohibited this account from being saved:
+
+
+ <% account.errors.each do |error| %>
+ <%= error.full_message %>
+ <% end %>
+
+
+ <% end %>
+
+
+
Name
+
+ <%= form.text_field :name , { class: "input"} %>
+
+
+
+
+
+
Login
+
+ <%= form.text_field :login , { class: "input"} %>
+
+
+
+
+
Password
+
+ <%= form.text_field :password , { class: "input"} %>
+
+
+
+
+
+
+
+ Submit
+ <%= link_to "Return", "/accounts", class: "button is-success" %>
+
+<% end %>
+
+<%= button_to "Destroy", @account, method: :delete, class: "button is-danger" %>
\ No newline at end of file
diff --git a/src/autogen/app/views/accounts/edit.html.erb b/src/autogen/app/views/accounts/edit.html.erb
new file mode 100644
index 0000000..a672ba7
--- /dev/null
+++ b/src/autogen/app/views/accounts/edit.html.erb
@@ -0,0 +1,3 @@
+Editing Account: <%= @account.name %>
+
+<%= render "form", account: @account %>
diff --git a/src/autogen/app/views/accounts/index.html.erb b/src/autogen/app/views/accounts/index.html.erb
new file mode 100644
index 0000000..3946770
--- /dev/null
+++ b/src/autogen/app/views/accounts/index.html.erb
@@ -0,0 +1,23 @@
+<%= notice %>
+
+
+
+Accounts
+<%= button_to "New Account", new_account_path, method: :get, class: "button is-small is-primary" %>
+
+
+
+
+ Login
+
+
+
+
+ <% @accounts.each do |account| %>
+ <%= render :partial => 'account_raw', :locals => { :account => account} %>
+ <% end %>
+
+
+
+
+
diff --git a/src/autogen/app/views/accounts/index.json.jbuilder b/src/autogen/app/views/accounts/index.json.jbuilder
new file mode 100644
index 0000000..e41369e
--- /dev/null
+++ b/src/autogen/app/views/accounts/index.json.jbuilder
@@ -0,0 +1 @@
+json.array! @accounts, partial: "accounts/account", as: :account
diff --git a/src/autogen/app/views/accounts/new.html.erb b/src/autogen/app/views/accounts/new.html.erb
new file mode 100644
index 0000000..62e862a
--- /dev/null
+++ b/src/autogen/app/views/accounts/new.html.erb
@@ -0,0 +1,9 @@
+New account
+
+<%= render "form", account: @account %>
+
+
+
+
+ <%= link_to "Back to accounts", accounts_path %>
+
diff --git a/src/autogen/app/views/accounts/show.html.erb b/src/autogen/app/views/accounts/show.html.erb
new file mode 100644
index 0000000..a1051f5
--- /dev/null
+++ b/src/autogen/app/views/accounts/show.html.erb
@@ -0,0 +1,10 @@
+<%= notice %>
+
+<%= render @account %>
+
+
+ <%= link_to "Edit this account", edit_account_path(@account) %> |
+ <%= link_to "Back to accounts", accounts_path %>
+
+ <%= button_to "Destroy", @account, method: :delete %>
+
diff --git a/src/autogen/app/views/accounts/show.json.jbuilder b/src/autogen/app/views/accounts/show.json.jbuilder
new file mode 100644
index 0000000..89a793f
--- /dev/null
+++ b/src/autogen/app/views/accounts/show.json.jbuilder
@@ -0,0 +1 @@
+json.partial! "accounts/account", account: @account
diff --git a/src/autogen/app/views/devise/registrations/edit.html.erb b/src/autogen/app/views/devise/registrations/edit.html.erb
index b82e336..669204f 100644
--- a/src/autogen/app/views/devise/registrations/edit.html.erb
+++ b/src/autogen/app/views/devise/registrations/edit.html.erb
@@ -1,43 +1,48 @@
-Edit <%= resource_name.to_s.humanize %>
+
+
+
+
Your profil
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
+ <%= render "devise/shared/error_messages", resource: resource %>
-<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
- <%= render "devise/shared/error_messages", resource: resource %>
+
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", class: "input is-small" , placeholder: :email %>
+
-
- <%= f.label :email %>
- <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
+ <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
+
Currently waiting confirmation for: <%= resource.unconfirmed_email %>
+ <% end %>
+
+
+ <%= f.label :password %> (leave blank if you don't want to change it)
+ <%= f.password_field :password, autocomplete: "new-password",class: "input is-small" , placeholder: "New password" %>
+ <% if @minimum_password_length %>
+
+ <%= @minimum_password_length %> characters minimum
+ <% end %>
+
+
+
+ <%= f.label :password_confirmation %>
+ <%= f.password_field :password_confirmation, autocomplete: "new-password", class: "input is-small" , placeholder: "New password confirmation" %>
+
+
+
+ <%= f.label :current_password %> (we need your current password to confirm your changes)
+ <%= f.password_field :current_password, autocomplete: "current-password", class: "input is-small" , placeholder: "Current password" %>
+
+
+
+ <%= f.submit "Update",class:"button is-success" %>
+
+ <% end %>
+
+
Cancel my account
+
+
Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?", turbo_confirm: "Are you sure?" }, method: :delete , class:"button is-danger"%>
+
+ <%= link_to "Back", :back %>
+
-
- <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
-
Currently waiting confirmation for: <%= resource.unconfirmed_email %>
- <% end %>
-
-
- <%= f.label :password %> (leave blank if you don't want to change it)
- <%= f.password_field :password, autocomplete: "new-password" %>
- <% if @minimum_password_length %>
-
- <%= @minimum_password_length %> characters minimum
- <% end %>
-
-
-
- <%= f.label :password_confirmation %>
- <%= f.password_field :password_confirmation, autocomplete: "new-password" %>
-
-
-
- <%= f.label :current_password %> (we need your current password to confirm your changes)
- <%= f.password_field :current_password, autocomplete: "current-password" %>
-
-
-
- <%= f.submit "Update" %>
-
-<% end %>
-
-
Cancel my account
-
-
Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?", turbo_confirm: "Are you sure?" }, method: :delete %>
-
-<%= link_to "Back", :back %>
+
\ 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
new file mode 100644
index 0000000..67aca7b
--- /dev/null
+++ b/src/autogen/app/views/hosts/_form.html.erb
@@ -0,0 +1,170 @@
+<%# _form.html.erb %>
+
+
+
+ <%= form_with(model: host) do |form| %>
+ <% 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 %>
+
+
+ UUID
+
+
+
+
+ <%= form.text_field :uuid , { class: "input"} %>
+
+
+
+
+
+
+
+ Hostname
+
+
+
+
+ <%= form.text_field :hostname , { class: "input"} %>
+
+
+
+
+
+
+
+ ip
+
+
+
+
+ <%= form.text_field :ip , { class: "input"} %>
+
+
+
+
+
+
+
+ Installing IP
+
+
+
+
+ <%= form.text_field :installip , { class: "input"} %>
+
+
+
+
+
+
+
+ Status
+
+
+
+
+ <%= form.text_field :status , { class: "input"} %>
+
+
+
+
+
+
+
+ MAC Address
+
+
+
+
+ <%= form.text_field :mac , { class: "input"} %>
+
+
+
+
+
+
+
+ Interface
+
+
+
+
+ <%= form.text_field :interface , { class: "input"} %>
+
+
+
+
+
+
+
+ Template
+
+
+
+
+ <%= collection_select(:host, :installtemplate_id, Installtemplate.all, :_id, :name) %>
+
+
+
+
+
+
+
+ Site
+
+
+
+
+ <%= collection_select(:host, :site_id, Site.all, :_id, :name) %>
+
+
+
+
+
+
+
+ <%= form.label :rootaccount, class: "label is-small" %>
+
+ <%= form.collection_select :rootaccount_id, Account.all, :id, :name %>
+
+
+
+
+ <%= form.label :mainaccount, class: "label is-small" %>
+
+ <%= form.collection_select :mainaccount_id, Account.all, :id, :name %>
+
+
+
+
+ <%= form.label :discover, class: "checkbox" %>
+ <%= form.check_box :discover %>
+
+
+ <%= form.label :installed, class: "checkbox" %>
+ <%= form.check_box :installed %>
+
+
+ <%= form.label :toinstall, class: "checkbox" %>
+ <%= form.check_box :toinstall %>
+
+
+
+ Submit
+ <%= link_to "Return", "/hosts", class: "button is-success" %>
+ <%= button_to "Destroy", @host, method: :delete, class: "button is-danger is-pulled-right" %>
+
+ <% end %>
+
+
+
diff --git a/src/autogen/app/views/hosts/_host.html.erb b/src/autogen/app/views/hosts/_host.html.erb
new file mode 100644
index 0000000..2d9b52d
--- /dev/null
+++ b/src/autogen/app/views/hosts/_host.html.erb
@@ -0,0 +1,69 @@
+
+
+
+
+
+ Ip:
+ <%= host.ip %>
+
+
+
+ Status:
+ <%= host.status %>
+
+
+
+ Mac:
+ <%= host.mac %>
+
+
+
+ Discover:
+ <%= host.discover %>
+
+
+
+ Installed:
+ <%= host.installed %>
+
+
+
+ Interface:
+ <%= host.interface %>
+
+
+ Install Template:
+ <% if defined?host.installtemplate.name %>
+ <%= host.installtemplate.name %>
+ <% else %>
+ not set
+ <% end %>
+
+
+
+ Site:
+ <% if defined?host.site.name %>
+ <%= host.site.name %>
+ <% else %>
+ not set
+ <% end %>
+
+
+
+
+ <%= link_to "Edit this host", edit_host_path(host) %>
+
+
+
+
+
+
diff --git a/src/autogen/app/views/hosts/_host.json.jbuilder b/src/autogen/app/views/hosts/_host.json.jbuilder
new file mode 100644
index 0000000..ac01c97
--- /dev/null
+++ b/src/autogen/app/views/hosts/_host.json.jbuilder
@@ -0,0 +1,2 @@
+json.extract! host, :id, :uuid, :hostname, :ip, :status, :mac, :discover, :installed, :interface, :installtemplate, :site, :created_at, :updated_at
+json.url host_url(host, format: :json)
diff --git a/src/autogen/app/views/hosts/_hostraw.html.erb b/src/autogen/app/views/hosts/_hostraw.html.erb
new file mode 100644
index 0000000..68166f9
--- /dev/null
+++ b/src/autogen/app/views/hosts/_hostraw.html.erb
@@ -0,0 +1,9 @@
+
+ <%= host.hostname %>
+ <%= host.status %>
+ <%= host.installtemplate.name %>
+ <%= button_to "Edit", edit_host_path(host), method: :get, class: "button is-small is-primary" %>
+ class="getIpxeScript button is-small is-primary">IPXE
+ class="getInstallScript button is-small is-primary">Install
+ class="getPostinstallScript button is-small is-primary">Postinstall
+
diff --git a/src/autogen/app/views/hosts/edit.html.erb b/src/autogen/app/views/hosts/edit.html.erb
new file mode 100644
index 0000000..9ed65cb
--- /dev/null
+++ b/src/autogen/app/views/hosts/edit.html.erb
@@ -0,0 +1,6 @@
+
Editing Host: <%= @host.hostname %>
+
+<%= render "form", host: @host %>
+
+
+
diff --git a/src/autogen/app/views/hosts/index.html.erb b/src/autogen/app/views/hosts/index.html.erb
new file mode 100644
index 0000000..c0d044f
--- /dev/null
+++ b/src/autogen/app/views/hosts/index.html.erb
@@ -0,0 +1,27 @@
+
+
Hosts
+<%= button_to "New Host", new_host_path, method: :get, class: "button is-small is-primary" %>
+
+
+
+
+ Hostname
+ Status
+ Template
+
+
+
+
+ <% @hosts.each do |host| %>
+ <%= render :partial => 'hostraw', :locals => { :host => host} %>
+ <% end %>
+
+
+
+
+
+
diff --git a/src/autogen/app/views/hosts/index.json.jbuilder b/src/autogen/app/views/hosts/index.json.jbuilder
new file mode 100644
index 0000000..1f8c29a
--- /dev/null
+++ b/src/autogen/app/views/hosts/index.json.jbuilder
@@ -0,0 +1 @@
+json.array! @hosts, partial: "hosts/host", as: :host
diff --git a/src/autogen/app/views/hosts/new.html.erb b/src/autogen/app/views/hosts/new.html.erb
new file mode 100644
index 0000000..96784bc
--- /dev/null
+++ b/src/autogen/app/views/hosts/new.html.erb
@@ -0,0 +1,9 @@
+
New host
+
+<%= render "form", host: @host %>
+
+
+
+
+ <%= link_to "Back to hosts", hosts_path %>
+
diff --git a/src/autogen/app/views/hosts/show.html.erb b/src/autogen/app/views/hosts/show.html.erb
new file mode 100644
index 0000000..0cb1e3f
--- /dev/null
+++ b/src/autogen/app/views/hosts/show.html.erb
@@ -0,0 +1,12 @@
+
+
+<%= render @host %>
+
+
+
+ <%= link_to "Back to hosts", hosts_path %>
+
+
+
diff --git a/src/autogen/app/views/hosts/show.json.jbuilder b/src/autogen/app/views/hosts/show.json.jbuilder
new file mode 100644
index 0000000..ce1aca0
--- /dev/null
+++ b/src/autogen/app/views/hosts/show.json.jbuilder
@@ -0,0 +1 @@
+json.partial! "hosts/host", host: @host
diff --git a/src/autogen/app/views/installtemplates/_form.html.erb b/src/autogen/app/views/installtemplates/_form.html.erb
new file mode 100644
index 0000000..fd5d876
--- /dev/null
+++ b/src/autogen/app/views/installtemplates/_form.html.erb
@@ -0,0 +1,112 @@
+
+<%= form_with(model: installtemplate) do |form| %>
+ <% if installtemplate.errors.any? %>
+
+
<%= pluralize(installtemplate.errors.count, "error") %> prohibited this installtemplate from being saved:
+
+
+ <% installtemplate.errors.each do |error| %>
+ <%= error.full_message %>
+ <% end %>
+
+
+ <% end %>
+
+
+
+ <%= form.label :name, class: "label" %>
+
+ <%= form.text_field :name , { class: "input"} %>
+
+
+
+
+
+ <%= form.label :ostype, class: "label" %>
+
+ <%= form.text_field :ostype , { class: "input"} %>
+
+
+
+
+ <%= form.label :osversion, class: "label" %>
+
+ <%= form.text_field :osversion , { class: "input"} %>
+
+
+
+
+
+ <%= form.label :repository, class: "label" %>
+
+ <%= form.text_field :repository , { class: "input"} %>
+
+
+
+
+ <%= form.label :nfsroot, class: "label" %>
+
+ <%= form.text_field :nfsroot , { class: "input"} %>
+
+
+
+
+ <%= form.label :kernel, class: "label" %>
+
+ <%= form.text_field :kernel , { class: "input"} %>
+
+
+
+
+ <%= form.label :initrd, class: "label" %>
+
+ <%= form.text_field :initrd , { class: "input"} %>
+
+
+
+
+
+ <%= form.label :rootfile, class: "label" %>
+
+ <%= form.text_field :rootfile , { class: "input"} %>
+
+
+
+
+
+ <%= form.label :boot, class: "label" %>
+
+ <%= form.collection_select :boot_id, Script.where(stage:"boot"), :id, :name %>
+
+
+
+
+ <%= form.label :install, class: "label" %>
+
+ <%= form.collection_select :install_id, Script.where(stage:"install"), :id, :name %>
+
+
+
+
+ <%= form.label :postinstall, class: "label" %>
+
+ <%= form.collection_select :postinstall_id, Script.where(stage:"postinstall"), :id, :name %>
+
+
+
+
+
+ <%= form.label :lang, class: "label" %>
+
+ <%= form.text_field :lang , { class: "input"} %>
+
+
+
+
+ Submit
+ <%= link_to "Return", "/installtemplates", class: "button is-success" %>
+
+
+<% end %>
+<%= button_to " Destroy ", @installtemplate, method: :delete, class: "button is-danger" %>
+
diff --git a/src/autogen/app/views/installtemplates/_installtemplate.html.erb b/src/autogen/app/views/installtemplates/_installtemplate.html.erb
new file mode 100644
index 0000000..ba1917f
--- /dev/null
+++ b/src/autogen/app/views/installtemplates/_installtemplate.html.erb
@@ -0,0 +1,69 @@
+
+
+ Name:
+ <%= installtemplate.name %>
+
+
+
+ Ostype:
+ <%= installtemplate.ostype %>
+
+
+
+ Osversion:
+ <%= installtemplate.osversion %>
+
+
+
+ Repository:
+ <%= installtemplate.repository %>
+
+
+
+ Nfsroot:
+ <%= installtemplate.nfsroot %>
+
+
+
+ Kernel:
+ <%= installtemplate.kernel %>
+
+
+
+ Initrd:
+ <%= installtemplate.initrd %>
+
+
+
+ Rootfile:
+ <%= installtemplate.rootfile %>
+
+
+
+ Boot Script
+ <% if defined?installtemplate.boot.name %>
+ <%= installtemplate.boot.name %>
+ <% else %>
+ not set
+ <% end %>
+
+
+
+
+ Install
+ <% if defined?installtemplate.install.name %>
+ <%= installtemplate.install.name %>
+ <% else %>
+ not set
+ <% end %>
+
+
+
+ PostInstall
+ <% if defined?installtemplate.boot.name %>
+ <%= installtemplate.boot.name %>
+ <% else %>
+ not set
+ <% end %>
+
+
diff --git a/src/autogen/app/views/installtemplates/_installtemplate.json.jbuilder b/src/autogen/app/views/installtemplates/_installtemplate.json.jbuilder
new file mode 100644
index 0000000..74f0386
--- /dev/null
+++ b/src/autogen/app/views/installtemplates/_installtemplate.json.jbuilder
@@ -0,0 +1,2 @@
+json.extract! installtemplate, :id, :name, :ostype, :osversion, :repository, :nfsroot, :kernel, :initrd, :rootfile, :boot, :install, :postinstall :created_at, :updated_at
+json.url installtemplate_url(installtemplate, format: :json)
diff --git a/src/autogen/app/views/installtemplates/_templateraw.html.erb b/src/autogen/app/views/installtemplates/_templateraw.html.erb
new file mode 100644
index 0000000..266810f
--- /dev/null
+++ b/src/autogen/app/views/installtemplates/_templateraw.html.erb
@@ -0,0 +1,4 @@
+
+<%= installtemplate.name %>
+ <%= button_to "Edit", edit_installtemplate_path(installtemplate), method: :get, class: "button is-small is-primary" %>
+
diff --git a/src/autogen/app/views/installtemplates/edit.html.erb b/src/autogen/app/views/installtemplates/edit.html.erb
new file mode 100644
index 0000000..fe10a34
--- /dev/null
+++ b/src/autogen/app/views/installtemplates/edit.html.erb
@@ -0,0 +1,10 @@
+
Editing <%= @installtemplate.name %>
+
+<%= render "form", installtemplate: @installtemplate %>
+
+
+
+
+ <%= link_to "Show", @installtemplate %> |
+ <%= link_to "Back", installtemplates_path %>
+
diff --git a/src/autogen/app/views/installtemplates/index.html.erb b/src/autogen/app/views/installtemplates/index.html.erb
new file mode 100644
index 0000000..fe952c4
--- /dev/null
+++ b/src/autogen/app/views/installtemplates/index.html.erb
@@ -0,0 +1,21 @@
+
<%= notice %>
+
+
Templates
+<%= button_to "New Template", new_installtemplate_path, method: :get, class: "button is-small is-primary" %>
+
+
+
+
+ Name
+
+
+
+
+ <% @installtemplates.each do |installtemplate| %>
+ <%= render :partial => 'templateraw', :locals => { :installtemplate => installtemplate} %>
+ <% end %>
+
+
+
+
+
diff --git a/src/autogen/app/views/installtemplates/index.json.jbuilder b/src/autogen/app/views/installtemplates/index.json.jbuilder
new file mode 100644
index 0000000..c4034c9
--- /dev/null
+++ b/src/autogen/app/views/installtemplates/index.json.jbuilder
@@ -0,0 +1 @@
+json.array! @installtemplates, partial: "installtemplates/installtemplate", as: :installtemplate
diff --git a/src/autogen/app/views/installtemplates/new.html.erb b/src/autogen/app/views/installtemplates/new.html.erb
new file mode 100644
index 0000000..b38542a
--- /dev/null
+++ b/src/autogen/app/views/installtemplates/new.html.erb
@@ -0,0 +1,9 @@
+
New installtemplate
+
+<%= render "form", installtemplate: @installtemplate %>
+
+
+
+
+ <%= link_to "Back to installtemplates", installtemplates_path %>
+
diff --git a/src/autogen/app/views/installtemplates/show.html.erb b/src/autogen/app/views/installtemplates/show.html.erb
new file mode 100644
index 0000000..ae9e8a9
--- /dev/null
+++ b/src/autogen/app/views/installtemplates/show.html.erb
@@ -0,0 +1,10 @@
+
<%= notice %>
+
+<%= render @installtemplate %>
+
+
+ <%= link_to "Edit this installtemplate", edit_installtemplate_path(@installtemplate) %> |
+ <%= link_to "Back to installtemplates", installtemplates_path %>
+
+ <%= button_to "Destroy this installtemplate", @installtemplate, method: :delete %>
+
diff --git a/src/autogen/app/views/installtemplates/show.json.jbuilder b/src/autogen/app/views/installtemplates/show.json.jbuilder
new file mode 100644
index 0000000..c0e6fba
--- /dev/null
+++ b/src/autogen/app/views/installtemplates/show.json.jbuilder
@@ -0,0 +1 @@
+json.partial! "installtemplates/installtemplate", installtemplate: @installtemplate
diff --git a/src/autogen/app/views/layouts/application.html.erb b/src/autogen/app/views/layouts/application.html.erb
index 728d0b1..0f37fd1 100644
--- a/src/autogen/app/views/layouts/application.html.erb
+++ b/src/autogen/app/views/layouts/application.html.erb
@@ -1,3 +1,4 @@
+
@@ -14,14 +15,14 @@
<%= render "partials/top-menu" %>
-
-
+
+
<%= render "partials/left-menu" %>
-
-
-
<%= notice %>
-
<%= alert %>
-
+
+
+
<%= notice %>
+
<%= alert %>
+
<%= yield %>
@@ -30,3 +31,5 @@
<%= javascript_include_tag "init" %>
+
+
diff --git a/src/autogen/app/views/logs/_log_raw.html.erb b/src/autogen/app/views/logs/_log_raw.html.erb
new file mode 100644
index 0000000..044a827
--- /dev/null
+++ b/src/autogen/app/views/logs/_log_raw.html.erb
@@ -0,0 +1,6 @@
+
+<%= log.created_at %>
+<%= log.source %>
+<%= log.crit %>
+<%= log.message %>
+
diff --git a/src/autogen/app/views/logs/index.html.erb b/src/autogen/app/views/logs/index.html.erb
new file mode 100644
index 0000000..67cf982
--- /dev/null
+++ b/src/autogen/app/views/logs/index.html.erb
@@ -0,0 +1,22 @@
+
<%= notice %>
+
+
+
+
diff --git a/src/autogen/app/views/logs/index.json.jbuilder b/src/autogen/app/views/logs/index.json.jbuilder
new file mode 100644
index 0000000..9254038
--- /dev/null
+++ b/src/autogen/app/views/logs/index.json.jbuilder
@@ -0,0 +1 @@
+json.array! @logs, partial: "logs/log", as: :log
diff --git a/src/autogen/app/views/home/index.html.erb b/src/autogen/app/views/pages/index.html.erb
similarity index 65%
rename from src/autogen/app/views/home/index.html.erb
rename to src/autogen/app/views/pages/index.html.erb
index 3998b38..88279b0 100644
--- a/src/autogen/app/views/home/index.html.erb
+++ b/src/autogen/app/views/pages/index.html.erb
@@ -3,5 +3,5 @@
Home#index
-
Find me in app/views/home/index.html.erb
+
Find me in app/views/pages/index.html.erb
\ No newline at end of file
diff --git a/src/autogen/app/views/partials/_left-menu.html.erb b/src/autogen/app/views/partials/_left-menu.html.erb
index 53c7b54..9e5c887 100644
--- a/src/autogen/app/views/partials/_left-menu.html.erb
+++ b/src/autogen/app/views/partials/_left-menu.html.erb
@@ -1,40 +1,32 @@
-
\ No newline at end of file
diff --git a/src/autogen/app/views/partials/_top-menu.html.erb b/src/autogen/app/views/partials/_top-menu.html.erb
index 080e8ca..c7e877a 100644
--- a/src/autogen/app/views/partials/_top-menu.html.erb
+++ b/src/autogen/app/views/partials/_top-menu.html.erb
@@ -48,9 +48,9 @@
<% if !user_signed_in? %>
- <%= link_to "Sign up", new_registration_path(resource_name) , class: "button is-light"%>
<%= link_to "Login", new_user_session_path, class: "button is-light" %>
<% else %>
+ <%= 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 %>
diff --git a/src/autogen/app/views/scripts/_form.html.erb b/src/autogen/app/views/scripts/_form.html.erb
index c5cfa20..5163528 100644
--- a/src/autogen/app/views/scripts/_form.html.erb
+++ b/src/autogen/app/views/scripts/_form.html.erb
@@ -1,3 +1,4 @@
+
<%= form_with(model: script) do |form| %>
<% if script.errors.any? %>
@@ -11,37 +12,58 @@
<% end %>
-
- <%= form.label :name, style: "display: block" %>
- <%= form.text_field :name %>
+
+
Name
+
+ <%= form.text_field :name , { class: "input"} %>
+
-
- <%= form.label :stage, style: "display: block" %>
- <%= form.text_field :stage %>
+
+
+
Stage
+
+ <%= form.text_field :stage , { class: "input"} %>
+
+
+
+
+
Lang
+
+ <%= form.text_field :lang , { class: "input"} %>
+
+
+
+
-
- <%= form.label :lang, style: "display: block" %>
- <%= form.text_field :lang %>
+
+
+
+ <% if script.lock %>
+
+ <% else %>
+
+ <% end %>
+ Lock
+
+
+
+
-
- <%= form.label :content, style: "display: block" %>
- <%= form.text_area :content %>
-
-
-
- <%= form.label :lock, style: "display: block" %>
- <%= form.check_box :lock %>
-
-
-
- <%= form.label :description, style: "display: block" %>
- <%= form.text_area :description %>
-
-
-
- <%= form.submit %>
+
+ Submit
+ <%= 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
diff --git a/src/autogen/app/views/scripts/_script_raw.html.erb b/src/autogen/app/views/scripts/_script_raw.html.erb
new file mode 100644
index 0000000..ed33169
--- /dev/null
+++ b/src/autogen/app/views/scripts/_script_raw.html.erb
@@ -0,0 +1,7 @@
+
+ <%= script.name %>
+ <%= script.stage %>
+ <%= script.lang %>
+ <%= button_to "Edit", edit_script_path(script), method: :get, class: "button is-small is-primary" %>
+
+
diff --git a/src/autogen/app/views/scripts/edit.html.erb b/src/autogen/app/views/scripts/edit.html.erb
index 8295999..53fb977 100644
--- a/src/autogen/app/views/scripts/edit.html.erb
+++ b/src/autogen/app/views/scripts/edit.html.erb
@@ -1,10 +1,3 @@
-
Editing script
+
Editing Script: <%= @script.name %>
<%= render "form", script: @script %>
-
-
-
-
- <%= link_to "Show this script", @script %> |
- <%= link_to "Back to scripts", scripts_path %>
-
diff --git a/src/autogen/app/views/scripts/index.html.erb b/src/autogen/app/views/scripts/index.html.erb
index 5490a24..f6b1243 100644
--- a/src/autogen/app/views/scripts/index.html.erb
+++ b/src/autogen/app/views/scripts/index.html.erb
@@ -1,14 +1,23 @@
<%= notice %>
-
Scripts
-
-
- <% @scripts.each do |script| %>
- <%= render script %>
-
- <%= link_to "Show this script", script %>
-
- <% end %>
+
Scripts
+<%= button_to "New Script", new_script_path, method: :get, class: "button is-small is-primary" %>
+
+
+
+
+ Name
+ Stage
+ Lang
+
+
+
+
+ <% @scripts.each do |script| %>
+ <%= render :partial => 'script_raw', :locals => { :script => script} %>
+ <% end %>
+
+
-<%= link_to "New script", new_script_path %>
+
diff --git a/src/autogen/app/views/sites/_form.html.erb b/src/autogen/app/views/sites/_form.html.erb
new file mode 100644
index 0000000..f760bc0
--- /dev/null
+++ b/src/autogen/app/views/sites/_form.html.erb
@@ -0,0 +1,117 @@
+<%= form_with(model: site) do |form| %>
+
+
Name
+
+ <%= form.text_field :name , { class: "input"} %>
+
+
+
+
+
Domain
+
+ <%= form.text_field :domain , { class: "input"} %>
+
+
+
+
+
Gateway
+
+ <%= form.text_field :gateway , { class: "input"} %>
+
+
+
+
+
Nameserver
+
+ <%= form.text_field :nameserver , { class: "input"} %>
+
+
+
+
+
+
Network
+
+ <%= form.text_field :network , { class: "input"} %>
+
+
+
+
Netmask
+
+ <%= form.text_field :netmask , { class: "input"} %>
+
+
+
+
+
+ <%= form.label :apiurl, class: "label" %>
+
+ <%= form.text_field :apiurl , { class: "input"} %>
+
+
+
+
+
+
+
Serveur IP
+
+ <%= form.text_field :server_ip , { class: "input"} %>
+
+
+
+
+
Serveur Port
+
+ <%= form.text_field :server_port , { class: "input"} %>
+
+
+
+
+
+
+
File Server Ip
+
+ <%= form.text_field :fileserver_ip , { class: "input"} %>
+
+
+
+
+
File Server Port
+
+ <%= form.text_field :fileserver_port , { class: "input"} %>
+
+
+
+
+
File Server Basepath
+
+ <%= form.text_field :fileserver_basepath , { class: "input"} %>
+
+
+
+
+
+ <%= form.label :cfenginehub, class: "label" %>
+
+ <%= form.text_field :cfenginehub , { class: "input"} %>
+
+
+ <% if not @site.cfenginehub.empty? -%>
+ <%= link_to "Goto cfengine hub", "http://#{@site.cfenginehub}", class: "button is-info", :target => "_blank" %>
+ <% end -%>
+
+
+ <%= form.label :timezone, class: "label" %>
+
+ <%= form.text_field :timezone , { class: "input"} %>
+
+
+
+
+ Submit In
+ <%= link_to "Return to Site index", "/sites", class: "button is-success" %>
+
+<% end %>
+
+
+
+
diff --git a/src/autogen/app/views/sites/_site.html.erb b/src/autogen/app/views/sites/_site.html.erb
new file mode 100644
index 0000000..0fe43c8
--- /dev/null
+++ b/src/autogen/app/views/sites/_site.html.erb
@@ -0,0 +1,37 @@
+
+
+ Name:
+ <%= site.name %>
+
+
+
+ Domain:
+ <%= site.domain %>
+
+
+
+ Gateway:
+ <%= site.gateway %>
+
+
+
+ Nameserver:
+ <%= site.nameserver %>
+
+
+
+ Network:
+ <%= site.network %>
+
+
+
+ Netmask:
+ <%= site.netmask %>
+
+
+
+ Server:
+ <%= site.server_ip %>:<%= site.server_port %>:
+
+
+
diff --git a/src/autogen/app/views/sites/_site.json.jbuilder b/src/autogen/app/views/sites/_site.json.jbuilder
new file mode 100644
index 0000000..6cdf354
--- /dev/null
+++ b/src/autogen/app/views/sites/_site.json.jbuilder
@@ -0,0 +1,2 @@
+json.extract! site, :id, :name, :domain, :gateway, :nameserver, :network, :netmask, :created_at, :updated_at
+json.url site_url(site, format: :json)
diff --git a/src/autogen/app/views/sites/_siteraw.html.erb b/src/autogen/app/views/sites/_siteraw.html.erb
new file mode 100644
index 0000000..e1b5aeb
--- /dev/null
+++ b/src/autogen/app/views/sites/_siteraw.html.erb
@@ -0,0 +1,5 @@
+
+<%= site.name %>
+<%= site.description %>
+ <%= button_to "Edit", edit_site_path(site), method: :get, class: "button is-small is-primary" %>
+
diff --git a/src/autogen/app/views/sites/_sites_table.html.erb b/src/autogen/app/views/sites/_sites_table.html.erb
new file mode 100644
index 0000000..097b5f1
--- /dev/null
+++ b/src/autogen/app/views/sites/_sites_table.html.erb
@@ -0,0 +1,24 @@
+<%= hidden_field_tag :direction, params[:direction] %>
+<%= hidden_field_tag :sort, params[:sort] %>
+
+
+
+
+ Nom
+
+
+
+
+ <% @sites.each do |site| %>
+
+
+ <%= link_to site.name, edit_site_path(site), :remote => true %>
+
+
+ <%= site.description %>
+
+
+ <% end %>
+
+
+
\ No newline at end of file
diff --git a/src/autogen/app/views/sites/edit.html.erb b/src/autogen/app/views/sites/edit.html.erb
new file mode 100644
index 0000000..66fb4f3
--- /dev/null
+++ b/src/autogen/app/views/sites/edit.html.erb
@@ -0,0 +1,4 @@
+
Editing Site: <%= @site.name %>
+<%= render "form", site: @site %>
+
+
diff --git a/src/autogen/app/views/sites/index.html.erb b/src/autogen/app/views/sites/index.html.erb
new file mode 100644
index 0000000..54132bc
--- /dev/null
+++ b/src/autogen/app/views/sites/index.html.erb
@@ -0,0 +1,22 @@
+
<%= notice %>
+
+
Sites
+<%= button_to "New Site", new_site_path, method: :get, class: "button is-small is-primary" %>
+
+
+
+
+ Site Name
+
+
+
+
+ <% @sites.each do |site| %>
+ <%= render :partial => 'siteraw', :locals => { :site => site} %>
+ <% end %>
+
+
+
+
+
+
diff --git a/src/autogen/app/views/sites/index.json.jbuilder b/src/autogen/app/views/sites/index.json.jbuilder
new file mode 100644
index 0000000..946f00a
--- /dev/null
+++ b/src/autogen/app/views/sites/index.json.jbuilder
@@ -0,0 +1 @@
+json.array! @sites, partial: "sites/site", as: :site
diff --git a/src/autogen/app/views/sites/new.html.erb b/src/autogen/app/views/sites/new.html.erb
new file mode 100644
index 0000000..3da6c1e
--- /dev/null
+++ b/src/autogen/app/views/sites/new.html.erb
@@ -0,0 +1,9 @@
+
New site
+
+<%= render "form", site: @site %>
+
+
+
+
+ <%= link_to "Back to sites", sites_path %>
+
diff --git a/src/autogen/app/views/sites/show.html.erb b/src/autogen/app/views/sites/show.html.erb
new file mode 100644
index 0000000..8f0234d
--- /dev/null
+++ b/src/autogen/app/views/sites/show.html.erb
@@ -0,0 +1,10 @@
+
<%= notice %>
+
+<%= render @site %>
+
+
+ <%= link_to "Edit this site", edit_site_path(@site) %> |
+ <%= link_to "Back to sites", sites_path %>
+
+ <%= button_to "Destroy this site", @site, method: :delete %>
+
diff --git a/src/autogen/app/views/sites/show.json.jbuilder b/src/autogen/app/views/sites/show.json.jbuilder
new file mode 100644
index 0000000..a546c42
--- /dev/null
+++ b/src/autogen/app/views/sites/show.json.jbuilder
@@ -0,0 +1 @@
+json.partial! "sites/site", site: @site
diff --git a/src/autogen/config/routes.rb b/src/autogen/config/routes.rb
index f61ff4f..cb934ca 100644
--- a/src/autogen/config/routes.rb
+++ b/src/autogen/config/routes.rb
@@ -1,7 +1,13 @@
Rails.application.routes.draw do
devise_for :users
resources :scripts
- root 'home#index'
+ resources :sites
+ resources :accounts
+ resources :installtemplates
+ resources :hosts
+ resources :logs
+
+ root 'pages#index'
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
@@ -10,4 +16,23 @@ Rails.application.routes.draw do
# Defines the root path route ("/")
# root "posts#index"
+
+ # Webui call
+ get '/host/ipxe', to: "hosts#generate_boot"
+ get '/host/install', to: "hosts#generate_install"
+ get '/host/postinstall', to: "hosts#generate_postinstall"
+
+
+ # Machine Call
+ get '/api/host/ipxe', to: "engine#generate_boot"
+ get '/api/host/install', to: "engine#generate_install"
+ get '/api/host/postinstall', to: "engine#generate_postinstall"
+ get '/api/host/installed', to: "engine#generate_installed", defaults: { format: 'text' }
+ get '/engine/global', to: "engine#generateglobal", defaults: { format: 'text' }
+ get '/api/host/cloudinit/:uuid/user-data', to: "engine#generate_install", defaults: { format: 'text' }
+ get '/api/host/cloudinit/:uuid/meta-data', to: "engine#generate_metadata", defaults: { format: 'text' }
+ get '/api/host/cloudinit/:uuid/vendor-data', to: "engine#generate_metadata", defaults: { format: 'text' }
+
+
+
end