_old_vespene icon indicating copy to clipboard operation
_old_vespene copied to clipboard

raise AssertionError("database connection isn't set to UTC")

Open changchichung opened this issue 7 years ago • 4 comments
trafficstars

Bug description during bash 5_tutorial.sh , there will be an error message "AssertionError: database connection isn't set to UTC"

Steps to reproduce

I just follow all steps in http://docs.vespene.io/setup.html

Expected behavior

no error

Actual behavior

2018-11-13 02:25:41 [administrator@ubuntu setup]$ bash 5_tutorial.sh 
detected Ubuntu/Debian
Traceback (most recent call last):
  File "manage.py", line 18, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python3.6/dist-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python3.6/dist-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python3.6/dist-packages/django/core/management/base.py", line 316, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/usr/local/lib/python3.6/dist-packages/django/core/management/base.py", line 353, in execute
    output = self.handle(*args, **options)
  File "/opt/vespene/vespene/management/commands/tutorial_setup.py", line 112, in handle
    user1 = admins.first()
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/query.py", line 605, in first
    for obj in (self if self.ordered else self.order_by('pk'))[:1]:
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/query.py", line 268, in __iter__
    self._fetch_all()
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/query.py", line 1186, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/query.py", line 63, in __iter__
    for row in compiler.results_iter(results):
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/sql/compiler.py", line 1466, in cursor_iter
    for rows in iter((lambda: cursor.fetchmany(itersize)), sentinel):
  File "/usr/local/lib/python3.6/dist-packages/django/db/models/sql/compiler.py", line 1466, in <lambda>
    for rows in iter((lambda: cursor.fetchmany(itersize)), sentinel):
  File "/usr/local/lib/python3.6/dist-packages/django/db/utils.py", line 96, in inner
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/django/db/backends/postgresql/utils.py", line 6, in utc_tzinfo_factory
    raise AssertionError("database connection isn't set to UTC")
AssertionError: database connection isn't set to UTC

Operating system and version

 cat /etc/os-release 
NAME="Ubuntu"
VERSION="18.04 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

Any additional info

I only change the database password in 0_common.sh

changchichung avatar Nov 13 '18 02:11 changchichung

Hmm, interesting. I had no idea it would do that if your time zone configuration was off UTC.

I found this answer

https://stackoverflow.com/questions/38807296/django-1-9-2-assertionerror-database-connection-isnt-set-to-utc

Can you perhaps dig in and see what it takes to fix it in your database configuration files?

I may be able to replicate it but am not sure if your postgresql instance is customized or it was just the setup during installation.

I just went with all the installer defaults from the Ubuntu Bionic minimal install.

We can definitely put in the install guide that the server time should be UTC but we should probably set more guidance than that.

mpdehaan avatar Nov 13 '18 02:11 mpdehaan

I did not change any database configuration during install vespene. and I solve this problem by change the host timezone from UTC to "Asia/Taipei" using dpkg-reconfigure tzdata not like what you said server time should be UTC .... I dont know if postgresql alter the timezone in postgresql.conf or not , but maybe this is something need to be take care of.

changchichung avatar Nov 13 '18 08:11 changchichung

Sorry for the late reply on this one - I think this is something I'll see about adding to the setup guide as something to look into if you hit an error during install. I'll leave this ticket open to track that until I do.

Thanks and hope everything else is going well for you in trying it out!

mpdehaan avatar Nov 21 '18 23:11 mpdehaan