Skip to content
Snippets Groups Projects
Commit 4a6fce31 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

Detect wrong Python module structure


If, for one reason or another, a module named "ganeti.ganeti" can be
succesfully imported (e.g. through a symlink in the wrong place), error
which are diffcult to debug can occur. This piece of code tests for the
unlikely case of that happening.

Signed-off-by: default avatarMichael Hanselmann <hansmi@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent 1a9eb17e
No related branches found
No related tags found
No related merge requests found
#
#
# Copyright (C) 2006, 2007 Google Inc.
# Copyright (C) 2006, 2007, 2012 Google Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -22,3 +22,13 @@
# empty file for package definition
"""Ganeti python modules"""
try:
from ganeti import ganeti
except ImportError:
pass
else:
raise Exception("A module named \"ganeti.ganeti\" was successfully imported"
" and should be removed as it can lead to importing the"
" wrong module(s) in other parts of the code, consequently"
" leading to failures which are difficult to debug")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment