stderr("Query failed: %s. Defaulting to zone %s pod %s",str(e),confopts["zone"],confopts["pod"])
foropt,valinlist(confopts.items()):
line="=".join([opt,val])
ifoptnotinconfposes: lines.append(line)
else: lines[confposes[opt]] =line
text="\n".join(lines)
open(fn,"w").write(text)
# =========================== DATABASE MIGRATION SUPPORT CODE ===================
# Migrator, Migratee and Evolvers -- this is the generic infrastructure.
classMigratorException(Exception): pass
classNoMigrationPath(MigratorException): pass
classNoMigrator(MigratorException): pass
INITIAL_LEVEL='-'
classMigrator:
"""Migrator class.
The migrator gets a list of Python objects, and discovers MigrationSteps in it. It then sorts the steps into a chain, based on the attributes from_level and to_level in each one of the steps.
When the migrator's run(context) is called, the chain of steps is applied sequentially on the context supplied to run(), in the order of the chain of steps found at discovery time. See the documentation for the MigrationStep class for information on how that happens.
"""Runs each one of the steps in sequence, passing the migration context to each. At the end of the process, context.commit() is called to save the changes, or context.rollback() is called if dryrun = True.
If starting_level is not specified, then the context.get_schema_level() is used to find out at what level the context is at. Then starting_level is set to that.
If ending_level is not specified, then the evolvers will run till the end of the chain."""
assertdryrunisFalse# NOT IMPLEMENTED, prolly gonna implement by asking the context itself to remember its state