Ticket #762: SYSV.py.patch

File SYSV.py.patch, 1.6 KB (added by ITS Systems Bcfg2 Team <[email protected]…>, 13 years ago)

Patch for SYSV.py

  • SYSV.py

    old new  
    3131 
    3232    def __init__(self, logger, setup, config): 
    3333        Bcfg2.Client.Tools.PkgTool.__init__(self, logger, setup, config) 
     34        # noaskfile needs to live beyond __init__ otherwise file is removed 
    3435        self.noaskfile = tempfile.NamedTemporaryFile() 
    3536        self.noaskname = self.noaskfile.name 
    3637        try: 
    3738            self.noaskfile.write(noask) 
     39            # flush admin file contents to disk  
     40            self.noaskfile.flush() 
    3841            self.pkgtool = (self.pkgtool[0] % ("-a %s" % (self.noaskname)), \ 
    3942                            self.pkgtool[1]) 
    4043        except: 
     
    4649        # Build list of packages 
    4750        lines = self.cmd.run("/usr/bin/pkginfo -x")[1] 
    4851        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] 
    5058            pkg = lines.pop().split()[0] 
    5159            self.installed[pkg] = version 
    5260 
     
    5967        desiredVersion = entry.get('version') 
    6068        if desiredVersion == 'any': 
    6169            desiredVersion = self.installed.get(entry.get('name'), desiredVersion) 
    62  
     70         
    6371        cmdrc = self.cmd.run("/usr/bin/pkginfo -q -v \"%s\" %s" % \ 
    6472                             (desiredVersion, entry.get('name')))[0] 
    6573