Hello community, here is the log from the commit of package velum for openSUSE:Factory checked in at 2018-06-22 13:35:29 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/velum (Old) and /work/SRC/openSUSE:Factory/.velum.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "velum" Fri Jun 22 13:35:29 2018 rev:35 rq:618281 version:4.0.0+dev+git_r840_1b17eeef3e92c6e2dbfcfcd38cf31168fae9644a Changes: -------- --- /work/SRC/openSUSE:Factory/velum/velum.changes 2018-06-20 15:30:34.607774529 +0200 +++ /work/SRC/openSUSE:Factory/.velum.new/velum.changes 2018-06-22 13:35:37.010132399 +0200 @@ -1,0 +2,31 @@ +Thu Jun 21 06:56:15 UTC 2018 - [email protected] + +- Commit 4303f26 by Florian Bergmann [email protected] + Load variables used to render autoyast in separate class. + + Commit 875ac30 by Florian Bergmann [email protected] + Fix bsc#1072242: Use keyboard layout from admin installation. + + The keyboard layout the user was using during the installation will be used + in the autoyast generated to bootstrap additional nodes. + + Signed-off-by: Florian Bergmann <[email protected]> + + +------------------------------------------------------------------- +Wed Jun 20 11:41:59 UTC 2018 - [email protected] + +- Commit e943e07 by Vítor Avelino [email protected] + ui: don't show failed alert for repeated orchestration + + A failed alert is shown whenever one of the nodes fails to bootstrap. This is + an optimization to only show this alert once for a specific orchestration + run. If the user closes the alert, it won't come back unless a new + orchestration happens. + + bsc#1097752 + + Signed-off-by: Vítor Avelino <[email protected]> + + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ velum.spec ++++++ --- /var/tmp/diff_new_pack.sa4UhK/_old 2018-06-22 13:35:38.010095433 +0200 +++ /var/tmp/diff_new_pack.sa4UhK/_new 2018-06-22 13:35:38.014095285 +0200 @@ -23,7 +23,7 @@ # Version: 1.0.0 # %%define branch 1.0.0 -Version: 4.0.0+dev+git_r835_cfb20e9771a87f9c7a4506c4da721db60497d0f0 +Version: 4.0.0+dev+git_r840_1b17eeef3e92c6e2dbfcfcd38cf31168fae9644a Release: 0 %define branch master Summary: Dashboard for CaasP @@ -92,7 +92,7 @@ %description velum is the dashboard for CaasP to manage and deploy kubernetes clusters on top of MicroOS -This package has been built with commit cfb20e9771a87f9c7a4506c4da721db60497d0f0 from branch master on date Thu, 14 Jun 2018 12:56:09 +0000 +This package has been built with commit 1b17eeef3e92c6e2dbfcfcd38cf31168fae9644a from branch master on date Thu, 21 Jun 2018 06:55:33 +0000 %prep %setup -q -n velum-%{branch} ++++++ master.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/velum-master/app/assets/javascripts/dashboard/dashboard.js new/velum-master/app/assets/javascripts/dashboard/dashboard.js --- old/velum-master/app/assets/javascripts/dashboard/dashboard.js 2018-06-14 14:57:27.000000000 +0200 +++ new/velum-master/app/assets/javascripts/dashboard/dashboard.js 2018-06-21 08:57:21.000000000 +0200 @@ -149,6 +149,7 @@ } State.minions = minions; + State.lastOrchestrationAt = data.last_orchestration_at; var pendingStateMinion = minions.find(function (minion) { return minion.highstate == "pending"; @@ -328,9 +329,20 @@ }, alertFailedBootstrap: function() { - if (!$('.failed-bootstrap-alert').length) { - showAlert('At least one of the nodes is in a failed state. Please run "supportconfig" on the failed node(s) to gather the logs.', 'alert', 'failed-bootstrap-alert'); + var cachedFailedLastOrchestration = window.localStorage.getItem('failedLastOrchestrationAt'); + + if ($('.failed-bootstrap-alert').length || + cachedFailedLastOrchestration === State.lastOrchestrationAt) { + return; } + + var $alert = showAlert('At least one of the nodes is in a failed state. Please run "supportconfig" on the failed node(s) to gather the logs.', 'alert', 'failed-bootstrap-alert'); + + window.localStorage.removeItem('failedLastOrchestrationAt'); + $alert.on('closed.bs.alert', function () { + window.localStorage.setItem('failedLastOrchestrationAt', State.lastOrchestrationAt); + $alert.off('closed.bs.alert'); + }) }, renderDashboard: function(minion) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/velum-master/app/controllers/concerns/discovery.rb new/velum-master/app/controllers/concerns/discovery.rb --- old/velum-master/app/controllers/concerns/discovery.rb 2018-06-14 14:57:27.000000000 +0200 +++ new/velum-master/app/controllers/concerns/discovery.rb 2018-06-21 08:57:21.000000000 +0200 @@ -18,7 +18,8 @@ cloud_jobs_failed: SaltJob.failed.count, admin: Minion.find_by(minion_id: "admin"), retryable_bootstrap_orchestration: Orchestration.retryable?(kind: :bootstrap), - retryable_upgrade_orchestration: Orchestration.retryable?(kind: :upgrade) + retryable_upgrade_orchestration: Orchestration.retryable?(kind: :upgrade), + last_orchestration_at: Orchestration.last.try(:created_at) } render json: hsh end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/velum-master/app/controllers/dashboard_controller.rb new/velum-master/app/controllers/dashboard_controller.rb --- old/velum-master/app/controllers/dashboard_controller.rb 2018-06-14 14:57:27.000000000 +0200 +++ new/velum-master/app/controllers/dashboard_controller.rb 2018-06-21 08:57:21.000000000 +0200 @@ -1,4 +1,5 @@ require "velum/suse_connect" +require "velum/autoyast_values" # DashboardController shows the main page. class DashboardController < ApplicationController @@ -29,33 +30,10 @@ # fields that customer uses) and also skips the redirection to the setup process (when a worker # asks for the autoyast profile we will either serve it, or return an error). def autoyast - @controller_node = Pillar.value pillar: :dashboard + pollute_variables!(Velum::AutoyastValues.new) if @controller_node.blank? head :service_unavailable else - begin - suse_connect_config = Rails.cache.fetch("SUSEConnect_config") do - Velum::SUSEConnect.config - end - @suse_smt_url = suse_connect_config.smt_url - @suse_regcode = suse_connect_config.regcode - @do_registration = true - rescue Velum::SUSEConnect::MissingRegCodeException, - Velum::SUSEConnect::MissingCredentialsException, - Velum::SUSEConnect::SCCConnectionException - @do_registration = false - end - ssh_key_file = "/var/lib/misc/ssh-public-key/id_rsa.pub" - # rubocop:disable Style/RescueModifier - @ssh_public_key = File.read(ssh_key_file) rescue nil - # rubocop:enable Style/RescueModifier - - # proxy related settings - @proxy_systemwide = Pillar.value(pillar: :proxy_systemwide) == "true" - @proxy_http = Pillar.value(pillar: :http_proxy) - @proxy_https = Pillar.value(pillar: :https_proxy) - @proxy_no_proxy = Pillar.value(pillar: :no_proxy) - render "autoyast.xml.erb", layout: false, content_type: "text/xml" end end @@ -97,4 +75,19 @@ "It is advised to access velum via one of the registered hosts " \ "#{accessible_hosts.join(" or ")}" end + + # This method will copy *all* instance variables of the given object to the + # current instance. No checks will be performed if a variable already exists - + # the current value will be overwritten in that case. + # + # This copying right now is used to prevent nesting values in the template: + # instead of writing `<%= other.var %>` it is possible to just write `<%= var + # %>` again. + # + # @param other [Object] Any object with instance variables. + def pollute_variables!(other) + other.instance_variables.each do |var| + instance_variable_set(var, other.instance_variable_get(var)) + end + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/velum-master/app/views/dashboard/autoyast.xml.erb new/velum-master/app/views/dashboard/autoyast.xml.erb --- old/velum-master/app/views/dashboard/autoyast.xml.erb 2018-06-14 14:57:27.000000000 +0200 +++ new/velum-master/app/views/dashboard/autoyast.xml.erb 2018-06-21 08:57:21.000000000 +0200 @@ -115,7 +115,7 @@ <import config:type="boolean">false</import> </ssh_import> <keyboard> - <keymap>english-us</keymap> + <keymap><%= @keyboard_layout %></keymap> </keyboard> <language> <language>en_US</language> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/velum-master/lib/velum/autoyast_values.rb new/velum-master/lib/velum/autoyast_values.rb --- old/velum-master/lib/velum/autoyast_values.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/velum-master/lib/velum/autoyast_values.rb 2018-06-21 08:57:21.000000000 +0200 @@ -0,0 +1,49 @@ +module Velum + # Load values that will be used to populate the autoyast profile + class AutoyastValues + DEFAULT_KEYBOARD_LAYOUT = "english-us".freeze + YAST_KEYBOARD_KEY = "YAST_KEYBOARD".freeze + SSH_KEY_FILE = "/var/lib/misc/ssh-public-key/id_rsa.pub".freeze + + def initialize + @controller_node = Pillar.value pillar: :dashboard + return if @controller_node.blank? + begin + suse_connect_config = Rails.cache.fetch("SUSEConnect_config") do + Velum::SUSEConnect.config + end + @suse_smt_url = suse_connect_config.smt_url + @suse_regcode = suse_connect_config.regcode + @do_registration = true + rescue Velum::SUSEConnect::MissingRegCodeException, + Velum::SUSEConnect::MissingCredentialsException, + Velum::SUSEConnect::SCCConnectionException + @do_registration = false + end + # rubocop:disable Style/RescueModifier + @ssh_public_key = File.read(SSH_KEY_FILE) rescue nil + @keyboard_layout = read_keyboard_layout + # rubocop:enable Style/RescueModifier + + # proxy related settings + @proxy_systemwide = Pillar.value(pillar: :proxy_systemwide) == "true" + @proxy_http = Pillar.value(pillar: :http_proxy) + @proxy_https = Pillar.value(pillar: :https_proxy) + @proxy_no_proxy = Pillar.value(pillar: :no_proxy) + end + + # Read the keyboard layout set by Yast during installation. + # + # @return [String] the keyboard set from Yast, or 'english-us' as + # default + def read_keyboard_layout(keyboard_config_file: "/var/lib/misc/keyboard") + return DEFAULT_KEYBOARD_LAYOUT unless File.file?(keyboard_config_file) + yast_layout = File.readlines(keyboard_config_file).select do |line| + line =~ /^#{YAST_KEYBOARD_KEY}=/ + end.first + return DEFAULT_KEYBOARD_LAYOUT unless yast_layout + layout, _char_map = yast_layout.split("=")[1].delete('"').split(",") + layout ? layout : DEFAULT_KEYBOARD_LAYOUT + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/velum-master/spec/controllers/dashboard_controller_spec.rb new/velum-master/spec/controllers/dashboard_controller_spec.rb --- old/velum-master/spec/controllers/dashboard_controller_spec.rb 2018-06-14 14:57:27.000000000 +0200 +++ new/velum-master/spec/controllers/dashboard_controller_spec.rb 2018-06-21 08:57:21.000000000 +0200 @@ -147,6 +147,54 @@ end end end + + context "when a keyboard layout was defined during installation" do + before do + keyboard_file = "/var/lib/misc/keyboard" + keyboard_layout = 'YAST_KEYBOARD="german,pc104"' + allow(File).to receive(:file?).with(keyboard_file).and_return(true) + allow(File).to receive(:readlines).with(keyboard_file).and_return([keyboard_layout]) + end + + it "serves the keyboard layout in the autoyast" do + VCR.use_cassette("suse_connect/caasp_registration_active", record: :none) do + get :autoyast + expect(response.status).to eq 200 + expect(response.body).to include "<keymap>german</keymap>" + end + end + end + + context "when no keyboard layout is set" do + before do + keyboard_file = "/var/lib/misc/keyboard" + allow(File).to receive(:file?).with(keyboard_file).and_return(true) + allow(File).to receive(:readlines).with(keyboard_file).and_return([""]) + end + + it "serves the default keyboard layout in the autoyast" do + VCR.use_cassette("suse_connect/caasp_registration_active", record: :none) do + get :autoyast + expect(response.status).to eq 200 + expect(response.body).to include "<keymap>english-us</keymap>" + end + end + end + + context "when no keyboard file exists" do + before do + keyboard_file = "/var/lib/misc/keyboard" + allow(File).to receive(:file?).with(keyboard_file).and_return(false) + end + + it "serves the default keyboard layout in the autoyast" do + VCR.use_cassette("suse_connect/caasp_registration_active", record: :none) do + get :autoyast + expect(response.status).to eq 200 + expect(response.body).to include "<keymap>english-us</keymap>" + end + end + end end # rubocop:disable RSpec/AnyInstance
