[yast-devel] Re: [yast-commit] <rest-service> master : treat absence of eulas.yml as blank eulas list (==all eulas are accepted)

Martin Kudlvasr write:
ref: refs/heads/master commit 0e1503bd595f3058177385cb222914cfb6ac9466 Author: Martin Kudlvasr <mkudlvasr@suse.cz> Date: Tue Oct 20 16:10:11 2009 +0200
treat absence of eulas.yml as blank eulas list (==all eulas are accepted) and corruption of eulas.yml as error --- plugins/eulas/app/models/license.rb | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/plugins/eulas/app/models/license.rb b/plugins/eulas/app/models/license.rb index 319a533..b6c393b 100644 --- a/plugins/eulas/app/models/license.rb +++ b/plugins/eulas/app/models/license.rb @@ -71,11 +71,13 @@ class License end
def self.license_names + config = YaST::ConfigFile.new(:eulas) begin - config = YaST::ConfigFile.new(:eulas)
Yes, you can move it outside of begin as initialize doesn't throw exception. But how you know it? I think that it is not from documentation( http://w3.suse.de/~jreidinger/webservice/webservice/classes/YaST/ConfigFile.... ) so I suggest that you can improve it (document which method throw exceptions).
config["licenses"] || [] - rescue Exception => e + rescue YaST::ConfigFile::NotFoundError [] # treat absense or corruption of eulas.yml as "no eulas" + rescue Exception + raise CorruptedFileException.new config.path end end
-- Josef Reidinger YaST team maintainer of perl-Bootloader, YaST2-Repair, webyast modules language and time -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
participants (1)
-
Josef Reidinger