From c7ba9fa40aa7a1c5abaa1b7e88f8648d52437847 Mon Sep 17 00:00:00 2001 From: Mike Hiretsky Date: Tue, 16 Oct 2012 09:55:03 +0400 Subject: [PATCH] Fix for update 3.0->3.1 --- calculate/lib/datavars.py | 19 ++++++++++++++----- calculate/lib/variables/env.py | 3 +++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/calculate/lib/datavars.py b/calculate/lib/datavars.py index 76a7e31..19ed9f9 100644 --- a/calculate/lib/datavars.py +++ b/calculate/lib/datavars.py @@ -753,6 +753,14 @@ class DataVars: return False def importData(self,data=None): + """ + Depricated function for support 3.0 utilities + """ + section = self.importVariables() + if data: + self.defaultModule = section + + def importVariables(self,data=None): """ Import modules for variables. 'section' is section name, 'modList' contains tuple with modules which discribe variable names and fill @@ -786,6 +794,7 @@ class DataVars: if not varName in self.allVars: self.allVars[varName] = (section,varObj) self.importedModules.append(section) + return section def raiseVariableNotFound(self,varname,*args,**kwargs): raise DataVarsError(_("Variable %s not found")%varname) @@ -800,9 +809,9 @@ class DataVars: Initialize variable 'varname' from fillObj and varObj. """ if not self.allVars: - self.importData() + self.importVariables() if section and not section in self.importedModules: - self.importData("calculate.%s.variables"%section) + self.importVariables("calculate.%s.variables"%section) self.flIniFile(onlySection=section) if not varname in self.loadVariables: if varname in self.allVars.keys(): @@ -842,7 +851,7 @@ class DataVars: self.getIniVar('install.os_install_net_settings') self.getIniVar('cl_action') """ - calculateIniFiles = self.Get('cl_env_path') + calculateIniFiles = self.Get('main.cl_env_path') section, dot, varname = fullVarName.rpartition('.') if not section: section = "main" @@ -890,7 +899,7 @@ class DataVars: Read variable values from ini files. Return False if ini file is invalid. """ - calculateIniFiles = self.Get('cl_env_data') + calculateIniFiles = self.Get('main.cl_env_data') # get initialized section names sections = set(map(lambda x:unicode(x[0]),self.allVars.values())) res = True @@ -1099,7 +1108,7 @@ class DataVars: where='cl_env_location', eq=location,limit=1) if calculateIniFile: - return pathJoin(self.Get('cl_chroot_path'),calculateIniFile) + return pathJoin(self.Get('main.cl_chroot_path'),calculateIniFile) else: return False diff --git a/calculate/lib/variables/env.py b/calculate/lib/variables/env.py index d5c003f..66be65f 100644 --- a/calculate/lib/variables/env.py +++ b/calculate/lib/variables/env.py @@ -177,6 +177,9 @@ class VariableClMerges(Variable): pass return [] + def set(self): + return [] + class VariableClAutoupdateSet(Variable): """ (on or off) autoupdate config from install program