summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2013-01-24 03:07:06 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2013-06-28 16:50:45 +0200
commitf07ee312d54473b5ec0c356c34dad654505d507a (patch)
treed5d5338de7735cb8d4cd6ecdee7469cb8fff98eb
parent85dece45b093ef4d78706ab0780ef5dc888e5833 (diff)
downloadbcfg2-f07ee312d54473b5ec0c356c34dad654505d507a.tar.gz
bcfg2-f07ee312d54473b5ec0c356c34dad654505d507a.tar.bz2
bcfg2-f07ee312d54473b5ec0c356c34dad654505d507a.zip
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.
-rw-r--r--src/lib/Bcfg2/Client/Frame.py25
-rw-r--r--src/lib/Bcfg2/Client/Tools/APT.py5
2 files changed, 21 insertions, 9 deletions
diff --git a/src/lib/Bcfg2/Client/Frame.py b/src/lib/Bcfg2/Client/Frame.py
index 6bef77081..2db53bbcf 100644
--- a/src/lib/Bcfg2/Client/Frame.py
+++ b/src/lib/Bcfg2/Client/Frame.py
@@ -170,15 +170,8 @@ class Frame(object):
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']:
@@ -205,6 +198,17 @@ class Frame(object):
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:
for parent in self.config.findall(".//Path/.."):
@@ -484,6 +488,9 @@ class Frame(object):
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/Bcfg2/Client/Tools/APT.py b/src/lib/Bcfg2/Client/Tools/APT.py
index 420fad7df..825fcf22f 100644
--- a/src/lib/Bcfg2/Client/Tools/APT.py
+++ b/src/lib/Bcfg2/Client/Tools/APT.py
@@ -106,6 +106,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" %