Ticket #762: SYSV.py.patch
File SYSV.py.patch, 1.6 KB (added by ITS Systems Bcfg2 Team <[email protected]…>, 13 years ago) |
---|
-
SYSV.py
old new 31 31 32 32 def __init__(self, logger, setup, config): 33 33 Bcfg2.Client.Tools.PkgTool.__init__(self, logger, setup, config) 34 # noaskfile needs to live beyond __init__ otherwise file is removed 34 35 self.noaskfile = tempfile.NamedTemporaryFile() 35 36 self.noaskname = self.noaskfile.name 36 37 try: 37 38 self.noaskfile.write(noask) 39 # flush admin file contents to disk 40 self.noaskfile.flush() 38 41 self.pkgtool = (self.pkgtool[0] % ("-a %s" % (self.noaskname)), \ 39 42 self.pkgtool[1]) 40 43 except: … … 46 49 # Build list of packages 47 50 lines = self.cmd.run("/usr/bin/pkginfo -x")[1] 48 51 while lines: 49 version = lines.pop().split()[1] 52 # Splitting on whitespace means that packages with spaces in 53 # their version numbers don't work right. Found this with 54 # IBM TSM software with package versions like 55 # "Version 6 Release 1 Level 0.0" 56 # Should probably be done with a regex but this works. 57 version = lines.pop().split(') ')[1] 50 58 pkg = lines.pop().split()[0] 51 59 self.installed[pkg] = version 52 60 … … 59 67 desiredVersion = entry.get('version') 60 68 if desiredVersion == 'any': 61 69 desiredVersion = self.installed.get(entry.get('name'), desiredVersion) 62 70 63 71 cmdrc = self.cmd.run("/usr/bin/pkginfo -q -v \"%s\" %s" % \ 64 72 (desiredVersion, entry.get('name')))[0] 65 73