ref: refs/heads/master
commit 3498cb7e786fe3ddcbd2b68b23425c10e6be9d49
Author: Klaus Kämpf
Date: Sat Sep 26 15:23:49 2009 +0200
Make basesystem.yml optional (bnc#542445)
Additionally, don't make assumptions on how YaST::ConfigFile assembles
the file name.
---
.../app/controllers/basesystem_controller.rb | 1 +
plugins/basesystem/app/models/basesystem.rb | 13 +++++++++----
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/plugins/basesystem/app/controllers/basesystem_controller.rb b/plugins/basesystem/app/controllers/basesystem_controller.rb
index cb02903..d50192d 100644
--- a/plugins/basesystem/app/controllers/basesystem_controller.rb
+++ b/plugins/basesystem/app/controllers/basesystem_controller.rb
@@ -7,6 +7,7 @@ class BasesystemController < ApplicationController
def show
@basesystem = Basesystem.find
+ logger.warn "No steps defined for Basesystem" if @basesystem.steps.nil? or @basesystem.steps.empty?
logger.debug @basesystem.inspect
end
diff --git a/plugins/basesystem/app/models/basesystem.rb b/plugins/basesystem/app/models/basesystem.rb
index 666f971..e560d58 100644
--- a/plugins/basesystem/app/models/basesystem.rb
+++ b/plugins/basesystem/app/models/basesystem.rb
@@ -26,10 +26,15 @@ class Basesystem
def Basesystem.find
base = Basesystem.new
base.finish = File.exist?(FINISH_FILE)
- begin
- base.steps = YaST::ConfigFile.new(BASESYSTEM_CONF)["steps"] || []
- rescue Exception => e
- raise CorruptedFileException.new(File.join YaST::ConfigFile.config_default_location, "#{BASESYSTEM_CONF.to_s}.yml")
+ config = YaST::ConfigFile.new(BASESYSTEM_CONF)
+ if File.exist?(config.path)
+ begin
+ base.steps = config["steps"] || []
+ rescue Exception => e
+ raise CorruptedFileException.new(config.path)
+ end
+ else
+ base.steps = []
end
return base
end
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org