Changeset 3140

Show
Ignore:
Timestamp:
01/28/07 22:42:07 (18 years ago)
Author:
jerome
Message:

When several instances of PostgreSQL were installed, pksetup failed
to modify the correct configuration files. This fixes this problem
by asking for each PostgreSQL configuration directory found if this
is the one to modify or not.

Location:
pykota/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/bin/pksetup

    r3133 r3140  
    300300    def configurePostgreSQL(self) : 
    301301        """Configures PostgreSQL for PyKota to work.""" 
    302         pgconffile = self.confirmPipe("to find PostgreSQL's configuration files", "find /etc -name postgresql.conf 2>/dev/null") 
    303         if pgconffile is not False : 
    304             pgconffile = pgconffile.strip() 
    305             pgconfdir = os.path.split(pgconffile)[0] 
    306             answer = self.confirmPipe("to see if PostgreSQL accepts TCP/IP connections", "grep ^tcpip_socket %(pgconffile)s" % locals()) 
    307             conflines = pghbaconf.split("\n") 
    308             if answer is not False : 
    309                 tcpip = answer.strip().lower().endswith("true") 
    310             else :     
    311                 tcpip = False 
    312             if tcpip :     
    313                 conflines.insert(2, "host\tpykota\tpykotaadmin,pykotauser\t127.0.0.1\t255.255.255.255\tmd5") 
    314             else : 
    315                 conflines.insert(1, "local\tpykota\tpykotaadmin,pykotauser\t\tmd5") 
    316             conf = "\n".join(conflines) 
    317             self.confirmCommand("to configure PostgreSQL correctly for PyKota", 'echo "%(conf)s" >%(pgconfdir)s/pg_hba.conf' % locals()) 
    318             self.confirmCommand("to make PostgreSQL take the changes into account", self.pgrestart) 
    319             return tcpip 
     302        pgconffiles = self.confirmPipe("to find PostgreSQL's configuration files", "find /etc -name postgresql.conf 2>/dev/null") 
     303        if pgconffiles is not False : 
     304            pgconffiles = [part.strip() for part in pgconffiles.split()] 
     305            pgconfdirs = [os.path.split(pgconffile)[0] for pgconffile in pgconffiles] 
     306            for i in range(len(pgconfdirs)) : 
     307                pgconfdir = pgconfdirs[i] 
     308                pgconffile = pgconffiles[i] 
     309                if (len(pgconfdirs) == 1) or self.yesno("Do PostgreSQL configuration files reside in %(pgconfdir)s" % locals()) : 
     310                    answer = self.confirmPipe("to see if PostgreSQL accepts TCP/IP connections", "grep ^tcpip_socket %(pgconffile)s" % locals()) 
     311                    conflines = pghbaconf.split("\n") 
     312                    if answer is not False : 
     313                        tcpip = answer.strip().lower().endswith("true") 
     314                    else :     
     315                        tcpip = False 
     316                    if tcpip :     
     317                        conflines.insert(2, "host\tpykota\tpykotaadmin,pykotauser\t127.0.0.1\t255.255.255.255\tmd5") 
     318                    else : 
     319                        conflines.insert(1, "local\tpykota\tpykotaadmin,pykotauser\t\tmd5") 
     320                    conf = "\n".join(conflines) 
     321                    self.confirmCommand("to configure PostgreSQL correctly for PyKota", 'echo "%(conf)s" >%(pgconfdir)s/pg_hba.conf' % locals()) 
     322                    self.confirmCommand("to make PostgreSQL take the changes into account", self.pgrestart) 
     323                    return tcpip 
    320324        return None     
    321325         
  • pykota/trunk/NEWS

    r3136 r3140  
    2424    - 1.26alpha2 (2007-01-18) : 
    2525     
     26        - Fixed a problem with pksetup when several instances of PostgreSQL 
     27          were installed. 
     28           
     29        - Fixed a failure in edpykota to cleanly delete non existing entries. 
     30         
    2631        - Fixed email headers. 
    2732