Skip to content

Commit

Permalink
Merge pull request #23 from mchf/bnc1053559-internal-error
Browse files Browse the repository at this point in the history
Fixed serial_console=
  • Loading branch information
jreidinger committed Aug 17, 2018
2 parents 430b744 + ccc4c79 commit 518f3f4
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG
@@ -1,3 +1,10 @@
-------------------------------------------------------------------------
Thu Aug 16 11:35:47 UTC 2018 - mfilka@suse.com

- bnc#1053559
- fixed serial_console= to use new terminal= API
- 1.0.1

-------------------------------------------------------------------------
Tue Jul 10 14:35:47 UTC 2018 - mfilka@suse.com

Expand Down
2 changes: 1 addition & 1 deletion cfa_grub2.gemspec
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "cfa_grub2"
s.version = "1.0.0"
s.version = "1.0.1"
s.platform = Gem::Platform::RUBY
s.authors = ["Josef Reidinger"]
s.email = ["jreidinger@suse.cz"]
Expand Down
10 changes: 8 additions & 2 deletions lib/cfa/grub2/default.rb
Expand Up @@ -127,7 +127,7 @@ def terminal
#
# Raises an ArgumentError exception in case of invalid value
#
# @param values [Array<Symbol>, nil] list of accepted terminal valuesi
# @param values [Array<Symbol>, nil] list of accepted terminal values
# (@see VALID_TERMINAL_OPTIONS)
def terminal=(values)
values = [] if values.nil?
Expand All @@ -139,8 +139,14 @@ def terminal=(values)
generic_set("GRUB_TERMINAL", values.join(" "))
end

# Sets GRUB_SERIAL_COMMAND option
#
# Updates GRUB_SERIAL_COMMAND with given value, also enables serial
# console in GRUB_TERMINAL
#
# @param value [String] value for GRUB_SERIAL_COMMAND
def serial_console=(value)
self.terminal = :serial
self.terminal = (terminal || []) | [:serial]
generic_set("GRUB_SERIAL_COMMAND", value)
end

Expand Down
12 changes: 12 additions & 0 deletions spec/grub2_default_spec.rb
Expand Up @@ -110,6 +110,18 @@
end
end

describe "#serial_console=" do
let(:file_content) { "GRUB_TERMINAL=\"\"\n" }

it "sets GRUB_SERIAL_COMMAND" do
config.serial_console = "tty"
config.save

RESULT = "GRUB_TERMINAL=\"serial\"\nGRUB_SERIAL_COMMAND=\"tty\"".freeze
expect(memory_file.content.strip).to eq(RESULT)
end
end

describe "#os_prober" do
let(:file_content) { "GRUB_DISABLE_OS_PROBER=true\n" }

Expand Down

0 comments on commit 518f3f4

Please sign in to comment.