On Monday 19 October 2009 14:56:35 Klaus Kaempf wrote:
> * Martin Vidner <[email protected]> [Oct 16. 2009 15:12]:
> > Here is a patch that I am not sure is right, so it is not committed.
> > If I use this, it is still broken, and every controller says:
> >
> > You must accept all EULAs before using this product!
> > Accept End User Licence Agreement
> > All licenses have already been accepted
> > OK
> >
> > >From a4d3a161f6691e1d50bc311c4cea6d86fc8f6a2e Mon Sep 17 00:00:00 2001
> >
> > From: Martin Vidner <[email protected]>
> > Date: Fri, 16 Oct 2009 15:07:14 +0200
> > Subject: [PATCH] Attempting to fix the eula code if the config specifies
> > no licenses.
> >
> > Like
> > echo "licenses:" >/etc/YaST2/eula.yml
> > ---
> > plugins/eulas/app/models/license.rb | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/plugins/eulas/app/models/license.rb
> > b/plugins/eulas/app/models/license.rb index fe2003b..be94037 100644
> > --- a/plugins/eulas/app/models/license.rb
> > +++ b/plugins/eulas/app/models/license.rb
> > @@ -71,7 +71,7 @@ class License
> > def self.license_names
> > config = YaST::ConfigFile.new(:eula)
> > begin
> > - config["licenses"]
> > + config["licenses"] || []
> > rescue Exception => e
> > raise CorruptedFileException.new config.path
> > end
>
> Hmm, the begin..rescue..end encloses accessing the config hash only. I
> guess it should catch YaST::ConfigFile.new exceptions also ?!
Ok, if we want to treat non-existing/corrupted eulas.yml as blank licenses
list.
The main problem fix:
def self.all_accepted?
- find_all.collect{|license| license.accepted}.inject{|a,b| a and b}
+ find_all.collect{|license| license.accepted}.inject(true){|a,b| a and b}
end
absence of default value in inject + blank list = problem.
Martin
>
> Klaus
>
> ---
> SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)
>
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]