Skip to content

Commit

Permalink
Break autoyast2 <> yast2-installation dependency cycle
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Dec 4, 2017
1 parent 5fe90cb commit 04f9ab0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions package/yast2-installation.spec
Expand Up @@ -50,8 +50,8 @@ BuildRequires: yast2-storage-ng >= 4.0.43
Requires: yast2-storage-ng >= 4.0.43

# Y2Autoinstall::ActivateCallbacks
BuildRequires: autoyast2-installation >= 4.0.11
Requires: autoyast2-installation >= 4.0.11
#BuildRequires: autoyast2-installation >= 4.0.11
#Requires: autoyast2-installation >= 4.0.11

# Yast::WorkflowManager.merge_modules_extensions
Requires: yast2 >= 4.0.8
Expand Down
4 changes: 3 additions & 1 deletion src/lib/installation/clients/inst_system_analysis.rb
Expand Up @@ -27,7 +27,6 @@

require "yast"
require "y2storage"
require "autoinstall/activate_callbacks"

module Yast
class InstSystemAnalysisClient < Client
Expand All @@ -36,6 +35,9 @@ def main

textdomain "installation"

# Require here to break dependency cycle (bsc#1070996)
require "autoinstall/activate_callbacks"

Yast.import "Arch"
Yast.import "GetInstArgs"
Yast.import "Hotplug"
Expand Down
10 changes: 9 additions & 1 deletion test/lib/clients/inst_system_analysis_test.rb
Expand Up @@ -32,6 +32,10 @@
let(:devicegraph) { instance_double(Y2Storage::Devicegraph, empty?: false) }
let(:auto) { false }

before do
allow(client).to receive(:require).with("autoinstall/activate_callbacks")
end

before do
allow(Y2Storage::StorageManager).to receive(:instance).and_return(storage)
allow(Yast::Mode).to receive(:auto).and_return(auto)
Expand All @@ -44,9 +48,13 @@

context "when running AutoYaST" do
let(:auto) { true }
let(:callbacks_class) { double("Y2Autoinstallation::ActivateCallbacks", new: callbacks) }
let(:callbacks) { instance_double("Y2Autoinstallation::ActivateCallbacks") }

before { stub_const("Y2Autoinstallation::ActivateCallbacks", callbacks_class) }

it "uses AutoYaST activation callbacks" do
expect(storage).to receive(:activate).with(Y2Autoinstallation::ActivateCallbacks)
expect(storage).to receive(:activate).with(callbacks)
client.ActionHDDProbe
end
end
Expand Down

0 comments on commit 04f9ab0

Please sign in to comment.