diff options
-rwxr-xr-x | bin/nova-all | 2 | ||||
-rwxr-xr-x | bin/nova-api | 2 | ||||
-rwxr-xr-x | bin/nova-api-ec2 | 2 | ||||
-rwxr-xr-x | bin/nova-api-metadata | 2 | ||||
-rwxr-xr-x | bin/nova-api-os-compute | 2 | ||||
-rwxr-xr-x | bin/nova-baremetal-deploy-helper | 3 | ||||
-rwxr-xr-x | bin/nova-cells | 3 | ||||
-rwxr-xr-x | bin/nova-cert | 2 | ||||
-rwxr-xr-x | bin/nova-compute | 2 | ||||
-rwxr-xr-x | bin/nova-conductor | 2 | ||||
-rwxr-xr-x | bin/nova-console | 2 | ||||
-rwxr-xr-x | bin/nova-consoleauth | 2 | ||||
-rwxr-xr-x | bin/nova-network | 2 | ||||
-rwxr-xr-x | bin/nova-novncproxy | 3 | ||||
-rwxr-xr-x | bin/nova-objectstore | 2 | ||||
-rwxr-xr-x | bin/nova-spicehtml5proxy | 3 | ||||
-rwxr-xr-x | bin/nova-xvpvncproxy | 2 | ||||
-rw-r--r-- | doc/source/devref/il8n.rst | 5 | ||||
-rw-r--r-- | nova/__init__.py | 5 | ||||
-rwxr-xr-x | tools/hacking.py | 2 |
20 files changed, 42 insertions, 8 deletions
diff --git a/bin/nova-all b/bin/nova-all index d96b71604..af947d36d 100755 --- a/bin/nova-all +++ b/bin/nova-all @@ -30,6 +30,7 @@ continue attempting to launch the rest of the services. import eventlet eventlet.monkey_patch(os=False) +import gettext import os import sys @@ -40,6 +41,7 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath( if os.path.exists(os.path.join(possible_topdir, "nova", "__init__.py")): sys.path.insert(0, possible_topdir) +gettext.install('nova', unicode=1) from nova import config from nova.objectstore import s3server diff --git a/bin/nova-api b/bin/nova-api index d21d955cf..171a23ea0 100755 --- a/bin/nova-api +++ b/bin/nova-api @@ -26,6 +26,7 @@ Starts both the EC2 and OpenStack APIs in separate greenthreads. import eventlet eventlet.monkey_patch(os=False) +import gettext import os import sys @@ -36,6 +37,7 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath( if os.path.exists(os.path.join(possible_topdir, "nova", "__init__.py")): sys.path.insert(0, possible_topdir) +gettext.install('nova', unicode=1) from nova import config from nova.openstack.common import log as logging diff --git a/bin/nova-api-ec2 b/bin/nova-api-ec2 index d1b3d45ea..a3e1be018 100755 --- a/bin/nova-api-ec2 +++ b/bin/nova-api-ec2 @@ -22,6 +22,7 @@ import eventlet eventlet.monkey_patch(os=False) +import gettext import os import sys @@ -31,6 +32,7 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath( if os.path.exists(os.path.join(possible_topdir, "nova", "__init__.py")): sys.path.insert(0, possible_topdir) +gettext.install('nova', unicode=1) from nova import config from nova.openstack.common import log as logging diff --git a/bin/nova-api-metadata b/bin/nova-api-metadata index e7cac260d..2005d6714 100755 --- a/bin/nova-api-metadata +++ b/bin/nova-api-metadata @@ -22,6 +22,7 @@ import eventlet eventlet.monkey_patch(os=False) +import gettext import os import sys @@ -31,6 +32,7 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath( if os.path.exists(os.path.join(possible_topdir, "nova", "__init__.py")): sys.path.insert(0, possible_topdir) +gettext.install('nova', unicode=1) from nova import config from nova.openstack.common import log as logging diff --git a/bin/nova-api-os-compute b/bin/nova-api-os-compute index 02f16a04a..c2aa9e57c 100755 --- a/bin/nova-api-os-compute +++ b/bin/nova-api-os-compute @@ -22,6 +22,7 @@ import eventlet eventlet.monkey_patch(os=False) +import gettext import os import sys @@ -31,6 +32,7 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath( if os.path.exists(os.path.join(possible_topdir, "nova", "__init__.py")): sys.path.insert(0, possible_topdir) +gettext.install('nova', unicode=1) from nova import config from nova.openstack.common import log as logging diff --git a/bin/nova-baremetal-deploy-helper b/bin/nova-baremetal-deploy-helper index 756305776..975fc7619 100755 --- a/bin/nova-baremetal-deploy-helper +++ b/bin/nova-baremetal-deploy-helper @@ -23,6 +23,7 @@ import eventlet if __name__ == '__main__': eventlet.monkey_patch() +import gettext import os import sys import threading @@ -36,6 +37,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) +gettext.install('nova', unicode=1) + import cgi import Queue import re diff --git a/bin/nova-cells b/bin/nova-cells index bb955e9ec..380e71266 100755 --- a/bin/nova-cells +++ b/bin/nova-cells @@ -21,6 +21,7 @@ import eventlet eventlet.monkey_patch() +import gettext import os import sys @@ -34,6 +35,8 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) +gettext.install('nova', unicode=1) + from nova import config from nova.openstack.common import log as logging from nova import service diff --git a/bin/nova-cert b/bin/nova-cert index c6d9ddbad..861f3ba8f 100755 --- a/bin/nova-cert +++ b/bin/nova-cert @@ -20,6 +20,7 @@ import eventlet eventlet.monkey_patch() +import gettext import os import sys @@ -33,6 +34,7 @@ POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'nova', '__init__.py')): sys.path.insert(0, POSSIBLE_TOPDIR) +gettext.install('nova', unicode=1) from nova import config from nova.openstack.common import log as logging diff --git a/bin/nova-compute b/bin/nova-compute index 26d81d8cc..a7ca4de5b 100755 --- a/bin/nova-compute +++ b/bin/nova-compute @@ -29,6 +29,7 @@ if os.name == 'nt': else: eventlet.monkey_patch() +import gettext import os import sys import traceback @@ -43,6 +44,7 @@ POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'nova', '__init__.py')): sys.path.insert(0, POSSIBLE_TOPDIR) +gettext.install('nova', unicode=1) from nova import config import nova.db.api diff --git a/bin/nova-conductor b/bin/nova-conductor index 30d426f42..72e89804f 100755 --- a/bin/nova-conductor +++ b/bin/nova-conductor @@ -20,6 +20,7 @@ import eventlet eventlet.monkey_patch() +import gettext import os import sys @@ -33,6 +34,7 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) +gettext.install('nova', unicode=1) from nova import config from nova.openstack.common import log as logging diff --git a/bin/nova-console b/bin/nova-console index 6d6569104..af037bb3c 100755 --- a/bin/nova-console +++ b/bin/nova-console @@ -21,6 +21,7 @@ import eventlet eventlet.monkey_patch() +import gettext import os import sys @@ -34,6 +35,7 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) +gettext.install('nova', unicode=1) from nova import config from nova.openstack.common import log as logging diff --git a/bin/nova-consoleauth b/bin/nova-consoleauth index 0cbec669a..f867c8c7b 100755 --- a/bin/nova-consoleauth +++ b/bin/nova-consoleauth @@ -21,6 +21,7 @@ import eventlet eventlet.monkey_patch() +import gettext import os import sys @@ -32,6 +33,7 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) +gettext.install('nova', unicode=1) from nova import config from nova.consoleauth import manager diff --git a/bin/nova-network b/bin/nova-network index d0ee61ed9..b79785214 100755 --- a/bin/nova-network +++ b/bin/nova-network @@ -22,6 +22,7 @@ import eventlet eventlet.monkey_patch() +import gettext import os import sys @@ -35,6 +36,7 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) +gettext.install('nova', unicode=1) from nova import config from nova.openstack.common import log as logging diff --git a/bin/nova-novncproxy b/bin/nova-novncproxy index 29981f53f..c40fdbfd5 100755 --- a/bin/nova-novncproxy +++ b/bin/nova-novncproxy @@ -21,11 +21,14 @@ Websocket proxy that is compatible with OpenStack Nova noVNC consoles. Leverages websockify.py by Joel Martin """ +import gettext import os import sys from oslo.config import cfg +gettext.install('nova', unicode=1) + from nova import config from nova.console import websocketproxy diff --git a/bin/nova-objectstore b/bin/nova-objectstore index 8ec9fbf35..f60868946 100755 --- a/bin/nova-objectstore +++ b/bin/nova-objectstore @@ -22,6 +22,7 @@ import eventlet eventlet.monkey_patch() +import gettext import os import sys @@ -33,6 +34,7 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) +gettext.install('nova', unicode=1) from nova import config from nova.objectstore import s3server diff --git a/bin/nova-spicehtml5proxy b/bin/nova-spicehtml5proxy index 012a202ec..1d8fe81dc 100755 --- a/bin/nova-spicehtml5proxy +++ b/bin/nova-spicehtml5proxy @@ -21,11 +21,14 @@ Websocket proxy that is compatible with OpenStack Nova SPICE HTML5 consoles. Leverages websockify.py by Joel Martin """ +import gettext import os import sys from oslo.config import cfg +gettext.install('nova', unicode=1) + from nova import config from nova.console import websocketproxy diff --git a/bin/nova-xvpvncproxy b/bin/nova-xvpvncproxy index 6ad61d0ba..905c3de4f 100755 --- a/bin/nova-xvpvncproxy +++ b/bin/nova-xvpvncproxy @@ -21,6 +21,7 @@ import eventlet eventlet.monkey_patch() +import gettext import os import sys @@ -30,6 +31,7 @@ possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), if os.path.exists(os.path.join(possible_topdir, 'nova', '__init__.py')): sys.path.insert(0, possible_topdir) +gettext.install('nova', unicode=1) from nova import config from nova.openstack.common import log as logging diff --git a/doc/source/devref/il8n.rst b/doc/source/devref/il8n.rst index 2264630be..ce708449d 100644 --- a/doc/source/devref/il8n.rst +++ b/doc/source/devref/il8n.rst @@ -27,8 +27,7 @@ The ``_()`` function is brought into the global scope by doing:: import gettext gettext.install("nova", unicode=1) -In general, you shouldn't need to add these to any nova files, since the lines -are present in ``nova/__init__.py``. However, if this code is missing, it may -result in an error that looks like like:: +These lines are needed in any toplevel script before any nova modules are +imported. If this code is missing, it may result in an error that looks like:: NameError: name '_' is not defined diff --git a/nova/__init__.py b/nova/__init__.py index a9eca4848..e21bdd7b4 100644 --- a/nova/__init__.py +++ b/nova/__init__.py @@ -24,8 +24,3 @@ :platform: Unix :synopsis: Infrastructure-as-a-Service Cloud platform. """ - -import gettext - - -gettext.install('nova', unicode=1) diff --git a/tools/hacking.py b/tools/hacking.py index 4e2331054..94053991e 100755 --- a/tools/hacking.py +++ b/tools/hacking.py @@ -21,6 +21,7 @@ Built on top of pep8.py """ +import gettext import imp import inspect import logging @@ -643,6 +644,7 @@ imports_on_separate_lines_N301_compliant = r""" """ if __name__ == "__main__": + gettext.install('nova', unicode=1) #include nova path sys.path.append(os.getcwd()) #Run once tests (not per line) |