def run(self, args, unknown_args):
        assert args.action == 'migrate' or not args.no_stop, \
            "You can only use --no-stop with migrate"
        environment = get_environment(args.env_name)
        environment.create_generated_yml()

        migration = CouchMigration(environment, args.migration_plan)
        check_connection(migration.target_couch_config.get_control_node())
        if migration.separate_source_and_target:
            check_connection(migration.source_couch_config.get_control_node())

        ansible_context = AnsibleContext(args)
        if args.limit and args.action != 'clean':
            puts(
                color_notice(
                    'Ignoring --limit (it only applies to "clean" action).'))

        if args.action == 'describe':
            return describe(migration)

        if args.action == 'plan':
            return plan(migration)

        if args.action == 'migrate':
            return migrate(migration, ansible_context, args.skip_check,
                           args.no_stop)

        if args.action == 'commit':
            return commit(migration, ansible_context)

        if args.action == 'clean':
            return clean(migration, ansible_context, args.skip_check,
                         args.limit)
    def run(self, args, unknown_args):
        environment = get_environment(args.env_name)
        environment.create_generated_yml()

        migration = CouchMigration(environment, args.migration_plan)
        check_connection(migration.target_couch_config.get_control_node())
        if migration.separate_source_and_target:
            check_connection(migration.source_couch_config.get_control_node())

        ansible_context = AnsibleContext(args)

        if args.action == 'describe':
            return describe(migration)

        if args.action == 'plan':
            return plan(migration)

        if args.action == 'migrate':
            return migrate(migration, ansible_context, args.skip_check)

        if args.action == 'commit':
            return commit(migration)

        if args.actoin == 'clean':
            return clean(migration, ansible_context, args.skip_check)
Exemple #3
0
def _get_migration(plan_name):
    plan_path = os.path.join(PLANS_DIR, plan_name, 'plan.yml')
    migration = CouchMigration(get_environment('env1'), plan_path)
    return migration