Project

General

Profile

Actions

Bug #7598

closed

Tables do not exists in Vagrant Box

Added by Rajmund Hruška over 2 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Category:
Development - Tools
Target version:
Start date:
06/28/2022
Due date:
% Done:

100%

Estimated time:
To be discussed:
No

Description

I destroyed my Vagrant Box and tried to build it again from the scratch using the commands from https://alchemist.cesnet.cz/mentat/doc/development/html/_doclib/development.html#development-with-vagrant.

The first issue I came across was when running mentat-dbmngr.py --command fixtures-add. The error message was 2022-06-28 12:23:18 CRITICAL ERROR: "Configuration file '/home/rajmund/mentat-ng/chroot/etc/mentat/mentat-dbmngr.py.conf' does not exist". I solved that by sudo ln -s $PWD/chroot /home/rajmund/mentat-ng/.

The other issue was with the same command mentat-dbmngr.py --command fixtures-add. The tables are not created before the fixtures are added:

2022-06-28 12:29:42,932 INFO: Executing script command 'fixtures_add'
2022-06-28 12:29:42,933 INFO: Populating main database with demonstration objects.
2022-06-28 12:29:42,975 INFO: Unable to add demo object to database: 'user' ((psycopg2.errors.UndefinedTable) relation "users" does not exist
LINE 1: INSERT INTO users (login, fullname, email, organization, rol...
                    ^

[SQL: INSERT INTO users (login, fullname, email, organization, roles, password, apikey, enabled, locale, timezone, logintime, createtime) VALUES (%(login)s, %(fullname)s, %(email)s, %(organization)s, %(roles)s, %(password)s, %(apikey)s, %(enabled)s, %(locale)s, %(timezone)s, %(logintime)s, %(createtime)s) RETURNING users.id]
[parameters: {'login': 'user', 'fullname': 'Demo User', 'email': 'user@bogus-domain.org', 'organization': 'BOGUS DOMAIN, a.l.e.', 'roles': ['user'], 'password': None, 'apikey': None, 'enabled': True, 'locale': None, 'timezone': None, 'logintime': None, 'createtime': datetime.datetime(2022, 6, 28, 12, 29, 42, 974090)}]
(Background on this error at: http://sqlalche.me/e/f405))
2022-06-28 12:29:42,978 INFO: Unable to add demo object to database: 'developer' ((psycopg2.errors.UndefinedTable) relation "users" does not exist
LINE 1: INSERT INTO users (login, fullname, email, organization, rol...

Actions #1

Updated by Rajmund Hruška over 2 years ago

There is also an issue with an alternative way of filling the database. Command make data-import-dbsnapshot fails with:

pg_restore: creating DEFAULT ACL "public.DEFAULT PRIVILEGES FOR TYPES" 
pg_restore: creating DEFAULT ACL "public.DEFAULT PRIVILEGES FOR TABLES" 
ERROR:  syntax error at or near ")" 
LINE 1: COPY reports_events () FROM stdin;

Actions #2

Updated by Rajmund Hruška over 2 years ago

  • Status changed from New to In Progress
  • Assignee set to Rajmund Hruška

So, the second issue is actually related to the first issue. When creating Vagrant box using vagrant up, there is this error, when sudo -u mentat ${MENTAT_VENV}/bin/python /vagrant/bin/mentat-dbmngr.py --command init is executed:

    default: 2022-06-29 08:15:54 CRITICAL ERROR: "Configuration file '/home/rajmund/mentat-ng/chroot/etc/mentat/mentat-dbmngr.py.conf' does not exist" 
    default: Traceback (most recent call last):
    default:   File "/var/mentat/venv/bin/hawat-cli", line 11, in <module>
    default:     load_entry_point('mentat-ng', 'console_scripts', 'hawat-cli')()
    default:   File "/var/mentat/venv/lib/python3.7/site-packages/click/core.py", line 1130, in __call__
    default:     return self.main(*args, **kwargs)
    default:   File "/var/mentat/venv/lib/python3.7/site-packages/flask/cli.py", line 586, in main
    default:     return super(FlaskGroup, self).main(*args, **kwargs)
    default:   File "/var/mentat/venv/lib/python3.7/site-packages/click/core.py", line 1055, in main
    default:     rv = self.invoke(ctx)
    default:   File "/var/mentat/venv/lib/python3.7/site-packages/click/core.py", line 1657, in invoke
    default:     return _process_result(sub_ctx.command.invoke(sub_ctx))
    default:   File "/var/mentat/venv/lib/python3.7/site-packages/click/core.py", line 1657, in invoke
    default:     return _process_result(sub_ctx.command.invoke(sub_ctx))
    default:   File "/var/mentat/venv/lib/python3.7/site-packages/click/core.py", line 1404, in invoke
    default:     return ctx.invoke(self.callback, **ctx.params)
    default:   File "/var/mentat/venv/lib/python3.7/site-packages/click/core.py", line 760, in invoke
    default:     return __callback(*args, **kwargs)
    default:   File "/var/mentat/venv/lib/python3.7/site-packages/click/decorators.py", line 26, in new_func
    default:     return f(get_current_context(), *args, **kwargs)
    default:   File "/var/mentat/venv/lib/python3.7/site-packages/flask/cli.py", line 425, in decorator
    default:     with __ctx.ensure_object(ScriptInfo).load_app().app_context():
    default:   File "/var/mentat/venv/lib/python3.7/site-packages/flask/cli.py", line 381, in load_app
    default:     app = call_factory(self, self.create_app)
    default:   File "/var/mentat/venv/lib/python3.7/site-packages/flask/cli.py", line 119, in call_factory
    default:     return app_factory()
    default:   File "/vagrant/lib/hawat/app.py", line 102, in create_app
    default:     config_file=config_file
    default:   File "/vagrant/lib/hawat/app.py", line 80, in create_app_full
    default:     config_func(app.config)
    default:   File "/vagrant/lib/hawat/app.py", line 108, in _config_app
    default:     hawat.config.get_app_root_relative_config()
    default:   File "/vagrant/lib/hawat/config.py", line 398, in get_app_root_relative_config
    default:     pyzenkit.utils.get_resource_path(mentat.const.PATH_CFG_CORE)
    default:   File "/var/mentat/venv/lib/python3.7/site-packages/pyzenkit/jsonconf.py", line 315, in config_load_dir
    default:     all_files = os.listdir(config_dir)
    default: FileNotFoundError: [Errno 2] No such file or directory: '/home/rajmund/mentat-ng/chroot/etc/mentat/core'

Actions #3

Updated by Rajmund Hruška over 2 years ago

  • Target version changed from Backlog to 2.10

The issue was the existence of APP_ROOT_PATH in .env which was likely created by conf/scripts/lwchroot-init.sh. Removing .env (and chroot directory) works. I guess it would be nice to add a note to the documentation.

Actions #4

Updated by Rajmund Hruška over 2 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 100

Fixed in 8b605587.

Actions #5

Updated by Rajmund Hruška over 2 years ago

  • Status changed from Resolved to Closed

Merged into devel.

Actions

Also available in: Atom PDF