Skip to content

Commit

Permalink
Merge 1fadac2 into 952bdae
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Oct 8, 2020
2 parents 952bdae + 1fadac2 commit 4577155
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
7 changes: 7 additions & 0 deletions package/autoyast2.changes
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Oct 8 15:31:12 UTC 2020 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

- Do not show a warning the user when a script just did not run
(bsc#1177057).
- 4.3.60

-------------------------------------------------------------------
Thu Oct 8 08:33:12 UTC 2020 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

Expand Down
2 changes: 1 addition & 1 deletion package/autoyast2.spec
Expand Up @@ -22,7 +22,7 @@
%endif

Name: autoyast2
Version: 4.3.59
Version: 4.3.60
Release: 0
Summary: YaST2 - Automated Installation
License: GPL-2.0-only
Expand Down
2 changes: 1 addition & 1 deletion src/lib/autoinstall/script.rb
Expand Up @@ -269,7 +269,7 @@ def initialize(hash)
"python" => "/usr/bin/python"
}.freeze
# Runs the script
# @return [Boolean] if exit code is zero
# @return [Boolean,nil] if exit code is zero; nil if the script was not executed
def execute
return if already_run? && !rerun

Expand Down
3 changes: 2 additions & 1 deletion src/modules/AutoinstScripts.rb
Expand Up @@ -245,7 +245,7 @@ def typeString(type)
def Write(type, special)
return true if !Mode.autoinst && !Mode.autoupgrade

target_scripts = @scripts.select { |s| s.class.type == type }
target_scripts = scripts.select { |s| s.class.type == type }
target_scripts.select! { |s| s.chrooted == special } if type == "chroot-scripts"

target_scripts.each(&:create_script_file)
Expand All @@ -259,6 +259,7 @@ def Write(type, special)
Popup.ShowFeedback("", script.notification) unless script.notification.empty?

res = script.execute
next if res.nil? # the script was not executed

Popup.ClearFeedback unless script.notification.empty?

Expand Down
18 changes: 18 additions & 0 deletions test/AutoinstScripts_test.rb
Expand Up @@ -261,6 +261,24 @@
subject.Import(data)
subject.Write("pre-scripts", true)
end

context "when the script does not run" do
let(:script) do
Y2Autoinstallation::PreScript.new(
"location" => "http://test.com/script", "rerun" => false
)
end

before do
allow(subject).to receive(:scripts).and_return([script])
allow(script).to receive(:execute).and_return(nil)
end

it "does not report any problem" do
expect(Yast::Report).to_not receive(:Warning)
subject.Write("pre-scripts", false)
end
end
end

context "for postpartitioning-scripts" do
Expand Down

0 comments on commit 4577155

Please sign in to comment.