Error in vmchecker-init-course storer
valenting opened this issue · 4 comments
First
so@elf:~/temp$ vmchecker-init-course storer
Traceback (most recent call last):
File "/usr/local/bin/vmchecker-init-course", line 221, in <module>
main()
File "/usr/local/bin/vmchecker-init-course", line 209, in main
_install_if_needed_example_config_file(root_path, repo_path, config_path)
File "/usr/local/bin/vmchecker-init-course", line 52, in _install_if_needed_example_config_file
_install_example_config_file(root_path, repo_path, config_path)
File "/usr/local/bin/vmchecker-init-course", line 34, in _install_example_config_file
with pkg_resources.resource_stream('vmchecker', 'examples/config-template') as template:
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 1135, in resource_stream
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 1689, in get_resource_stream
IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/vmchecker/examples/config-template'
I did /usr/local/lib/python2.7/dist-packages/vmchecker/examples# cp storer-config-template config-template
as a workaround.
Then
elf:/home/so/temp# vmchecker-init-course storer
A new default vmchecker configuration file was written to /home/so/temp/config. Update it before running any vmchecker code.
Traceback (most recent call last):
File "/usr/local/bin/vmchecker-init-course", line 221, in <module>
main()
File "/usr/local/bin/vmchecker-init-course", line 210, in main
main_storer(root_path)
File "/usr/local/bin/vmchecker-init-course", line 173, in main_storer
set_default_acls()
File "/usr/local/bin/vmchecker-init-course", line 153, in set_default_acls
users = [getpass.getuser()] + acl_cfg.users()
File "/usr/local/lib/python2.7/dist-packages/vmchecker/config.py", line 145, in users
return self.get_list('DEFAULT', 'users')
File "/usr/local/lib/python2.7/dist-packages/vmchecker/confdefaults.py", line 37, in get_list
return self.get(section, option, default).split(LIST_SEPARATOR)
File "/usr/local/lib/python2.7/dist-packages/vmchecker/confdefaults.py", line 27, in get
return self.config.get(section, option)
File "/usr/lib/python2.7/ConfigParser.py", line 334, in get
raise NoOptionError(option, section)
ConfigParser.NoOptionError: No option 'users' in section: 'DEFAULT'
@calin-iorgulescu Could you take a look at this?
This stems from another issue. If upgrading vmchecker to a newer version, the fact that the DBs are missing a teams table is throwing an error. We need to either make it backwards compatible and/or fix the vmchecker-init-course tool.
@valenting So the cause of the 2nd error actually is due to a typo in the config.py file (I'll push a patch shortly).
However, I'm surprised by the first error: The vmchecker-init-course script should now specifically select either storer-config-template or tester-config-template based on the given parameter. Did you update this script as well?
As for the db, it's a bit more complicated, I fear. The 'grades' table has been split into 'team_grades' and 'student_grades' (or, rather, duplicated). To properly convert between the 2 formats automatically, the init-course script would need to check which DB layout exists. I'll try to think about a solution.
I think a simple thing to do would be to replace the .db with a brand new one, then run vmchecker-update-db --course_id XX.
If I'm not mistaken, that should do the job.
Yes, that would work, but I would leave it up to the user to do this manually (perhaps add an info message that a .db was detected and that it should be refreshed). The main reason is that vmchecker-update-db cannot distinguish between team accounts and user accounts unless the team information already exists in the DB. Therefore, if you're updating from the older DB format, then that's fine, but if you're running init-course on top of an existing course, you would need to first input all the team assignments and only after that run update-db.