diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Client/Frame.py | 14 | ||||
-rw-r--r-- | src/lib/Client/Tools/APT.py | 19 |
2 files changed, 24 insertions, 9 deletions
diff --git a/src/lib/Client/Frame.py b/src/lib/Client/Frame.py index b9fabc0ab..95544f8b9 100644 --- a/src/lib/Client/Frame.py +++ b/src/lib/Client/Frame.py @@ -108,6 +108,20 @@ class Frame: except: self.logger.error("Unexpected tool failure", exc_info=1) + for cfile in [cfl for cfl in config.findall(".//Path[@type='file']") \ + if cfl.get('name') in self.__important__]: + tl = [t for t in self.tools if t.handlesEntry(cfile) \ + and t.canVerify(cfile)] + if tl: + if not tl[0].VerifyPath(cfile, []): + if self.setup['interactive'] and not \ + promptFilter("Install %s: %s? (y/N):", [cfile]): + continue + try: + self.states[cfile] = tl[0].InstallPath(cfile) + except: + self.logger.error("Unexpected tool failure", + exc_info=1) # find entries not handled by any tools problems = [entry for struct in config for \ entry in struct if entry not in self.handled] diff --git a/src/lib/Client/Tools/APT.py b/src/lib/Client/Tools/APT.py index f44690e8a..082e51ef6 100644 --- a/src/lib/Client/Tools/APT.py +++ b/src/lib/Client/Tools/APT.py @@ -31,12 +31,6 @@ class APT(Bcfg2.Client.Tools.Tool): the rest from Toolset.Toolset''' name = 'APT' __execs__ = [DEBSUMS, APTGET, DPKG] - __important__ = ["%s/apt/sources.list" % etc_path, - "%s/cache/debconf/config.dat" % var_path, - "%s/cache/debconf/templates.dat" % var_path, - '/etc/passwd', '/etc/group', - '%s/apt/apt.conf' % etc_path, - '%s/dpkg/dpkg.cfg' % etc_path] __handles__ = [('Package', 'deb')] __req__ = {'Package': ['name', 'version']} pkgcmd = '%s ' % APTGET + \ @@ -47,9 +41,16 @@ class APT(Bcfg2.Client.Tools.Tool): '--force-yes ' + \ '-y install %s' - def __init__(self, logger, cfg, setup): - Bcfg2.Client.Tools.Tool.__init__(self, logger, cfg, setup) - self.cfg = cfg + def __init__(self, logger, setup, config): + Bcfg2.Client.Tools.Tool.__init__(self, logger, setup, config) + self.__important__ = ["%s/cache/debconf/config.dat" % var_path, + "%s/cache/debconf/templates.dat" % var_path, + '/etc/passwd', '/etc/group', + '%s/apt/apt.conf' % etc_path, + '%s/dpkg/dpkg.cfg' % etc_path] + \ + [entry.get('name') for struct in config for entry in struct \ + if entry.tag in ['Path', 'ConfigFile'] and \ + entry.get('name').startswith('%s/apt/sources.list' % etc_path)] os.environ["DEBIAN_FRONTEND"] = 'noninteractive' self.actions = {} if self.setup['kevlar'] and not self.setup['dryrun']: |