Uniq Identifier Refered by @host.uuid in script
-diff --git a/src/autogen/.ruby-version b/src/autogen/.ruby-version index 03463f3..4a85a55 100644 --- a/src/autogen/.ruby-version +++ b/src/autogen/.ruby-version @@ -1 +1 @@ -ruby-3.3.0 +ruby-3.3.1 diff --git a/src/autogen/Dockerfile b/src/autogen/Dockerfile index b537a1e..e76d0e0 100644 --- a/src/autogen/Dockerfile +++ b/src/autogen/Dockerfile @@ -1,7 +1,7 @@ # syntax = docker/dockerfile:1 # Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile -ARG RUBY_VERSION=3.3.0 +ARG RUBY_VERSION=3.3.1 FROM registry.docker.com/library/ruby:$RUBY_VERSION-slim as base # Rails app lives here @@ -22,8 +22,8 @@ RUN apt-get update -qq && \ apt-get install --no-install-recommends -y build-essential curl git node-gyp pkg-config python-is-python3 # Install JavaScript dependencies -ARG NODE_VERSION=21.6.1 -ARG YARN_VERSION=1.22.21 +ARG NODE_VERSION=22.0.0 +ARG YARN_VERSION=1.22.22 ENV PATH=/usr/local/node/bin:$PATH RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \ /tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \ @@ -36,9 +36,7 @@ RUN bundle install && \ rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \ bundle exec bootsnap precompile --gemfile -# Install node modules -COPY package.json yarn.lock ./ -RUN yarn install --frozen-lockfile + # Copy application code COPY . . @@ -46,8 +44,6 @@ COPY . . # Precompile bootsnap code for faster boot times RUN bundle exec bootsnap precompile app/ lib/ -# Precompiling assets for production without requiring secret RAILS_MASTER_KEY -RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile # Final stage for app image @@ -72,4 +68,4 @@ ENTRYPOINT ["/rails/bin/docker-entrypoint"] # Start the server by default, this can be overwritten at runtime EXPOSE 3000 -CMD ["./bin/rails", "server"] +CMD ["./bin/rails", "server" , "-b","0.0.0.0"] diff --git a/src/autogen/Gemfile.lock b/src/autogen/Gemfile.lock index f2d85a9..674aaf2 100644 --- a/src/autogen/Gemfile.lock +++ b/src/autogen/Gemfile.lock @@ -1,35 +1,35 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.1.3) - actionpack (= 7.1.3) - activesupport (= 7.1.3) + actioncable (7.1.3.2) + actionpack (= 7.1.3.2) + activesupport (= 7.1.3.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.3) - actionpack (= 7.1.3) - activejob (= 7.1.3) - activerecord (= 7.1.3) - activestorage (= 7.1.3) - activesupport (= 7.1.3) + actionmailbox (7.1.3.2) + actionpack (= 7.1.3.2) + activejob (= 7.1.3.2) + activerecord (= 7.1.3.2) + activestorage (= 7.1.3.2) + activesupport (= 7.1.3.2) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.1.3) - actionpack (= 7.1.3) - actionview (= 7.1.3) - activejob (= 7.1.3) - activesupport (= 7.1.3) + actionmailer (7.1.3.2) + actionpack (= 7.1.3.2) + actionview (= 7.1.3.2) + activejob (= 7.1.3.2) + activesupport (= 7.1.3.2) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.2) - actionpack (7.1.3) - actionview (= 7.1.3) - activesupport (= 7.1.3) + actionpack (7.1.3.2) + actionview (= 7.1.3.2) + activesupport (= 7.1.3.2) nokogiri (>= 1.8.5) racc rack (>= 2.2.4) @@ -37,35 +37,35 @@ GEM rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.3) - actionpack (= 7.1.3) - activerecord (= 7.1.3) - activestorage (= 7.1.3) - activesupport (= 7.1.3) + actiontext (7.1.3.2) + actionpack (= 7.1.3.2) + activerecord (= 7.1.3.2) + activestorage (= 7.1.3.2) + activesupport (= 7.1.3.2) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.3) - activesupport (= 7.1.3) + actionview (7.1.3.2) + activesupport (= 7.1.3.2) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.1.3) - activesupport (= 7.1.3) + activejob (7.1.3.2) + activesupport (= 7.1.3.2) globalid (>= 0.3.6) - activemodel (7.1.3) - activesupport (= 7.1.3) - activerecord (7.1.3) - activemodel (= 7.1.3) - activesupport (= 7.1.3) + activemodel (7.1.3.2) + activesupport (= 7.1.3.2) + activerecord (7.1.3.2) + activemodel (= 7.1.3.2) + activesupport (= 7.1.3.2) timeout (>= 0.4.0) - activestorage (7.1.3) - actionpack (= 7.1.3) - activejob (= 7.1.3) - activerecord (= 7.1.3) - activesupport (= 7.1.3) + activestorage (7.1.3.2) + actionpack (= 7.1.3.2) + activejob (= 7.1.3.2) + activerecord (= 7.1.3.2) + activesupport (= 7.1.3.2) marcel (~> 1.0) - activesupport (7.1.3) + activesupport (7.1.3.2) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) @@ -79,11 +79,11 @@ GEM public_suffix (>= 2.0.2, < 6.0) base64 (0.2.0) bcrypt (3.1.20) - bigdecimal (3.1.6) + bigdecimal (3.1.7) bindex (0.8.1) bootsnap (1.18.3) msgpack (~> 1.2) - bson (4.15.0) + bson (5.0.0) builder (3.2.4) bulma-rails (0.9.4) sassc (~> 2.0) @@ -102,32 +102,31 @@ GEM cssbundling-rails (1.4.0) railties (>= 6.0.0) date (3.3.4) - debug (1.9.1) + debug (1.9.2) irb (~> 1.10) reline (>= 0.3.8) - devise (4.9.3) + devise (4.9.4) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) responders warden (~> 1.2.3) - drb (2.2.0) - ruby2_keywords + drb (2.2.1) erubi (1.12.0) ffi (1.16.3) globalid (1.2.1) activesupport (>= 6.1) - i18n (1.14.1) + i18n (1.14.4) concurrent-ruby (~> 1.0) importmap-rails (2.0.1) actionpack (>= 6.0.0) activesupport (>= 6.0.0) railties (>= 6.0.0) io-console (0.7.2) - irb (1.11.2) - rdoc + irb (1.13.0) + rdoc (>= 4.0.0) reline (>= 0.4.2) - jbuilder (2.11.5) + jbuilder (2.12.0) actionview (>= 5.0.0) activesupport (>= 5.0.0) jquery-rails (4.6.0) @@ -142,13 +141,13 @@ GEM net-imap net-pop net-smtp - marcel (1.0.2) + marcel (1.0.4) matrix (0.4.2) mini_mime (1.1.5) - minitest (5.22.2) - mongo (2.19.3) - bson (>= 4.14.1, < 5.0.0) - mongoid (8.1.4) + minitest (5.22.3) + mongo (2.20.0) + bson (>= 4.14.1, < 6.0.0) + mongoid (8.1.5) activemodel (>= 5.1, < 7.2, != 7.0.0) concurrent-ruby (>= 1.0.5, < 2.0) mongo (>= 2.18.0, < 3.0.0) @@ -162,29 +161,29 @@ GEM net-protocol net-protocol (0.2.2) timeout - net-smtp (0.4.0.1) + net-smtp (0.5.0) net-protocol - nio4r (2.7.0) - nokogiri (1.16.2-aarch64-linux) + nio4r (2.7.1) + nokogiri (1.16.4-aarch64-linux) racc (~> 1.4) - nokogiri (1.16.2-arm-linux) + nokogiri (1.16.4-arm-linux) racc (~> 1.4) - nokogiri (1.16.2-arm64-darwin) + nokogiri (1.16.4-arm64-darwin) racc (~> 1.4) - nokogiri (1.16.2-x86-linux) + nokogiri (1.16.4-x86-linux) racc (~> 1.4) - nokogiri (1.16.2-x86_64-darwin) + nokogiri (1.16.4-x86_64-darwin) racc (~> 1.4) - nokogiri (1.16.2-x86_64-linux) + nokogiri (1.16.4-x86_64-linux) racc (~> 1.4) orm_adapter (0.5.0) psych (5.1.2) stringio - public_suffix (5.0.4) + public_suffix (5.0.5) puma (6.4.2) nio4r (~> 2.0) racc (1.7.3) - rack (3.0.9) + rack (3.0.10) rack-session (2.0.0) rack (>= 3.0.0) rack-test (2.1.0) @@ -192,20 +191,20 @@ GEM rackup (2.1.0) rack (>= 3) webrick (~> 1.8) - rails (7.1.3) - actioncable (= 7.1.3) - actionmailbox (= 7.1.3) - actionmailer (= 7.1.3) - actionpack (= 7.1.3) - actiontext (= 7.1.3) - actionview (= 7.1.3) - activejob (= 7.1.3) - activemodel (= 7.1.3) - activerecord (= 7.1.3) - activestorage (= 7.1.3) - activesupport (= 7.1.3) + rails (7.1.3.2) + actioncable (= 7.1.3.2) + actionmailbox (= 7.1.3.2) + actionmailer (= 7.1.3.2) + actionpack (= 7.1.3.2) + actiontext (= 7.1.3.2) + actionview (= 7.1.3.2) + activejob (= 7.1.3.2) + activemodel (= 7.1.3.2) + activerecord (= 7.1.3.2) + activestorage (= 7.1.3.2) + activesupport (= 7.1.3.2) bundler (>= 1.15.0) - railties (= 7.1.3) + railties (= 7.1.3.2) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -213,19 +212,19 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.1.3) - actionpack (= 7.1.3) - activesupport (= 7.1.3) + railties (7.1.3.2) + actionpack (= 7.1.3.2) + activesupport (= 7.1.3.2) irb rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) zeitwerk (~> 2.6) - rake (13.1.0) - rdoc (6.6.2) + rake (13.2.1) + rdoc (6.6.3.1) psych (>= 4.0.0) regexp_parser (2.9.0) - reline (0.4.2) + reline (0.5.4) io-console (~> 0.5) responders (3.1.1) actionpack (>= 5.2) @@ -236,7 +235,7 @@ GEM sassc (2.4.0) ffi (~> 1.9) securerandom (0.3.1) - selenium-webdriver (4.17.0) + selenium-webdriver (4.20.1) base64 (~> 0.2) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) @@ -251,9 +250,9 @@ GEM stimulus-rails (1.3.3) railties (>= 6.0.0) stringio (3.1.0) - thor (1.3.0) + thor (1.3.1) timeout (0.4.1) - turbo-rails (2.0.2) + turbo-rails (2.0.5) actionpack (>= 6.0.0) activejob (>= 6.0.0) railties (>= 6.0.0) @@ -308,4 +307,4 @@ RUBY VERSION ruby 3.3.0p0 BUNDLED WITH - 2.5.3 + 2.5.9 diff --git a/src/autogen/app/controllers/hosts_controller.rb b/src/autogen/app/controllers/hosts_controller.rb index 0adc4d3..be546a4 100644 --- a/src/autogen/app/controllers/hosts_controller.rb +++ b/src/autogen/app/controllers/hosts_controller.rb @@ -41,7 +41,7 @@ class HostsController < ApplicationController def update puts host_params respond_to do |format| - log=Log.new({source: "host", crit: "info",message: "User #{current_user.name}, 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." } @@ -56,7 +56,8 @@ class HostsController < ApplicationController # DELETE /hosts/1 or /hosts/1.json def destroy @host.destroy! - + log=Log.new({source: "Host", crit: "warning",message: "User #{current_user.name}, Delete #{host_params[:hostname]}"}) + log.save() respond_to do |format| format.html { redirect_to hosts_url, notice: "Host was successfully destroyed." } format.json { head :no_content } diff --git a/src/autogen/app/controllers/installtemplates_controller.rb b/src/autogen/app/controllers/installtemplates_controller.rb index 7179f5f..1f6e7c5 100644 --- a/src/autogen/app/controllers/installtemplates_controller.rb +++ b/src/autogen/app/controllers/installtemplates_controller.rb @@ -67,7 +67,7 @@ class InstalltemplatesController < ApplicationController # 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) + params.require(:installtemplate).permit(:name, :ostype, :osversion, :repository, :nfsroot, :kernel, :initrd, :rootfile, :boot_id, :install_id, :postinstall_id) end def check_group if current_user.group != "admin" diff --git a/src/autogen/app/controllers/scripts_controller.rb b/src/autogen/app/controllers/scripts_controller.rb index cb75424..cf37c85 100644 --- a/src/autogen/app/controllers/scripts_controller.rb +++ b/src/autogen/app/controllers/scripts_controller.rb @@ -56,7 +56,7 @@ 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=Log.new({source: "Script", crit: "warning",message: "User #{current_user.name}, Delete #{@script.stage} Script: #{@script.name}"}) log.save() respond_to do |format| format.html { redirect_to scripts_url, notice: "Script was successfully destroyed." } diff --git a/src/autogen/app/controllers/users_controller.rb b/src/autogen/app/controllers/users_controller.rb new file mode 100644 index 0000000..8f77ea2 --- /dev/null +++ b/src/autogen/app/controllers/users_controller.rb @@ -0,0 +1,59 @@ +class UsersController < ApplicationController + before_action :authenticate_user! + before_action :check_group + before_action :set_user, only: %i[ show edit update destroy ] + # GET /user or /user.json + def index + @users = User.all + end + + # GET /user/1 or /user/1.json + def show + end + + + # GET /user/1/edit + def edit + end + + + # PATCH/PUT /user/1 or /user/1.json + def update + respond_to do |format| + logger.debug(account_params) + if @user.update() + format.html { redirect_to account_url(@user), notice: "User was successfully updated." } + format.json { render :show, status: :ok, location: @user } + else + format.html { render :edit, status: :unprocessable_entity } + format.json { render json: @user.errors, status: :unprocessable_entity } + end + end + end + + # DELETE /user/1 or /user/1.json + def destroy + @user.destroy! + + respond_to do |format| + format.html { redirect_to user_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_user + @user = Account.find(params[:id]) + end + + # Only allow a list of trusted parameters through. + def user_params + params.require(:user).permit(:name, :group) + end + def check_group + if current_user.group != "admin" + redirect_back_or_to("/") + end + end +end diff --git a/src/autogen/app/models/installtemplate.rb b/src/autogen/app/models/installtemplate.rb index 4da642b..bd6f3df 100644 --- a/src/autogen/app/models/installtemplate.rb +++ b/src/autogen/app/models/installtemplate.rb @@ -9,7 +9,6 @@ class Installtemplate 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 diff --git a/src/autogen/app/models/user.rb b/src/autogen/app/models/user.rb index 613cebb..4954aa9 100644 --- a/src/autogen/app/models/user.rb +++ b/src/autogen/app/models/user.rb @@ -8,7 +8,6 @@ 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 @@ -35,5 +34,7 @@ class User # field :unlock_token, type: String # Only if unlock strategy is :email or :both # field :locked_at, type: Time field :group, type: String, default: "" + field :name, type: String, default: "" + include Mongoid::Timestamps end diff --git a/src/autogen/app/views/hosts/_form.html.erb b/src/autogen/app/views/hosts/_form.html.erb index c8bd617..3652869 100644 --- a/src/autogen/app/views/hosts/_form.html.erb +++ b/src/autogen/app/views/hosts/_form.html.erb @@ -1,273 +1,229 @@ -
Uniq Identifier Refered by @host.uuid in script
-Bios product info, Refered by @host.product in script
- -Bios serial info, Refered by @host.serial in script
-hostname, Refered by @host.hostname in script
- -ip of host, Refered by @host.ip in script
-Last detected ip of host, Refered by @host.access_ip in script
-Ip during install of host, Refered by @host.install_ip in script
-Host status, Refered by @host.status in script
-MAc Adress, Refered by @host.mac in script
-Default host disk, Refered by @host.host_device in script
-Active Lusk encryption, Refered by @host.lusk_encrypt in script
- -Partition to encrypt, Refered by @host.lusk_device in script
- -Lusk encrypt key, Refered by @host.lusk_key in script
- -Host interface name, Refered by @host.interface in script
- -Template to install, Refered by @host.installtemplate in script
-Host location, Refered by @host.site in script
-Install Langage, Refered by @host.lang in script
-Root account , Refered by @host.rootaccount in script
-Main user account , Refered by @host.mainaccount in script
-Uniq Identifier Refered by @host.uuid in script
+Bios product info, Refered by @host.product in script
+Bios serial info, Refered by @host.serial in script
+hostname, Refered by @host.hostname in script
+ip of host, Refered by @host.ip in script
+Last detected ip of host, Refered by @host.access_ip in script
+Ip during install of host, Refered by @host.install_ip in script
+Host status, Refered by @host.status in script
+MAc Adress, Refered by @host.mac in script
+Default host disk, Refered by @host.host_device in script
+Active Lusk encryption, Refered by @host.lusk_encrypt in script
+Partition to encrypt, Refered by @host.lusk_device in script
+Lusk encrypt key, Refered by @host.lusk_key in script
+Host interface name, Refered by @host.interface in script
+Template to install, Refered by @host.installtemplate in script
+Host location, Refered by @host.site in script
+Install Langage, Refered by @host.lang in script
+Root account , Refered by @host.rootaccount in script
+Main user account , Refered by @host.mainaccount in script
+<%= notice %>
Hostname:
<%= @host.hostname %>
diff --git a/src/autogen/app/views/hosts/show.html.erb b/src/autogen/app/views/hosts/show.html.erb
index 60a6006..9824b4c 100644
--- a/src/autogen/app/views/hosts/show.html.erb
+++ b/src/autogen/app/views/hosts/show.html.erb
@@ -1,9 +1,6 @@
<%= notice %>
- Name: - <%= installtemplate.name %> -
++ Name: + <%= installtemplate.name %> +
-- Ostype: - <%= installtemplate.ostype %> -
++ Ostype: + <%= installtemplate.ostype %> +
-- Osversion: - <%= installtemplate.osversion %> -
++ Osversion: + <%= installtemplate.osversion %> +
-- Repository: - <%= installtemplate.repository %> -
++ Repository: + <%= installtemplate.repository %> +
-- Nfsroot: - <%= installtemplate.nfsroot %> -
++ Nfsroot: + <%= installtemplate.nfsroot %> +
-- Kernel: - <%= installtemplate.kernel %> -
++ Kernel: + <%= installtemplate.kernel %> +
-- Initrd: - <%= installtemplate.initrd %> -
++ Initrd: + <%= installtemplate.initrd %> +
-- Rootfile: - <%= installtemplate.rootfile %> -
++ Rootfile: + <%= installtemplate.rootfile %> +
-- Boot Script - <% if defined?installtemplate.boot.name %> - <%= installtemplate.boot.name %> - <% else %> - not set - <% end %> -
++ 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 %> -
++ 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 %> -
++ PostInstall + <% if defined?installtemplate.postinstall.name %> + <%= installtemplate.postinstall.name %> + <% else %> + not set + <% end %> +
+<%= notice %>
-<%= notice %>
- +Find me in app/views/pages/index.html.erb
-Stage of script [boot,install,postinstall, ressources](@script.stage )
-- Name: - <%= script.name %> -
- -- Stage: - <%= script.stage %> -
- -- Lang: - <%= script.lang %> -
- -- Content: - <%= script.content %> -
- -- Lock: - <%= script.lock %> -
- -- Description: - <%= script.description %> -
+<%= notice %>
++ Name: + <%= @script.name %> +
++ Stage: + <%= @script.stage %> +
++ Lang: + <%= @script.lang %> +
++ Content: + +
++ Lock: + <%= @script.lock %> +
++ Description: + +
+| Name | -Stage | -Lang | -+ | Name | +Stage | +Lang | +Action |
|---|
<%= notice %>
+<%= notice %>
+- Name: - <%= site.name %> -
++ Name + <%= site.name %> +
-- Domain: - <%= site.domain %> -
++ Domain + <%= site.domain %> +
-- Gateway: - <%= site.gateway %> -
++ Gateway + <%= site.gateway %> +
-- Nameserver: - <%= site.nameserver %> -
++ Nameserver + <%= site.nameserver %> +
-- Network: - <%= site.network %> -
++ Network + <%= site.network %> +
-- Netmask: - <%= site.netmask %> -
++ Netmask + <%= site.netmask %> +
-- Server: - <%= site.api_ip %>:<%= site.api_ip %>: -
++ Api IP + <%= site.api_ip %> +
++ Api Port + <%= site.api_port %> +
+ ++ Api Url + <%= site.api_url %> +
+ ++ Fileserver Uri + <%= site.fileserver_uri %> +
+ ++ Fileserver Basepath + <%= site.fileserver_basepath %> +
+ ++ Fileserver Url: + <%= site.fileserver_url %> +
+ ++ Nfsserver path: + <%= site.nfsserver_path %> +
++ Country: + <%= site.country %> +
++ Timezone: + <%= site.timezone %> +
+<%= notice %>
-| Site Name | -+ | Site Name | +Description | +
|---|
<%= notice %>
- ++ Email: + <%= @user.email %> +
+ ++ Name: + <%= @user.name %> +
+ ++ Group: + <%= @user.group %> +
+| Name | +Group | ++ |
|---|