diff --git a/src/lib/autoinstall/ask/question.rb b/src/lib/autoinstall/ask/question.rb index fd177fd52..ad7fcb5dd 100644 --- a/src/lib/autoinstall/ask/question.rb +++ b/src/lib/autoinstall/ask/question.rb @@ -86,6 +86,8 @@ def value=(val) [true, "true"].include?(val) when "symbol" val.to_sym + when "static_text" + nil else val.to_s end diff --git a/src/lib/autoinstall/ask/runner.rb b/src/lib/autoinstall/ask/runner.rb index 865e76529..a531aba9c 100644 --- a/src/lib/autoinstall/ask/runner.rb +++ b/src/lib/autoinstall/ask/runner.rb @@ -120,7 +120,15 @@ def run_dialog(dialog) # # @return [Integer,nil] Next dialog ID def find_next_dialog_index - return unless File.file?(DIALOG_FILE) && File.size(DIALOG_FILE) <= MAX_DIALOG_FILE_SIZE + return unless File.exist?(DIALOG_FILE) + + is_file = File.file?(DIALOG_FILE) + file_size = File.size(DIALOG_FILE) + if !is_file || file_size > MAX_DIALOG_FILE_SIZE + log.error "Ignoring #{DIALOG_FILE} because it is not a file (#{is_file}) or " \ + "it is too big (#{file_size}." + return + end next_dialog = File.read(DIALOG_FILE) FileUtils.rm(DIALOG_FILE) diff --git a/src/lib/autoinstall/widgets/ask/check_box.rb b/src/lib/autoinstall/widgets/ask/check_box.rb index a55f7f2b6..d06e6a32a 100644 --- a/src/lib/autoinstall/widgets/ask/check_box.rb +++ b/src/lib/autoinstall/widgets/ask/check_box.rb @@ -37,6 +37,8 @@ def initialize(question) end # @macro seeAbstractWidget + # The ':notify' option is needed to notify the timer when the value changes. + # @see Y2Autoinstall::Widgets::Ask::Dialog::TimeoutWrapper def opt [:notify] end diff --git a/src/lib/autoinstall/widgets/ask/combo_box.rb b/src/lib/autoinstall/widgets/ask/combo_box.rb index 3d721c908..221165ad9 100644 --- a/src/lib/autoinstall/widgets/ask/combo_box.rb +++ b/src/lib/autoinstall/widgets/ask/combo_box.rb @@ -36,8 +36,10 @@ def initialize(question) end # @macro seeAbstractWidget + # The ':notify' option is needed to notify the timer when the value changes. + # @see Y2Autoinstall::Widgets::Ask::Dialog::TimeoutWrapper def opt - [:notify, :immediate] + [:notify] end # @macro seeComboBox diff --git a/src/lib/autoinstall/widgets/ask/input_field.rb b/src/lib/autoinstall/widgets/ask/input_field.rb index 6d3242939..6133d9c8c 100644 --- a/src/lib/autoinstall/widgets/ask/input_field.rb +++ b/src/lib/autoinstall/widgets/ask/input_field.rb @@ -37,6 +37,8 @@ def initialize(question) end # @macro seeAbstractWidget + # This options are needed to notify the timer when the value changes + # @see Y2Autoinstall::Widgets::Ask::Dialog::TimeoutWrapper def opt [:hstretch, :notify] end diff --git a/src/lib/autoinstall/widgets/ask/password_field.rb b/src/lib/autoinstall/widgets/ask/password_field.rb index 3141f9c7f..b9074f2a0 100644 --- a/src/lib/autoinstall/widgets/ask/password_field.rb +++ b/src/lib/autoinstall/widgets/ask/password_field.rb @@ -57,6 +57,8 @@ def value end # @macro seeAbstractWidget + # The ':notify' option is needed to notify the timer when the value changes. + # @see Y2Autoinstall::Widgets::Ask::Dialog::TimeoutWrapper def opt [:hstretch, :notify] end diff --git a/test/lib/autoinstall/ask/question_test.rb b/test/lib/autoinstall/ask/question_test.rb index abd30cc1c..58e768fa9 100644 --- a/test/lib/autoinstall/ask/question_test.rb +++ b/test/lib/autoinstall/ask/question_test.rb @@ -83,6 +83,15 @@ end end + context "when the question's type is 'static_text'" do + let(:type) { "static_text" } + + it "does not set the value" do + question.value = "1" + expect(question.value).to be_nil + end + end + context "when the question's type is not set" do subject(:question) do described_class.new("Question 1")