
import logging
from conary import dbstore
from mint.scripts.db2db import db2db


log = logging.getLogger(__name__)


def switchToPostgres(cfg):
    if cfg.dbDriver in ('postgresql', 'pgpool'):
        return

    sourceTuple = (cfg.dbDriver, cfg.dbPath)
    destTuple = ('postgresql', 'rbuilder@localhost:5439/mint')
    finalTuple = ('pgpool', 'rbuilder@localhost.localdomain:6432/mint')

    log.info("Migrating mint database from %s::%s to %s::%s",
            *(sourceTuple + destTuple))
    db2db.move_database(sourceTuple, destTuple)

    # Update rbuilder-generated.conf
    log.info("Changing configured mint database to %s::%s", *finalTuple)
    cfg.dbDriver = finalTuple[0]
    cfg.dbPath = finalTuple[1]
    cfg.writeGeneratedConfig()


import logging
from conary import dbstore
from mint.scripts.db2db import db2db


log = logging.getLogger(__name__)


def switchToPostgres(cfg):
    if cfg.dbDriver in ('postgresql', 'pgpool'):
        return

    sourceTuple = (cfg.dbDriver, cfg.dbPath)
    destTuple = ('postgresql', 'postgres@localhost:5439/mint')
    finalTuple = ('pgpool', 'postgres@localhost.localdomain:6432/mint')

    log.info("Migrating mint database from %s::%s to %s::%s",
            *(sourceTuple + destTuple))
    db2db.move_database(sourceTuple, destTuple)

    # Update rbuilder-generated.conf
    log.info("Changing configured mint database to %s::%s", *finalTuple)
    cfg.dbDriver = finalTuple[0]
    cfg.dbPath = finalTuple[1]
    cfg.writeGeneratedConfig()

Fix another use of the rbuilder postgres user
Fix another use of the rbuilder postgres user

  
  import logging
  from conary import dbstore
  from mint.scripts.db2db import db2db
  
  
  log = logging.getLogger(__name__)
  
  
  def switchToPostgres(cfg):
      if cfg.dbDriver in ('postgresql', 'pgpool'):
          return
  
      sourceTuple = (cfg.dbDriver, cfg.dbPath)
-     destTuple = ('postgresql', 'rbuilder@localhost:5439/mint')
+     destTuple = ('postgresql', 'postgres@localhost:5439/mint')
-     finalTuple = ('pgpool', 'rbuilder@localhost.localdomain:6432/mint')
+     finalTuple = ('pgpool', 'postgres@localhost.localdomain:6432/mint')
  
      log.info("Migrating mint database from %s::%s to %s::%s",
              *(sourceTuple + destTuple))
      db2db.move_database(sourceTuple, destTuple)
  
      # Update rbuilder-generated.conf
      log.info("Changing configured mint database to %s::%s", *finalTuple)
      cfg.dbDriver = finalTuple[0]
      cfg.dbPath = finalTuple[1]
      cfg.writeGeneratedConfig()
  
Fix another use of the rbuilder postgres user
## Code Before:

import logging
from conary import dbstore
from mint.scripts.db2db import db2db


log = logging.getLogger(__name__)


def switchToPostgres(cfg):
    if cfg.dbDriver in ('postgresql', 'pgpool'):
        return

    sourceTuple = (cfg.dbDriver, cfg.dbPath)
    destTuple = ('postgresql', 'rbuilder@localhost:5439/mint')
    finalTuple = ('pgpool', 'rbuilder@localhost.localdomain:6432/mint')

    log.info("Migrating mint database from %s::%s to %s::%s",
            *(sourceTuple + destTuple))
    db2db.move_database(sourceTuple, destTuple)

    # Update rbuilder-generated.conf
    log.info("Changing configured mint database to %s::%s", *finalTuple)
    cfg.dbDriver = finalTuple[0]
    cfg.dbPath = finalTuple[1]
    cfg.writeGeneratedConfig()

## Instruction:
Fix another use of the rbuilder postgres user
## Code After:

import logging
from conary import dbstore
from mint.scripts.db2db import db2db


log = logging.getLogger(__name__)


def switchToPostgres(cfg):
    if cfg.dbDriver in ('postgresql', 'pgpool'):
        return

    sourceTuple = (cfg.dbDriver, cfg.dbPath)
    destTuple = ('postgresql', 'postgres@localhost:5439/mint')
    finalTuple = ('pgpool', 'postgres@localhost.localdomain:6432/mint')

    log.info("Migrating mint database from %s::%s to %s::%s",
            *(sourceTuple + destTuple))
    db2db.move_database(sourceTuple, destTuple)

    # Update rbuilder-generated.conf
    log.info("Changing configured mint database to %s::%s", *finalTuple)
    cfg.dbDriver = finalTuple[0]
    cfg.dbPath = finalTuple[1]
    cfg.writeGeneratedConfig()
