From 56f89e7ed1b64e424e8d8e65695549e14b40a2f3 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Thu, 24 Jan 2013 03:07:06 +0100 Subject: Client: allow pre-Actions and important-Paths to enable installs This is used to first update the apt repositories and than install all current versions in one bcfg2-run. Also the installation of software from custom repositories (that are configured on the client via bcfg2) should be possible on the first run. --- src/lib/Client/Frame.py | 23 +++++++++++++++-------- src/lib/Client/Tools/APT.py | 5 +++++ 2 files changed, 20 insertions(+), 8 deletions(-) (limited to 'src/lib/Client') diff --git a/src/lib/Client/Frame.py b/src/lib/Client/Frame.py index d17f70f1b..5826b36e8 100644 --- a/src/lib/Client/Frame.py +++ b/src/lib/Client/Frame.py @@ -162,14 +162,8 @@ class Frame: return self.__dict__[name] raise AttributeError(name) - def InstallImportant(self): - """Install important entries - - We also process the decision mode stuff here because we want to prevent - non-whitelisted/blacklisted 'important' entries from being installed - prior to determining the decision mode on the client. - """ - # Need to process decision stuff early so that dryrun mode works with it + def GenerateActions(self): + """Generate list of all entries that have to be handled""" self.whitelist = [entry for entry in self.states \ if not self.states[entry]] if not self.setup['file']: @@ -190,6 +184,16 @@ class Frame: self.logger.info(["%s:%s" % (e.tag, e.get('name')) for e in b_to_rem]) self.whitelist = [x for x in self.whitelist if x not in b_to_rem] + def InstallImportant(self): + """Install important entries + + We also process the decision mode stuff here because we want to prevent + non-whitelisted/blacklisted 'important' entries from being installed + prior to determining the decision mode on the client. + """ + # Need to process decision stuff early so that dryrun mode works with it + self.GenerateActions() + # take care of important entries first if not self.dryrun and not self.setup['bundle']: for cfile in [cfl for cfl in self.config.findall(".//Path") \ @@ -411,6 +415,9 @@ class Frame: self.CondDisplayState('initial') self.InstallImportant() self.Decide() + if self.modified: + self.Inventory() + self.GenerateActions() self.Install() self.times['install'] = time.time() self.Remove() diff --git a/src/lib/Client/Tools/APT.py b/src/lib/Client/Tools/APT.py index dc6c9e6aa..156c86a2b 100644 --- a/src/lib/Client/Tools/APT.py +++ b/src/lib/Client/Tools/APT.py @@ -113,6 +113,11 @@ class APT(Bcfg2.Client.Tools.Tool): type='deb', version=version) \ for (name, version) in extras] + def Inventory(self, states, structures=[]): + # reload pkg cache + self.pkg_cache.open(None) + Bcfg2.Client.Tools.Tool.Inventory(self, states, structures) + def VerifyDebsums(self, entry, modlist): output = self.cmd.run("%s -as %s" % (DEBSUMS, entry.get('name')))[1] if len(output) == 1 and "no md5sums for" in output[0]: -- cgit v1.2.3-1-g7c22