-def keep_table_columns(schema, table_name, columns):
- table = schema.tables.get(table_name)
- if not table:
- raise error.Error("schema has no %s table" % table_name)
-
- new_columns = {}
- for column_name in columns:
- column = table.columns.get(column_name)
- if not column:
- raise error.Error("%s table schema lacks %s column"
- % (table_name, column_name))
- new_columns[column_name] = column
- table.columns = new_columns
- return table
-
-
-def prune_schema(schema):
- new_tables = {}
- new_tables["Bridge"] = keep_table_columns(
- schema, "Bridge", ("name", "external_ids", "other_config",
- "fail_mode"))
- new_tables["Interface"] = keep_table_columns(
- schema, "Interface", ("name", "external_ids"))
- schema.tables = new_tables
-
-
-def handler(signum, _):
- global force_run
- if (signum == signal.SIGHUP):
- force_run = True
-
-