Migration from 1.2 to 2.1.3 fails


#1

Tried to migrate from v1.2 to v2.1.3 and I received the following error.
I would appreciate your help.

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/opt/indico/.venv/bin/indico-migrate in <module>()
      9 if __name__ == '__main__':
     10     sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
---> 11     sys.exit(main())
        global sys.exit = <built-in function exit>
        global main = <function main at 0x7fbbe96aa5f0>

/opt/indico/.venv/lib/python2.7/site-packages/indico_migrate/cli.pyc in main()
    124
    125 def main():
--> 126     return cli()
        global cli = <click.core.Command object at 0x7fbbe96ac8d0>

/opt/indico/.venv/lib/python2.7/site-packages/click/core.pyc in __call__(self=<click.core.Command object>, *args=(), **kwargs={})
    720     def __call__(self, *args, **kwargs):
    721         """Alias for :meth:`main`."""
--> 722         return self.main(*args, **kwargs)
        self.main = <bound method Command.main of <click.core.Command object at 0x7fbbe96ac8d0>>
        args = ()
        kwargs = {}
    723
    724

/opt/indico/.venv/lib/python2.7/site-packages/click/core.pyc in main(self=<click.core.Command object>, args=[], prog_name=u'indico-migrate', complete_var=None, standalone_mode=True, **extra={})
    695             try:
    696                 with self.make_context(prog_name, args, **extra) as ctx:
--> 697                     rv = self.invoke(ctx)
        rv = undefined
        self.invoke = <bound method Command.invoke of <click.core.Command object at 0x7fbbe96ac8d0>>
        ctx = <click.core.Context object at 0x7fbbe96ac990>
    698                     if not standalone_mode:
    699                         return rv

/opt/indico/.venv/lib/python2.7/site-packages/click/core.pyc in invoke(self=<click.core.Command object>, ctx=<click.core.Context object>)
    893         """
    894         if self.callback is not None:
--> 895             return ctx.invoke(self.callback, **ctx.params)
        ctx.invoke = <bound method Context.invoke of <click.core.Context object at 0x7fbbe96ac990>>
        self.callback = <function cli at 0x7fbbe96b01b8>
        ctx.params = {u'verbose': True, u'ldap_provider_name': u'ldap', u'photo_path': None, u'reference_types': (), u'default_currency': u'USD', u'zodb_uri': u'file:///opt/indico-legacy/db/Data.fs', u'symlink_target': u'/opt/indico/archive/legacy_symlinks/', u'system_user_id': None, u'restore_file': None, u'archive_dir': (u'/opt/indico/legacy-archive/',), u'default_group_provider': u'fnal-ldap', u'ignore_local_accounts': False, u'avoid_storage_check': True, u'rb_zodb_uri': None, u'migrate_broken_events': True, u'storage_backend': u'legacy', u'default_email': u'penelope@fnal.gov', u'no_gui': True, u'save_restore': None, u'sqlalchemy_uri': u'postgresql://indico:klf55so@cdpgsdev.fnal.gov:5487/indico', u'symlink_backend': u'legacy-symlinks', u'debug': True, u'dblog': True}
    896
    897

/opt/indico/.venv/lib/python2.7/site-packages/click/core.pyc in invoke(*args=(), **kwargs={u'archive_dir': (u'/opt/indico/legacy-archive/',), u'avoid_storage_check': True, u'dblog': True, u'debug': True, u'default_currency': u'USD', u'default_email': u'penelope@fnal.gov', u'default_group_provider': u'fnal-ldap', u'ignore_local_accounts': False, u'ldap_provider_name': u'ldap', u'migrate_broken_events': True, ...})
    533         with augment_usage_errors(self):
    534             with ctx:
--> 535                 return callback(*args, **kwargs)
        callback = <function cli at 0x7fbbe96b01b8>
        args = ()
        kwargs = {u'verbose': True, u'symlink_backend': u'legacy-symlinks', u'photo_path': None, u'reference_types': (), u'restore_file': None, u'zodb_uri': u'file:///opt/indico-legacy/db/Data.fs', u'symlink_target': u'/opt/indico/archive/legacy_symlinks/', u'avoid_storage_check': True, u'default_currency': u'USD', u'archive_dir': (u'/opt/indico/legacy-archive/',), u'ldap_provider_name': u'ldap', u'ignore_local_accounts': False, u'system_user_id': None, u'rb_zodb_uri': None, u'migrate_broken_events': True, u'storage_backend': u'legacy', u'default_email': u'penelope@fnal.gov', u'default_group_provider': u'fnal-ldap', u'no_gui': True, u'save_restore': None, u'sqlalchemy_uri': u'postgresql://indico:klf55so@cdpgsdev.fnal.gov:5487/indico', u'debug': True, u'dblog': True}
    536
    537     def forward(*args, **kwargs):

/opt/indico/.venv/lib/python2.7/site-packages/indico_migrate/cli.pyc in cli(sqlalchemy_uri=u'postgresql://indico:klf55so@cdpgsdev.fnal.gov:5487/indico', zodb_uri=u'file:///opt/indico-legacy/db/Data.fs', rb_zodb_uri=None, verbose=True, dblog=True, debug=True, restore_file=None, no_gui=True, **kwargs={u'archive_dir': (u'/opt/indico/legacy-archive/',), u'avoid_storage_check': True, u'default_currency': u'USD', u'default_email': u'penelope@fnal.gov', u'default_group_provider': u'fnal-ldap', u'ignore_local_accounts': False, u'ldap_provider_name': u'ldap', u'migrate_broken_events': True, u'photo_path': None, u'reference_types': (), ...})
    120
    121     migrate(logger, zodb_root, rb_zodb_uri, sqlalchemy_uri, verbose=verbose, dblog=dblog, restore_file=restore_file,
--> 122             debug=debug, **kwargs)
        debug = True
        kwargs = {u'save_restore': None, u'ldap_provider_name': u'ldap', u'ignore_local_accounts': False, u'symlink_target': u'/opt/indico/archive/legacy_symlinks/', u'system_user_id': None, u'migrate_broken_events': True, u'symlink_backend': u'legacy-symlinks', u'photo_path': None, u'storage_backend': u'legacy', u'avoid_storage_check': True, u'reference_types': (), u'default_email': u'penelope@fnal.gov', u'archive_dir': (u'/opt/indico/legacy-archive/',), u'default_group_provider': u'fnal-ldap', u'default_currency': u'USD'}
    123
    124

/opt/indico/.venv/lib/python2.7/site-packages/indico_migrate/migrate.pyc in migrate(logger=<indico_migrate.logger.StdoutLogger object>, zodb_root={'conferences': <BTrees.OOBTree.OOBTree object a...BTrees.OOBTree.OOBTree object at 0x7fbbe4d0f750>}, zodb_rb_uri=None, sqlalchemy_uri=u'postgresql://indico:klf55so@cdpgsdev.fnal.gov:5487/indico', verbose=True, dblog=True, restore_file=None, **kwargs={u'archive_dir': (u'/opt/indico/legacy-archive/',), u'avoid_storage_check': True, 'debug': True, u'default_currency': u'USD', u'default_email': u'penelope@fnal.gov', u'ignore_local_accounts': False, u'ldap_provider_name': u'ldap', u'migrate_broken_events': True, u'photo_path': None, u'reference_types': (), ...})
    104                 else:
    105                     step(logger, app, sqlalchemy_uri, zodb_root, verbose, dblog, default_group_provider, tz,
--> 106                          **kwargs).run()
        kwargs.run = undefined
    107                 MigrationStateManager.register_step(step)
    108             logger.set_success()

/opt/indico/.venv/lib/python2.7/site-packages/indico_migrate/importer.pyc in run(self=<CategoryImporter(postgresql://indico:klf55so@cdpgsdev.fnal.gov:5487/indico)>)
    159         self.pre_migrate()
    160         try:
--> 161             self.migrate()
        self.migrate = <bound method CategoryImporter.migrate of <CategoryImporter(postgresql://indico:klf55so@cdpgsdev.fnal.gov:5487/indico)>>
    162         finally:
    163             self.post_migrate()

/opt/indico/.venv/lib/python2.7/site-packages/indico/core/db/sqlalchemy/util/session.pyc in wrapper(*args=(<CategoryImporter(postgresql://indico:klf55so@cdpgsdev.fnal.gov:5487/indico)>,), **kwargs={})
     27     def wrapper(*args, **kwargs):
     28         with db.session.no_autoflush:
---> 29             return fn(*args, **kwargs)
        global fn = undefined
        args = (<CategoryImporter(postgresql://indico:klf55so@cdpgsdev.fnal.gov:5487/indico)>,)
        kwargs = {}
     30     return wrapper

/opt/indico/.venv/lib/python2.7/site-packages/indico_migrate/util.pyc in _f(self=<CategoryImporter(postgresql://indico:klf55so@cdpgsdev.fnal.gov:5487/indico)>, *args=(), **kwargs={})
    321         def _f(self, *args, **kwargs):
    322             self.logger.print_step(description)
--> 323             f(self, *args, **kwargs)
        global f = undefined
        self = <CategoryImporter(postgresql://indico:klf55so@cdpgsdev.fnal.gov:5487/indico)>
        args = ()
        kwargs = {}
    324         return _f
    325     return _step_description

/opt/indico/.venv/lib/python2.7/site-packages/indico_migrate/steps/categories.pyc in migrate(self=<CategoryImporter(postgresql://indico:klf55so@cdpgsdev.fnal.gov:5487/indico)>)
     56         self.domain_mapping = {ipng.name.lower(): ipng for ipng in IPNetworkGroup.query}
     57         with patch_default_group_provider(self.default_group_provider):
---> 58             self.migrate_categories()
        self.migrate_categories = <bound method CategoryImporter.migrate_categories of <CategoryImporter(postgresql://indico:klf55so@cdpgsdev.fnal.gov:5487/indico)>>
     59         self.fix_sequences('categories', {'categories'})
     60

/opt/indico/.venv/lib/python2.7/site-packages/indico_migrate/steps/categories.pyc in migrate_categories(self=<CategoryImporter(postgresql://indico:klf55so@cdpgsdev.fnal.gov:5487/indico)>)
     62         old_root = self.zodb_root['rootCategory']
     63         assert old_root.id == '0'
---> 64         root = self._migrate_category(old_root, 1)
        root = undefined
        self._migrate_category = <bound method CategoryImporter._migrate_category of <CategoryImporter(postgresql://indico:klf55so@cdpgsdev.fnal.gov:5487/indico)>>
        old_root = <persistent broken MaKaC.conference.Category instance '\x00\x00\x00\x00\x00\x00\x00\x02'>
     65         db.session.add(root)
     66         db.session.commit()

/opt/indico/.venv/lib/python2.7/site-packages/indico_migrate/steps/categories.pyc in _migrate_category(self=<CategoryImporter(postgresql://indico:klf55so@cdpgsdev.fnal.gov:5487/indico)>, old_cat=<persistent broken MaKaC.conference.Category instance '\x00\x00\x00\x00\x00\x00\x00\x02'>, position=1)
    219         cat.children = [(self._migrate_category(old_subcat, i))
    220                         for i, old_subcat in enumerate(sorted(old_cat.subcategories.itervalues(),
--> 221                                                               key=attrgetter('_order')), 1)]
        global key = undefined
        global attrgetter = <type 'operator.attrgetter'>
    222         # add to user favorites
    223         for user in self.global_ns.user_favorite_categories[old_cat.id]:

/opt/indico/.venv/lib/python2.7/site-packages/indico_migrate/steps/categories.pyc in _migrate_category(self=<CategoryImporter(postgresql://indico:klf55so@cdpgsdev.fnal.gov:5487/indico)>, old_cat=<persistent broken MaKaC.conference.Category instance '\x00\x00\x00\x00\x00\x00\x04\x17'>, position=1)
    219         cat.children = [(self._migrate_category(old_subcat, i))
    220                         for i, old_subcat in enumerate(sorted(old_cat.subcategories.itervalues(),
--> 221                                                               key=attrgetter('_order')), 1)]
        global key = undefined
        global attrgetter = <type 'operator.attrgetter'>
    222         # add to user favorites
    223         for user in self.global_ns.user_favorite_categories[old_cat.id]:

/opt/indico/.venv/lib/python2.7/site-packages/indico_migrate/steps/categories.pyc in _migrate_category(self=<CategoryImporter(postgresql://indico:klf55so@cdpgsdev.fnal.gov:5487/indico)>, old_cat=<persistent broken MaKaC.conference.Category instance '\x00\x00\x00\x00\x00\x00_\x8b'>, position=1)
    219         cat.children = [(self._migrate_category(old_subcat, i))
    220                         for i, old_subcat in enumerate(sorted(old_cat.subcategories.itervalues(),
--> 221                                                               key=attrgetter('_order')), 1)]
        global key = undefined
        global attrgetter = <type 'operator.attrgetter'>
    222         # add to user favorites
    223         for user in self.global_ns.user_favorite_categories[old_cat.id]:

/opt/indico/.venv/lib/python2.7/site-packages/indico_migrate/steps/categories.pyc in _migrate_category(self=<CategoryImporter(postgresql://indico:klf55so@cdpgsdev.fnal.gov:5487/indico)>, old_cat=<persistent broken MaKaC.conference.Category instance '\x00\x00\x00\x00\x01?\xbd\xba'>, position=3)
    215         if old_cat._icon:
    216             self._process_icon(cat, old_cat._icon)
--> 217         self._process_protection(cat, old_cat)
        self._process_protection = <bound method CategoryImporter._process_protection of <CategoryImporter(postgresql://indico:klf55so@cdpgsdev.fnal.gov:5487/indico)>>
        cat = <Category(555, is_deleted=None): "Budker Seminar">
        old_cat = <persistent broken MaKaC.conference.Category instance '\x00\x00\x00\x00\x01?\xbd\xba'>
    218         self.migrate_category_attachments(cat, old_cat)
    219         cat.children = [(self._migrate_category(old_subcat, i))

/opt/indico/.venv/lib/python2.7/site-packages/indico_migrate/steps/categories.pyc in _process_protection(self=<CategoryImporter(postgresql://indico:klf55so@cdpgsdev.fnal.gov:5487/indico)>, cat=<Category(555, is_deleted=None): "Budker Seminar">, old_cat=<persistent broken MaKaC.conference.Category instance '\x00\x00\x00\x00\x01?\xbd\xba'>)
    141         # creation access
    142         for creator in old_cat._Category__confCreators:
--> 143             self.process_principal(cat, creator, 'Creator', 'magenta', roles={'create'})
        self.process_principal = <bound method CategoryImporter.process_principal of <CategoryImporter(postgresql://indico:klf55so@cdpgsdev.fnal.gov:5487/indico)>>
        cat = <Category(555, is_deleted=None): "Budker Seminar">
        creator = <persistent broken MaKaC.user.Avatar instance '\x00\x00\x00\x00\x00E!4'>
        global roles = undefined
    144
    145     def _process_domains(self, cat, old_domains):

/opt/indico/.venv/lib/python2.7/site-packages/indico_migrate/steps/categories.pyc in process_principal(self=<CategoryImporter(postgresql://indico:klf55so@cdpgsdev.fnal.gov:5487/indico)>, cat=<Category(555, is_deleted=None): "Budker Seminar">, legacy_principal=<persistent broken MaKaC.user.Avatar instance '\x00\x00\x00\x00\x00E!4'>, name=u'Creator', color=u'magenta', read_access=None, full_access=None, roles=set([u'create']))
    116         if roles:
    117             updates['add_roles'] = roles
--> 118         cat.update_principal(principal, quiet=True, **updates)
        cat.update_principal = <bound method Category.update_principal of <Category(555, is_deleted=None): "Budker Seminar">>
        principal = undefined
        global quiet = undefined
        global True = undefined
        updates = {u'add_roles': set([u'create'])}
    119         self.print_log('    - %%[%s][{}]%%[reset] {}' % color.format(name.lower(), principal))
    120

TypeError: update_principal() got an unexpected keyword argument 'add_roles'
> /opt/indico/.venv/lib/python2.7/site-packages/indico_migrate/steps/categories.py(118)process_principal()
    116         if roles:
    117             updates['add_roles'] = roles
--> 118         cat.update_principal(principal, quiet=True, **updates)
    119         self.print_log('    - %%[%s][{}]%%[reset] {}' % color.format(name.lower(), principal))
    120

ipdb>


#2

Uou should have gotten a warning about that when trying to install indico-migrate: It’s not compatible with 2.1 (and will never be). You need to migrate to 2.0 first, and then update to 2.1.


#3

I missed this! Thank you for the information.