summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2004-10-27 18:43:14 +0000
committerNarayan Desai <desai@mcs.anl.gov>2004-10-27 18:43:14 +0000
commitba337edbea6a960d65b1f51602ce786835f7064e (patch)
tree454f6f879068dfc874f5bad75550ab0b53a5ee84 /src
parenta1e655a987bee4dde768f3b0974bb77cb5c5b723 (diff)
downloadbcfg2-ba337edbea6a960d65b1f51602ce786835f7064e.tar.gz
bcfg2-ba337edbea6a960d65b1f51602ce786835f7064e.tar.bz2
bcfg2-ba337edbea6a960d65b1f51602ce786835f7064e.zip
fix call
2004/10/27 11:07:54-05:00 anl.gov!desai uniform debug support (Logical change 1.119) git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@527 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r--src/lib/Client/Debian.py71
1 files changed, 40 insertions, 31 deletions
diff --git a/src/lib/Client/Debian.py b/src/lib/Client/Debian.py
index a85feb086..f94937f07 100644
--- a/src/lib/Client/Debian.py
+++ b/src/lib/Client/Debian.py
@@ -56,8 +56,7 @@ class Debian(Toolset):
def InstallService(self, entry):
'''Install Service for entry'''
- if self.setup['verbose']:
- print "Installing Service %s" % (entry.get('name'))
+ self.CondPrint('verbose', "Installing Service %s" % (entry.get('name')))
if entry.attrib['status'] == 'off':
if self.setup['dryrun']:
print "Disabling service %s" % (entry.get('name'))
@@ -101,7 +100,7 @@ class Debian(Toolset):
def Inventory(self):
'''Inventory system status'''
- print "In Inventory::"
+ self.CondPrint('verbose', "Inventorying system...")
Toolset.Inventory(self)
self.pkgwork = {'add':[], 'update':[], 'remove':[]}
all = deepcopy(self.installed)
@@ -126,7 +125,7 @@ class Debian(Toolset):
def Install(self):
'''Correct detected misconfigurations'''
- print "Installing"
+ self.CondPrint("verbose", "Installing needed configuration changes")
cmd = "apt-get --reinstall -q=2 -y install %s"
print "Need to remove:", self.pkgwork['remove']
self.setup['quick'] = True
@@ -141,44 +140,54 @@ class Debian(Toolset):
count = 1
while ((0 < left < old) and (count < 20)):
- if self.setup['verbose']:
- print "Starting Pass: %s" % (count)
- print "%s new, %s update, %s remove" % (len(self.pkgwork['add']),
- len(self.pkgwork['update']), len(self.pkgwork['remove']))
+ self.CondPrint('verbose', "Starting pass %s" % (count))
+ self.CondPrint("verbose", "%s Entries left" % (len(work)))
+ self.CondPrint('verbose', "%s new, %s update, %s remove" %
+ (len(self.pkgwork['add']), len(self.pkgwork['update']),
+ len(self.pkgwork['remove'])))
+
count = count + 1
old = left
- packages = [pkg for pkg in work if pkg.tag == 'Package']
+ self.CondPrint("verbose", "Installing Non Package entries")
for nonpkg in [ent for ent in work if ent.tag != 'Package']:
self.InstallEntry(nonpkg)
if self.states[nonpkg]:
work.remove(nonpkg)
-
- # try single large install
- cmdrc = system(cmd % " ".join(["%s=%s" % (pkg.get('name'), pkg.get('version', 'dummy'))
- for pkg in packages]))
-
- if cmdrc == 0:
- # set all states to true and flush workqueues
- for pkg in packages:
- self.states[pkg] = True
- work.remove(pkg)
- self.Refresh()
- else:
- # do single pass installs
- system("dpkg --configure --pending")
- self.Refresh()
- for pkg in packages:
- # handle state tracking updates
- if self.VerifyPackage(pkg):
+
+ packages = [pkg for pkg in work if pkg.tag == 'Package']
+ if packages:
+ # try single large install
+ self.CondPrint("verbose", "Trying single pass package install")
+ cmdrc = system(cmd % " ".join(["%s=%s" % (pkg.get('name'), pkg.get('version', 'dummy'))
+ for pkg in packages]))
+
+ if cmdrc == 0:
+ self.CondPrint('verbose', "Single Pass Succeded")
+ # set all states to true and flush workqueues
+ for pkg in packages:
self.states[pkg] = True
work.remove(pkg)
- else:
- cmdrc = system(cmd % ("%s=%s" % (pkg.get('name'), pkg.get('version'))))
- if cmdrc == 0:
+ self.Refresh()
+ else:
+ self.CondPrint("verbose", "Single Pass Failed")
+ # do single pass installs
+ system("dpkg --configure --pending")
+ self.Refresh()
+ for pkg in packages:
+ # handle state tracking updates
+ if self.VerifyPackage(pkg):
+ self.CondPrint("verbose", "Forcing state to true for pkg %s" % (pkg.get('name')))
self.states[pkg] = True
work.remove(pkg)
else:
- print "Failed to install package %s" % (pkg.get('name'))
+ self.CondPrint("verbose", "Installing pkg %s version %s" %
+ (pkg.get('name'), pkg.get('version')))
+ cmdrc = system(cmd % ("%s=%s" % (pkg.get('name'), pkg.get('version'))))
+ if cmdrc == 0:
+ self.states[pkg] = True
+ work.remove(pkg)
+ else:
+ self.CondPrint('verbose', "Failed to install package %s" % (pkg.get('name')))
left = len(work)