Mailinglist Archive: yast-devel (233 mails)

< Previous Next >
[yast-devel] Re: [yast-commit] <rest-service> master : treat absence of eulas.yml as blank eulas list (==all eulas are accepted)
  • From: Josef Reidinger <jreidinger@xxxxxxx>
  • Date: Tue, 20 Oct 2009 16:50:34 +0200
  • Message-id: <200910201650.34440.jreidinger@xxxxxxx>
Martin Kudlvasr write:
ref: refs/heads/master
commit 0e1503bd595f3058177385cb222914cfb6ac9466
Author: Martin Kudlvasr <mkudlvasr@xxxxxxx>
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.html

) 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@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages