Use python module loading to run glance-manage
Executing glance-manage in a unittest context means that we need to install glance first, which breaks packaging workflow. Fixes bug 1196275. Change-Id: Idf0a332c2f2ffd3eb96d3623c32cf5383a0d9887
This commit is contained in:
parent
faff61161e
commit
bc8e71acfc
@ -127,3 +127,7 @@ def main():
|
|||||||
CONF.command.func()
|
CONF.command.func()
|
||||||
except exception.GlanceException as e:
|
except exception.GlanceException as e:
|
||||||
sys.exit("ERROR: %s" % e)
|
sys.exit("ERROR: %s" % e)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
@ -32,6 +32,7 @@ import re
|
|||||||
import shutil
|
import shutil
|
||||||
import signal
|
import signal
|
||||||
import socket
|
import socket
|
||||||
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
import time
|
import time
|
||||||
import urlparse
|
import urlparse
|
||||||
@ -211,8 +212,8 @@ class Server(object):
|
|||||||
os.system('cp %s %s/tests.sqlite'
|
os.system('cp %s %s/tests.sqlite'
|
||||||
% (db_location, self.test_dir))
|
% (db_location, self.test_dir))
|
||||||
else:
|
else:
|
||||||
cmd = ('glance-manage --config-file %s db_sync'
|
cmd = ('%s -m glance.cmd.manage --config-file %s db_sync' %
|
||||||
% conf_filepath)
|
(sys.executable, conf_filepath))
|
||||||
execute(cmd, no_venv=self.no_venv, exec_env=self.exec_env,
|
execute(cmd, no_venv=self.no_venv, exec_env=self.exec_env,
|
||||||
expect_exit=True)
|
expect_exit=True)
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
"""Functional test cases for glance-manage"""
|
"""Functional test cases for glance-manage"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
from glance.common import utils
|
from glance.common import utils
|
||||||
from glance.tests import functional
|
from glance.tests import functional
|
||||||
@ -43,8 +44,8 @@ class TestGlanceManage(functional.FunctionalTest):
|
|||||||
conf_file.write(self.connection)
|
conf_file.write(self.connection)
|
||||||
conf_file.flush()
|
conf_file.flush()
|
||||||
|
|
||||||
cmd = ('glance-manage --config-file %s db_sync' %
|
cmd = ('%s -m glance.cmd.manage --config-file %s db_sync' %
|
||||||
self.conf_filepath)
|
(sys.executable, self.conf_filepath))
|
||||||
execute(cmd, raise_error=True)
|
execute(cmd, raise_error=True)
|
||||||
|
|
||||||
def _assert_tables(self):
|
def _assert_tables(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user