Skip to content

Commit

Permalink
using on_target
Browse files Browse the repository at this point in the history
  • Loading branch information
schubi2 committed Feb 5, 2020
1 parent fdb3d76 commit a83f5e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 1 addition & 3 deletions library/general/src/lib/cfa/sysctl_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -195,10 +195,8 @@ def boot_config_file
@boot_config_file ||= files.find { |f| f.file_path == boot_config_path }
end

# FIXME: Move to a better place (?)
def kernel_version
# TODO: on_target
@kernel_version ||= Yast::Execute.locally.stdout("/usr/bin/uname", "-r").to_s.chomp
@kernel_version ||= Yast::Execute.on_target.stdout("/usr/bin/uname", "-r").to_s.chomp
end

def yast_config_file_idx
Expand Down
8 changes: 4 additions & 4 deletions library/general/test/cfa/sysctl_config_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
let(:execute_object) { Yast::Execute.new }

before do
allow(Yast::Execute).to receive(:locally).and_return(execute_object)
allow(Yast::Execute).to receive(:on_target).and_return(execute_object)
allow(execute_object).to receive(:stdout).with("/usr/bin/uname", "-r").and_return("5.3.7-1-default")
end

Expand Down Expand Up @@ -75,7 +75,7 @@

context "when a specific kernel flavor configuration is found" do
before do
allow(Yast::Execute).to receive(:locally).and_return(execute_object)
allow(Yast::Execute).to receive(:on_target).and_return(execute_object)
allow(execute_object).to receive(:stdout).with("/usr/bin/uname", "-r").and_return("5.3.7-1-default")
end

Expand All @@ -98,7 +98,7 @@

context "when no specific kernel configurations are found" do
before do
allow(Yast::Execute).to receive(:locally).and_return(execute_object)
allow(Yast::Execute).to receive(:on_target).and_return(execute_object)
allow(execute_object).to receive(:stdout).with("/usr/bin/uname", "-r").and_return("")
end

Expand Down Expand Up @@ -164,7 +164,7 @@

context "and no specific attributes are given" do
it "checks all known attributes" do
expect(file).to receive(:attr_value).exactly(CFA::Sysctl.known_attributes.count).times
expect(file).to receive(:attr_value).exactly(9).times
config.conflict_files
end
end
Expand Down

0 comments on commit a83f5e5

Please sign in to comment.