selinon.migrations.migrator module

Migration of configuration files.

class selinon.migrations.migrator.Migrator(migration_dir=None)[source]

Bases: object

Main class for performing configuration file migrations.

create_migration_file(old_nodes_definition_path, old_flow_definitions_path, new_nodes_definition_path, new_flow_definitions_path, tainted_flow_strategy, add_meta=True)[source]

Generate migration of configuration files, store output in the migration directory.

Parameters:
  • old_nodes_definition_path (str) – a path to old nodes.yaml
  • old_flow_definitions_path (list) – a list of paths to old flow definition files
  • new_nodes_definition_path (str) – a path to new nodes.yaml
  • new_flow_definitions_path (list) – a list of paths to new flow definition files
  • tainted_flow_strategy (selinon.migrator.tainted_flow_strategy.TaintedFlowStrategy) – flow strategy for tainted flows
  • add_meta (bool) – add metadata information
Returns:

a path to newly created migration file

perform_migration(flow_name, state, migration_version)[source]

Perform actual migration based on message received.

Parameters:
  • flow_name – name of flow for which the migration is performed
  • state – state for which migration is present
  • migration_version – migration version that was used previously
Returns:

migrated message with current migration version and information about tainting flow

Return type:

tuple