Hello community, here is the log from the commit of package velum for openSUSE:Factory checked in at 2018-03-16 10:44:09 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/velum (Old) and /work/SRC/openSUSE:Factory/.velum.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "velum" Fri Mar 16 10:44:09 2018 rev:14 rq:587553 version:3.0.0+dev+git_r674_5b21e6e383d86fce7989f811a1113b477b06e3cc Changes: -------- --- /work/SRC/openSUSE:Factory/velum/velum.changes 2018-03-14 19:41:02.760922163 +0100 +++ /work/SRC/openSUSE:Factory/.velum.new/velum.changes 2018-03-16 10:45:14.980367081 +0100 @@ -1,0 +2,12 @@ +Thu Mar 15 15:11:09 UTC 2018 - [email protected] + +- Commit 55ceb81 by Maximilian Meister [email protected] + enable applying registry settings + + feature#registry + + Signed-off-by: Maximilian Meister <[email protected]> Co-Authored-by: VĂtor + Avelino <[email protected]> + + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ velum.spec ++++++ --- /var/tmp/diff_new_pack.MI3x80/_old 2018-03-16 10:45:16.124325890 +0100 +++ /var/tmp/diff_new_pack.MI3x80/_new 2018-03-16 10:45:16.128325746 +0100 @@ -23,7 +23,7 @@ # Version: 1.0.0 # %%define branch 1.0.0 -Version: 3.0.0+dev+git_r672_9f7ffab6f82eadc94ec36a8a32e1e70e5aa94bcc +Version: 3.0.0+dev+git_r674_5b21e6e383d86fce7989f811a1113b477b06e3cc Release: 0 %define branch master Summary: Dashboard for CaasP @@ -96,7 +96,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 9f7ffab6f82eadc94ec36a8a32e1e70e5aa94bcc from branch master on date Wed, 14 Mar 2018 13:55:57 +0000 +This package has been built with commit 5b21e6e383d86fce7989f811a1113b477b06e3cc from branch master on date Thu, 15 Mar 2018 15:10:17 +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/stylesheets/components/buttons.scss new/velum-master/app/assets/stylesheets/components/buttons.scss --- old/velum-master/app/assets/stylesheets/components/buttons.scss 2018-03-14 14:55:30.000000000 +0100 +++ new/velum-master/app/assets/stylesheets/components/buttons.scss 2018-03-15 15:43:35.000000000 +0100 @@ -7,6 +7,12 @@ .fa { margin-right: 3px; } + + &.icon-only { + .fa { + margin-right: 0; + } + } } .btn-group-toggle .btn { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/velum-master/app/assets/stylesheets/components/notifications.scss new/velum-master/app/assets/stylesheets/components/notifications.scss --- old/velum-master/app/assets/stylesheets/components/notifications.scss 2018-03-14 14:55:30.000000000 +0100 +++ new/velum-master/app/assets/stylesheets/components/notifications.scss 2018-03-15 15:43:35.000000000 +0100 @@ -12,14 +12,31 @@ color: $state-danger-text; } -.alert-info a { +.alert-success a { color: $state-danger-text; } -.alert-success a { - color: $state-danger-text; + +.alert-with-btn { + > .left { + line-height: 34px; + float: left; + } + + > .right { + float: right; + } +} + +.alert-with-btn-sm { + @extend .alert-with-btn; + + .left { + line-height: 30px; + } } .connection-failed-alert { display: none; -} \ No newline at end of file +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/velum-master/app/controllers/settings_controller.rb new/velum-master/app/controllers/settings_controller.rb --- old/velum-master/app/controllers/settings_controller.rb 2018-03-14 14:55:30.000000000 +0100 +++ new/velum-master/app/controllers/settings_controller.rb 2018-03-15 15:43:35.000000000 +0100 @@ -6,4 +6,13 @@ def index redirect_to settings_registries_path end + + def apply + Minion.mark_pending_bootstrap! + Orchestration.run(kind: :bootstrap) + redirect_to root_path, notice: "Registry settings are applied once orchestration is done." + rescue Orchestration::OrchestrationOngoing + redirect_to request.referer, + alert: "Orchestration currently ongoing. Please wait for it to finish." + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/velum-master/app/models/minion.rb new/velum-master/app/models/minion.rb --- old/velum-master/app/models/minion.rb 2018-03-14 14:55:30.000000000 +0100 +++ new/velum-master/app/models/minion.rb 2018-03-15 15:43:35.000000000 +0100 @@ -106,6 +106,11 @@ Minion.highstates[:failed]]) .update_all highstate: Minion.highstates[:pending] end + + # Forcefully updates all nodes to a pending highstate + def self.mark_pending_bootstrap! + Minion.assigned_role.update_all highstate: Minion.highstates[:pending] + end # rubocop:enable Rails/SkipsModelValidations # Returns the proxy for the salt minion diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/velum-master/app/views/layouts/settings.html.slim new/velum-master/app/views/layouts/settings.html.slim --- old/velum-master/app/views/layouts/settings.html.slim 2018-03-14 14:55:30.000000000 +0100 +++ new/velum-master/app/views/layouts/settings.html.slim 2018-03-15 15:43:35.000000000 +0100 @@ -11,6 +11,7 @@ title Velum = csrf_meta_tags = stylesheet_link_tag 'application', media: 'all' + = stylesheet_link_tag 'application', media: 'all' - if Rails.env.test? = stylesheet_link_tag 'test', media: 'all' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/velum-master/app/views/settings/_apply.html.slim new/velum-master/app/views/settings/_apply.html.slim --- old/velum-master/app/views/settings/_apply.html.slim 1970-01-01 01:00:00.000000000 +0100 +++ new/velum-master/app/views/settings/_apply.html.slim 2018-03-15 15:43:35.000000000 +0100 @@ -0,0 +1,6 @@ +.alert.alert-info.alert-with-btn-sm.clearfix role="alert" + .left + | Changes are not imediately reflected. You might want to apply it. + + .right + = button_to "Apply changes", settings_apply_path, class: "btn btn-info btn-sm pull-right" \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/velum-master/app/views/settings/registries/index.html.slim new/velum-master/app/views/settings/registries/index.html.slim --- old/velum-master/app/views/settings/registries/index.html.slim 2018-03-14 14:55:30.000000000 +0100 +++ new/velum-master/app/views/settings/registries/index.html.slim 2018-03-15 15:43:35.000000000 +0100 @@ -1,3 +1,5 @@ += render 'settings/apply' + h2 Remote Registries = link_to "Add Remote Registry", new_settings_registry_path, class: "btn btn-primary add-entry-btn" @@ -18,9 +20,9 @@ td = display_registry_url(registry.url) td.actions - = link_to edit_settings_registry_path(registry), class: "btn btn-default edit-btn" do - .fa.fa-pencil - = link_to settings_registry_path(registry), method: "delete", class: "btn btn-danger delete-btn", data: { confirm: "Are you sure?" } do - .fa.fa-trash-o + = link_to edit_settings_registry_path(registry), class: "btn btn-default icon-only edit-btn" do + i.fa.fa-pencil + = link_to settings_registry_path(registry), method: "delete", class: "btn btn-danger icon-only delete-btn", data: { confirm: "Are you sure?" } do + i.fa.fa-trash-o - else | No registry found. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/velum-master/app/views/settings/registries/show.html.slim new/velum-master/app/views/settings/registries/show.html.slim --- old/velum-master/app/views/settings/registries/show.html.slim 2018-03-14 14:55:30.000000000 +0100 +++ new/velum-master/app/views/settings/registries/show.html.slim 2018-03-15 15:43:35.000000000 +0100 @@ -38,9 +38,9 @@ td = display_registry_url(mirror.url) td.actions - = link_to edit_settings_registry_mirror_path(mirror), class: "btn btn-default edit-btn" do - .fa.fa-pencil - = link_to settings_registry_mirror_path(mirror), method: "delete", class: "btn btn-danger delete-btn", data: { confirm: "Are you sure?" } do - .fa.fa-trash-o + = link_to edit_settings_registry_mirror_path(mirror), class: "btn btn-default icon-only edit-btn" do + i.fa.fa-pencil + = link_to settings_registry_mirror_path(mirror), method: "delete", class: "btn btn-danger icon-only delete-btn", data: { confirm: "Are you sure?" } do + i.fa.fa-trash-o - else p No mirrors found diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/velum-master/app/views/settings/registry_mirrors/index.html.slim new/velum-master/app/views/settings/registry_mirrors/index.html.slim --- old/velum-master/app/views/settings/registry_mirrors/index.html.slim 2018-03-14 14:55:30.000000000 +0100 +++ new/velum-master/app/views/settings/registry_mirrors/index.html.slim 2018-03-15 15:43:35.000000000 +0100 @@ -1,3 +1,5 @@ += render 'settings/apply' + h2 Mirrors = link_to "Add Mirror", new_settings_registry_mirror_path, class: "btn btn-primary add-entry-btn" @@ -24,9 +26,9 @@ td = display_registry_url(mirror.url) td.actions - = link_to edit_settings_registry_mirror_path(mirror), class: "btn btn-default edit-btn" do - .fa.fa-pencil - = link_to settings_registry_mirror_path(mirror), method: "delete", class: "btn btn-danger delete-btn", data: { confirm: "Are you sure?" } do - .fa.fa-trash-o + = link_to edit_settings_registry_mirror_path(mirror), class: "btn btn-default icon-only edit-btn" do + i.fa.fa-pencil + = link_to settings_registry_mirror_path(mirror), method: "delete", class: "btn btn-danger icon-only delete-btn", data: { confirm: "Are you sure?" } do + i.fa.fa-trash-o - else p No mirrors found. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/velum-master/config/routes.rb new/velum-master/config/routes.rb --- old/velum-master/config/routes.rb 2018-03-14 14:55:30.000000000 +0100 +++ new/velum-master/config/routes.rb 2018-03-15 15:43:35.000000000 +0100 @@ -54,6 +54,7 @@ namespace :settings do get "/", action: :index resources :registries + post :apply resources :registry_mirrors, path: :mirrors end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/velum-master/spec/controllers/settings_controller_spec.rb new/velum-master/spec/controllers/settings_controller_spec.rb --- old/velum-master/spec/controllers/settings_controller_spec.rb 2018-03-14 14:55:30.000000000 +0100 +++ new/velum-master/spec/controllers/settings_controller_spec.rb 2018-03-15 15:43:35.000000000 +0100 @@ -1,10 +1,39 @@ require "rails_helper" RSpec.describe SettingsController, type: :controller do + let(:user) { create(:user) } + + before do + setup_done + sign_in user + end + describe "GET #index" do it "redirects to settings_registries_path" do get :index expect(response).to have_http_status(302) end end + + describe "POST #apply" do + it "marks bootstrap as pending" do + allow(Orchestration).to receive(:run).and_return(true) + post :apply + expect(Minion.pending.count).to eq(Minion.count) + end + + it "doesn't allow multiple orchestrations" do + allow(request).to receive(:referer).and_return("/") + allow(Orchestration).to receive(:runnable?).and_return false + post :apply + expect(Minion.pending.count).to be_zero + expect(response).to have_http_status(302) + end + + it "redirects to settings_registries_path" do + allow(Orchestration).to receive(:run).and_return(true) + post :apply + expect(response).to have_http_status(302) + end + end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/velum-master/spec/models/minion_spec.rb new/velum-master/spec/models/minion_spec.rb --- old/velum-master/spec/models/minion_spec.rb 2018-03-14 14:55:30.000000000 +0100 +++ new/velum-master/spec/models/minion_spec.rb 2018-03-15 15:43:35.000000000 +0100 @@ -272,7 +272,7 @@ described_class.third.minion_id => true]] end - context "when and update is needed" do + context "when an update is needed" do it "sets the highstate of the upgradable minions as pending" do expect { described_class.mark_pending_update }.to change { described_class.applied.count @@ -280,4 +280,23 @@ end end end + + describe "#mark_pending_bootstrap!" do + before do + minions + described_class.first.assign_role :master, remote: false + described_class.all[1..-1].each { |minion| minion.assign_role :worker, remote: false } + # rubocop:disable Rails/SkipsModelValidations + described_class.update_all highstate: described_class.highstates[:applied] + # rubocop:enable Rails/SkipsModelValidations + end + + context "when a bootstrap is triggered" do + it "sets the highstate of all minions as pending" do + expect { described_class.mark_pending_bootstrap! }.to change { + described_class.pending.count + }.from(0).to(3) + end + end + end end
