wikilabels vagrant role errors out on DB permissions
Closed, ResolvedPublic

Description

==> default: Notice: /Stage[main]/Wikilabels/Exec[create wikilabels database]/returns: executed successfully
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns: INFO:wikilabels.utilities.load_schema:Loading schema...
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns: INFO:wikilabels.database.db:Initializing connection pool.
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns: Traceback (most recent call last):
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns:   File "/vagrant/srv/wikilabels/bin/wikilabels", line 11, in <module>
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns:     load_entry_point('wikilabels', 'console_scripts', 'wikilabels')()
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns:   File "/vagrant/srv/wikilabels/src/wikilabels/wikilabels/wikilabels.py", line 49, in main
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns:     module.main(sys.argv[2:])
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns:   File "/vagrant/srv/wikilabels/src/wikilabels/wikilabels/utilities/load_schema.py", line 39, in main
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns:     run(db, reload_test_data)
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns:   File "/vagrant/srv/wikilabels/src/wikilabels/wikilabels/utilities/load_schema.py", line 50, in run
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns:     db.execute(schema_sql)
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns:   File "/vagrant/srv/wikilabels/src/wikilabels/wikilabels/database/db.py", line 34, in execute
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns:     with self.transaction() as transactor:
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns:   File "/usr/lib/python3.4/contextlib.py", line 59, in __enter__
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns:     return next(self.gen)
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns:   File "/vagrant/srv/wikilabels/src/wikilabels/wikilabels/database/db.py", line 42, in transaction
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns:     self._initialize_pool()
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns:   File "/vagrant/srv/wikilabels/src/wikilabels/wikilabels/database/db.py", line 31, in _initialize_pool
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns:     *args, cursor_factory=RealDictCursor, **kwargs)
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns:   File "/vagrant/srv/wikilabels/lib/python3.4/site-packages/psycopg2/pool.py", line 161, in __init__
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns:     self, minconn, maxconn, *args, **kwargs)
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns:   File "/vagrant/srv/wikilabels/lib/python3.4/site-packages/psycopg2/pool.py", line 58, in __init__
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns:     self._connect()
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns:   File "/vagrant/srv/wikilabels/lib/python3.4/site-packages/psycopg2/pool.py", line 62, in _connect
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns:     conn = psycopg2.connect(*self._args, **self._kwargs)
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns:   File "/vagrant/srv/wikilabels/lib/python3.4/site-packages/psycopg2/__init__.py", line 130, in connect
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns:     conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns: psycopg2.OperationalError: FATAL:  password authentication failed for user "wikilabels"
==> default: Notice: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns: FATAL:  password authentication failed for user "wikilabels"
==> default: Error: echo y | sudo -u www-data /vagrant/srv/wikilabels/bin/wikilabels load_schema --reload-test-data returned 1 instead of one of [0]
==> default: Error: /Stage[main]/Wikilabels/Exec[initialize wikilabels database]/returns: change from notrun to 0 failed: echo y | sudo -u www-data /vagrant/srv/wikilabels/bin/wikilabels load_schema --reload-test-data returned 1 instead of one of [0]
Tgr created this task.Sat, Dec 23, 12:18 AM
Restricted Application added a project: Scoring-platform-team. · View Herald TranscriptSat, Dec 23, 12:18 AM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
awight added a subscriber: awight.Wed, Jan 3, 8:10 PM

I ran into this, too. It works the second provisioning through, and it will also reprovision correctly even after deleting the wikilabels database. The dependencies look correct to me, my next guess is that it's a race condition?

Tgr added a comment.Wed, Jan 3, 9:06 PM

Exec[initialize wikilabels database] has to depend on File[$cfg_file], I'd guess.

Change 401805 had a related patch set uploaded (by Awight; owner: Awight):
[mediawiki/vagrant@stretch-migration] Add ordering between script and its execution

https://gerrit.wikimedia.org/r/401805

Change 401892 had a related patch set uploaded (by Gergő Tisza; owner: Gergő Tisza):
[mediawiki/vagrant@master] wikilabels: add missing config dependency

https://gerrit.wikimedia.org/r/401892

Change 402110 had a related patch set uploaded (by Awight; owner: Awight):
[mediawiki/vagrant@master] Add ordering between script and its execution

https://gerrit.wikimedia.org/r/402110

Change 402110 merged by jenkins-bot:
[mediawiki/vagrant@master] Add ordering between script and its execution

https://gerrit.wikimedia.org/r/402110

Change 401892 merged by jenkins-bot:
[mediawiki/vagrant@master] wikilabels: add missing config dependency

https://gerrit.wikimedia.org/r/401892

Tgr closed this task as Resolved.Sun, Jan 7, 10:02 PM
Tgr claimed this task.

Should be fixed now.

Change 401805 abandoned by Awight:
Add ordering between script and its execution

https://gerrit.wikimedia.org/r/401805