Keystone failed to find top directory for templates

Bug #865448 reported by Patrick Hetu on 2011-10-03
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenStack Identity (keystone)
Undecided
Justin Shepherd

Bug Description

Version of keystone and python-keystone: 1.0~d4~20110929.1190-0ubuntu0ppa1~oneiric1

This is the error I have in the log file:

2011-10-03 10:53:31 ERROR [root] Template u'/usr/keystone/content/admin/version.json.tpl' not found at line 0 column 0
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/keystone/utils.py", line 62, in check_error
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/keystone/controllers/version.py", line 42, in get_version_info
    VERSION_DATE=config.VERSION_DATE)
  File "/usr/lib/python2.7/dist-packages/keystone/common/template.py", line 374, in template
    **settings)
  File "/usr/lib/python2.7/dist-packages/keystone/common/template.py", line 97, in __init__
    (0, 0), None)
TemplateError: Template u'/usr/keystone/content/admin/version.json.tpl' not found at line 0 column 0
2011-10-03 10:53:31 ERROR [root] Template u'/usr/keystone/content/admin/version.json.tpl' not found at line 0 column 0
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/keystone/utils.py", line 62, in check_error
    return func(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/keystone/controllers/version.py", line 42, in get_version_info
    VERSION_DATE=config.VERSION_DATE)
  File "/usr/lib/python2.7/dist-packages/keystone/common/template.py", line 374, in template
    **settings)
  File "/usr/lib/python2.7/dist-packages/keystone/common/template.py", line 97, in __init__
    (0, 0), None)
TemplateError: Template u'/usr/keystone/content/admin/version.json.tpl' not found at line 0 column 0

Download full text (4.0 KiB)

Try to ...
Exec the command with full path will help you

2011/10/3 Patrick Hetu <email address hidden>

> Public bug reported:
>
> Version of keystone and python-keystone:
> 1.0~d4~20110929.1190-0ubuntu0ppa1~oneiric1
>
> This is the error I have in the log file:
>
> 2011-10-03 10:53:31 ERROR [root] Template
> u'/usr/keystone/content/admin/version.json.tpl' not found at line 0 column 0
> Traceback (most recent call last):
> File "/usr/lib/python2.7/dist-packages/keystone/utils.py", line 62, in
> check_error
> return func(*args, **kwargs)
> File "/usr/lib/python2.7/dist-packages/keystone/controllers/version.py",
> line 42, in get_version_info
> VERSION_DATE=config.VERSION_DATE)
> File "/usr/lib/python2.7/dist-packages/keystone/common/template.py", line
> 374, in template
> **settings)
> File "/usr/lib/python2.7/dist-packages/keystone/common/template.py", line
> 97, in __init__
> (0, 0), None)
> TemplateError: Template u'/usr/keystone/content/admin/version.json.tpl' not
> found at line 0 column 0
> 2011-10-03 10:53:31 ERROR [root] Template
> u'/usr/keystone/content/admin/version.json.tpl' not found at line 0 column 0
> Traceback (most recent call last):
> File "/usr/lib/python2.7/dist-packages/keystone/utils.py", line 62, in
> check_error
> return func(*args, **kwargs)
> File "/usr/lib/python2.7/dist-packages/keystone/controllers/version.py",
> line 42, in get_version_info
> VERSION_DATE=config.VERSION_DATE)
> File "/usr/lib/python2.7/dist-packages/keystone/common/template.py", line
> 374, in template
> **settings)
> File "/usr/lib/python2.7/dist-packages/keystone/common/template.py", line
> 97, in __init__
> (0, 0), None)
> TemplateError: Template u'/usr/keystone/content/admin/version.json.tpl' not
> found at line 0 column 0
>
> ** Affects: keystone
> Importance: Undecided
> Status: New
>
> --
> You received this bug notification because you are subscribed to
> OpenStack.
> https://bugs.launchpad.net/bugs/865448
>
> Title:
> Keystone failed to find top directory for templates
>
> Status in Identity for OpenStack (Keystone):
> New
>
> Bug description:
> Version of keystone and python-keystone:
> 1.0~d4~20110929.1190-0ubuntu0ppa1~oneiric1
>
> This is the error I have in the log file:
>
> 2011-10-03 10:53:31 ERROR [root] Template
> u'/usr/keystone/content/admin/version.json.tpl' not found at line 0 column 0
> Traceback (most recent call last):
> File "/usr/lib/python2.7/dist-packages/keystone/utils.py", line 62, in
> check_error
> return func(*args, **kwargs)
> File "/usr/lib/python2.7/dist-packages/keystone/controllers/version.py",
> line 42, in get_version_info
> VERSION_DATE=config.VERSION_DATE)
> File "/usr/lib/python2.7/dist-packages/keystone/common/template.py",
> line 374, in template
> **settings)
> File "/usr/lib/python2.7/dist-packages/keystone/common/template.py",
> line 97, in __init__
> (0, 0), None)
> TemplateError: Template u'/usr/keystone/content/admin/version.json.tpl'
> not found at line 0 column 0
> 2011-10-03 10:53:31 ERROR [root] Template
> u'/usr/keystone/content/admin/version.json.tpl' not found at line 0 column 0
> Tracebac...

Read more...

Patrick Hetu (patrick-hetu) wrote :

In the debian package, the keystone daemon is started by an Upstart script this way:

  exec su -c "keystone --log-dir=/var/log/keystone --log-file=api.log" keystone

and you grab the topdir with this code:

  possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
                                  os.pardir,
                                  os.pardir))

So sys.argv[0] is /usr/bin/keystone in this case. So the templates are not found.

I think you could use the __file__ variable to found the script path instead of using sys.argv[0]
like this:

  possible_topdir = os.path.normpath(os.path.join(os.path.dirname(__file__),
                                     os.pardir,
                                     os.pardir))

Justin Shepherd (jshepher) wrote :
Changed in keystone:
status: New → Fix Committed
Joe Savak (jsavak) on 2011-10-25
tags: added: diablo-backport

Reviewed: https://review.openstack.org/932
Committed: http://github.com/openstack/keystone/commit/2b4e9ed3f9b14c02e87ff30f25bf6add4a7374c2
Submitter: Jenkins
Branch: master

 status fixcommitted
 done

commit 2b4e9ed3f9b14c02e87ff30f25bf6add4a7374c2
Author: Jason Cannavale <email address hidden>
Date: Tue Oct 18 15:52:40 2011 -0500

    bug lp:865448
    change abspath to dirname in controllers/version.py to correct path problems.

    Change-Id: Ia483d4766652c6b46dadf7d97bc7dfceca1e4b9c

Reviewed: https://review.openstack.org/1332
Committed: http://github.com/openstack/keystone/commit/cd0186e0f95daffa2a7b94db31a0bdd40c156e61
Submitter: Jenkins
Branch: stable/diablo

 status fixcommitted
 done

commit cd0186e0f95daffa2a7b94db31a0bdd40c156e61
Author: Jason Cannavale <email address hidden>
Date: Tue Oct 18 15:52:40 2011 -0500

    bug lp:865448
    change abspath to dirname in controllers/version.py to correct path problems.

    Change-Id: Ia483d4766652c6b46dadf7d97bc7dfceca1e4b9c

Thierry Carrez (ttx) on 2011-11-09
Changed in keystone:
milestone: none → essex-1
Changed in keystone:
assignee: nobody → Justin Shepherd (jshepher)
Thierry Carrez (ttx) on 2011-11-17
Changed in keystone:
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2012-04-05
Changed in keystone:
milestone: essex-1 → 2012.1

LinkedIn
------------

Bug,

I'd like to add you to my professional network on LinkedIn.

- Hugo

Hugo Kuo
Software Engineer at Cloudena Corp. Taiwan
Taiwan

Confirm that you know Hugo Kuo:
https://www.linkedin.com/e/99y30f-havv6q11-y/isd/10104617795/Rouvs1-L/?hs=false&tok=1Ku7OVUYfaQlw1

--
You are receiving Invitation to Connect emails. Click to unsubscribe:
http://www.linkedin.com/e/99y30f-havv6q11-y/zr0b4Glh7dla4LItFgDR-PxhKIfTz-IpDD3fb4q/goo/865448%40bugs%2Elaunchpad%2Enet/20061/I3366192011_1/?hs=false&tok=3xd0mCPRbaQlw1

(c) 2012 LinkedIn Corporation. 2029 Stierlin Ct, Mountain View, CA 94043, USA.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers