Skip to content

Commit

Permalink
Merge pull request #525 from mchf/master
Browse files Browse the repository at this point in the history
Merge of SLE-12-SP2-CASP into master
  • Loading branch information
mchf committed Mar 6, 2017
2 parents 252bad2 + d64079a commit ed4db2d
Show file tree
Hide file tree
Showing 9 changed files with 123 additions and 47 deletions.
13 changes: 13 additions & 0 deletions package/yast2-installation.changes
@@ -1,3 +1,16 @@
-------------------------------------------------------------------
Mon Mar 6 09:39:00 UTC 2017 - mfilka@suse.com

- CaaSP: do not crash when used a dashed url for the controller
node location (bsc#1024965)
- CaaSP AY: Adapted requirements of yast2-services-manager.
(FATE#321738)
- bnc#1022546
- update all-in-one's subdialog (network/kdump/partitioning/...)
overview when the dialog is closed and do not lose another
content already entered by user.
- 3.2.24

-------------------------------------------------------------------
Wed Feb 15 17:58:16 UTC 2017 - jreidinger@suse.com

Expand Down
7 changes: 4 additions & 3 deletions package/yast2-installation.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-installation
Version: 3.2.23
Version: 3.2.24
Release: 0

BuildRoot: %{_tmppath}/%{name}-%{version}-build
Expand Down Expand Up @@ -71,8 +71,9 @@ Requires: initviocons
# Proxy settings for 2nd stage (bnc#764951)
Requires: yast2-proxy

# Systemd default target and services
Requires: yast2-services-manager
# Systemd default target and services. This version supports
# writing settings in the first installation stage.
Requires: yast2-services-manager >= 3.2.1

# Network service setup moved into yast2-network
Requires: yast2-network >= 3.1.143
Expand Down
26 changes: 16 additions & 10 deletions src/lib/installation/clients/inst_casp_overview.rb
Expand Up @@ -68,16 +68,18 @@ def run
ret = Yast::CWM.show(
content,
# Title for installation overview dialog
caption: _("Installation Overview"),
caption: _("Installation Overview"),
# Button label: start the installation
next_button: _("Install"),
next_button: _("Install"),
# do not show abort and back button
abort_button: "",
back_button: "",
# do not store stuff when just redrawing
skip_store_for: [:redraw]
abort_button: "",
back_button: ""
)
next if ret == :redraw

# Currently no other return value is expected, behavior can
# be unpredictable if something else is received - raise
# RuntimeError
raise "Unexpected return value" if ret != :next

# do software proposal
d = Yast::WFM.CallFunction("software_proposal",
Expand Down Expand Up @@ -145,6 +147,10 @@ def quadrant_layout(upper_left:, lower_left:, upper_right:, lower_right:)
# block installation
def content
controller_node = Installation::Widgets::ControllerNodePlace.new

kdump_overview = Installation::Widgets::Overview.new(client: "kdump_proposal")
bootloader_overview = Installation::Widgets::Overview.new(client: "bootloader_proposal", redraw: [kdump_overview])

quadrant_layout(
upper_left: VBox(
::Registration::Widgets::RegistrationCode.new,
Expand All @@ -158,12 +164,12 @@ def content
Tune::Widgets::SystemInformation.new
),
upper_right: VBox(
Installation::Widgets::Overview.new(client: "partitions_proposal"),
Installation::Widgets::Overview.new(client: "bootloader_proposal")
Installation::Widgets::Overview.new(client: "partitions_proposal", redraw: [bootloader_overview]),
bootloader_overview
),
lower_right: VBox(
Installation::Widgets::Overview.new(client: "network_proposal"),
Installation::Widgets::Overview.new(client: "kdump_proposal")
kdump_overview
)
)
end
Expand Down
5 changes: 3 additions & 2 deletions src/lib/installation/clients/inst_finish.rb
Expand Up @@ -390,7 +390,8 @@ def save_config_steps
"autoinst_scripts2",
"installation_settings",
"roles",
"services"
"services",
"services-manager"
].freeze

def save_settings_steps
Expand Down Expand Up @@ -557,7 +558,7 @@ def keep_only_valid_steps(stage)
!(Mode.autoupgrade && info["when"].include?(:autoupg))
next nil
end
log.info "inst_finish client %{s} will be called"
log.info "inst_finish client #{s} will be called"
info["client"] = s

info
Expand Down
8 changes: 7 additions & 1 deletion src/lib/installation/system_roles/handlers.rb
Expand Up @@ -19,11 +19,14 @@
# current contact information at www.suse.com.
# ------------------------------------------------------------------------------

require "yast"
require "installation/cfa/salt"

module Installation
module SystemRoleHandlers
class WorkerRoleFinish
include Yast::Logger

def self.run
role = SystemRole.find("worker_role")
master_conf = CFA::MinionMasterConf.new
Expand All @@ -34,7 +37,10 @@ def self.run
log.info("The minion master.conf file does not exist, it will be created")
end
log.info("The controller node for this worker role is: #{master}")
master_conf.master = master
# FIXME: the cobblersettings lense does not support dashes in the url
# without single quotes, we need to use a custom lense for salt conf.
# As Salt can use also 'url' just use in case of dashed.
master_conf.master = master.include?("-") ? "'#{master}'" : master
master_conf.save
end
end
Expand Down
41 changes: 35 additions & 6 deletions src/lib/installation/widgets/overview.rb
Expand Up @@ -33,20 +33,22 @@ class Overview < CWM::CustomWidget
attr_reader :proposal_client

# @param client [String] A proposal client implementing simple_mode,
# @param redraw [Array<Overview>] list of other Overview clients. In case
# of :redraw action every of these clients will be redrawn too. Caller is
# responsible for not creating circular dependencies.
# eg. "bootloader_proposal"
def initialize(client:)
def initialize(client:, redraw: [])
textdomain "installation"
@proposal_client = client
@replace_point = "rp_" + client
# by default widget_id is the class name; must differentiate instances
self.widget_id = "overview_" + client
@blocking = false
@overviews_for_redraw = redraw
end

def contents
VBox(
Left(PushButton(Id(button_id), label)),
* items.map { |i| Left(Label(" * #{i}")) }
)
ReplacePoint(Id(@replace_point), widget)
end

def label
Expand Down Expand Up @@ -80,9 +82,22 @@ def items
@items = d["label_proposal"]
end

# Updates overview content
def redraw
reset

Yast::UI.ReplaceWidget(Id(@replace_point), widget)

@overviews_for_redraw.each(&:redraw)
end

# Custom event handler
def handle(_event)
Yast::WFM.CallFunction(proposal_client, ["AskUser", {}])
:redraw

redraw

nil
end

def validate
Expand All @@ -107,6 +122,20 @@ def button_id
# an arbitrary unique id
"ask_" + proposal_client
end

# The overview representation in common UI widgets
def widget
VBox(
Left(PushButton(Id(button_id), label)),
* items.map { |i| Left(Label(" * #{i}")) }
)
end

# Flush cache(s)
def reset
@label = nil
@items = nil
end
end
end
end
8 changes: 0 additions & 8 deletions test/inst_casp_overview_test.rb
Expand Up @@ -103,14 +103,6 @@ def label
subject.run
end

it "shows CWM widgets again if it returns redraw event" do
allow(Yast::Mode).to receive(:normal).and_return(true)

expect(Yast::CWM).to receive(:show).twice.and_return(:redraw, :next)

subject.run
end

it "adds caasp specific services to be enabled" do
subject.run

Expand Down
17 changes: 0 additions & 17 deletions test/roles_finish_test.rb
Expand Up @@ -6,23 +6,6 @@
require "fileutils"

describe ::Installation::Clients::RolesFinish do
MASTER_CONF = FIXTURES_DIR.join("minion.d/master.conf").freeze
MASTER_CONF_EXISTENT = FIXTURES_DIR.join("minion.d/master.conf_existent").freeze
MASTER_CONF_EXPECTED = FIXTURES_DIR.join("minion.d/master.conf_expected").freeze

let(:master_conf) { ::Installation::CFA::MinionMasterConf.new }
let(:master_conf_path) { MASTER_CONF }

after do
FileUtils.remove_file(MASTER_CONF, true)
end

before do
allow(Yast::Stage).to receive(:initial).and_return(true)
allow(subject).to receive(:master).and_return("salt_controller")
stub_const("Installation::CFA::MinionMasterConf::PATH", master_conf_path)
end

describe "#title" do
it "returns string with title" do
expect(subject.title).to be_a ::String
Expand Down
45 changes: 45 additions & 0 deletions test/system_role_handlers_test.rb
@@ -0,0 +1,45 @@
#! /usr/bin/env rspec

require_relative "./test_helper"
require "installation/system_role"
require "installation/system_roles/handlers"

describe Installation::SystemRoleHandlers::WorkerRoleFinish do
let(:role) { instance_double("::Installation::SystemRole") }
let(:conf) do
instance_double("::Installation::CFA::MinionMasterConf", load: true, save: true)
end

before do
allow(::Installation::SystemRole).to receive("find")
.with("worker_role").and_return(role)
allow(::Installation::CFA::MinionMasterConf).to receive(:new).and_return(conf)
end

describe ".run" do
context "if the worker role controller node location contains dashes" do
it "surrounds the url with single quotes before save" do
expect(role).to receive(:[]).with("controller_node").and_return("controller-url")
expect(conf).to receive(:master=).with("'controller-url'")
described_class.run
end

end

context "if the worker role controller node location does not contain dashes" do
it "saves the url as defined" do
expect(role).to receive(:[]).with("controller_node").and_return("controller")
expect(conf).to receive(:master=).with("controller")
described_class.run
end
end

it "saves the controller node location into the minion master.conf file" do
expect(role).to receive(:[]).with("controller_node").and_return("controller")
expect(conf).to receive(:master=).with("controller")
expect(conf).to receive(:save)

described_class.run
end
end
end

0 comments on commit ed4db2d

Please sign in to comment.