Some cleanups around environment variables made.

This commit is contained in:
Joshua Harlow 2012-02-29 14:23:03 -08:00
parent f6a5c2c248
commit 5359fa8966
4 changed files with 15 additions and 8 deletions

View File

@ -210,11 +210,13 @@ class HorizonInstaller(comp.PythonInstallComponent):
def _fix_quantum(self):
if not (utils.service_enabled(settings.QUANTUM_CLIENT, self.instances, False)):
#Make the fake quantum
#make the fake quantum (apparently needed so imports don't fail???)
#TODO remove this...
quantum_dir = sh.joinpths(self.dash_dir, 'quantum')
self.tracewriter.make_dir(quantum_dir)
self.tracewriter.touch_file(sh.joinpths(quantum_dir, '__init__.py'))
self.tracewriter.touch_file(sh.joinpths(quantum_dir, 'client.py'))
if not sh.isdir(quantum_dir):
self.tracewriter.make_dir(quantum_dir)
self.tracewriter.touch_file(sh.joinpths(quantum_dir, '__init__.py'))
self.tracewriter.touch_file(sh.joinpths(quantum_dir, 'client.py'))
def post_install(self):
comp.PythonInstallComponent.post_install(self)

View File

@ -28,6 +28,9 @@ from devstack.components import keystone
#general extraction cfg keys
CFG_MAKE = {
'ADMIN_PASSWORD': ('passwords', 'horizon_keystone_admin'),
'ADMIN_USER': ('keystone', 'admin_user'),
'DEMO_USER': ('keystone', 'demo_user'),
'INVISIBLE_USER': ('keystone', 'invisible_user'),
'MYSQL_PASSWORD': ('passwords', 'sql'),
'RABBIT_PASSWORD': ('passwords', 'rabbit'),
'SERVICE_TOKEN': ('passwords', 'service_token'),

View File

@ -14,6 +14,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import tempfile
from optparse import IndentedHelpFormatter
from optparse import OptionParser, OptionGroup
@ -49,13 +51,13 @@ def parse():
dest="action",
metavar="ACTION",
help="required action to perform: %s" % (_format_list(settings.ACTIONS)))
def_os_dir = sh.joinpths(sh.gethomedir(), DEF_OS_DIR)
default_dir = sh.joinpths(tempfile.gettempdir(), DEF_OS_DIR)
base_group.add_option("-d", "--directory",
action="store",
type="string",
dest="dir",
metavar="DIR",
default=def_os_dir,
default=default_dir,
help=("empty root DIR for install or "
"DIR with existing components for start/stop/uninstall "
"(default: %default)"))

View File

@ -307,12 +307,12 @@ def write_file(fn, text, flush=True, quiet=False):
def touch_file(fn, die_if_there=True, quiet=False, file_size=0):
if not isfile(fn):
if not quiet:
LOG.debug("Touching and truncating file %s", fn)
LOG.debug("Touching and truncating file %s (%s)", fn, file_size)
with open(fn, "w") as f:
f.truncate(file_size)
else:
if die_if_there:
msg = "Can not touch file %s since it already exists" % (fn)
msg = "Can not touch & truncate file %s since it already exists" % (fn)
raise excp.FileException(msg)