Use more colorizer quoting for %r
This commit is contained in:
parent
89656fb253
commit
3980a2cf54
@ -286,7 +286,7 @@ class InstallRunner(ActionRunner):
|
||||
PhaseFunctors(
|
||||
start=lambda name: LOG.info('Installing %s.', colorizer.quote(name)),
|
||||
run=lambda i: i.install(),
|
||||
end=(lambda name, result: LOG.info("Finished install of %s items - check %s for information on what was done",
|
||||
end=(lambda name, result: LOG.info("Finished install of %s items - check %s for information on what was done.",
|
||||
colorizer.quote(name), colorizer.quote(result))),
|
||||
),
|
||||
component_order,
|
||||
|
@ -31,7 +31,10 @@ def quote(data, quote_color='green'):
|
||||
if not is_terminal():
|
||||
return "'%s'" % (data)
|
||||
else:
|
||||
return color(data, quote_color)
|
||||
text = str(data)
|
||||
if len(text) == 0:
|
||||
text = "''"
|
||||
return color(text, quote_color)
|
||||
|
||||
|
||||
def format(data, params):
|
||||
|
@ -14,6 +14,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from devstack import colorizer
|
||||
from devstack import component as comp
|
||||
from devstack import exceptions as excp
|
||||
from devstack import log as logging
|
||||
@ -239,6 +240,7 @@ def drop_db(cfg, pw_gen, distro, dbname):
|
||||
dbtype = cfg.get("db", "type")
|
||||
dropcmd = distro.get_command(dbtype, 'drop_db', silent=True)
|
||||
if dropcmd:
|
||||
LOG.info('Dropping %s database: %s', colorizer.quote(dbtype), colorizer.quote(dbname))
|
||||
params = dict()
|
||||
params['PASSWORD'] = pw_gen.get_password("sql", PASSWORD_PROMPT)
|
||||
params['USER'] = cfg.getdefaulted("db", "sql_user", 'root')
|
||||
@ -261,7 +263,7 @@ def create_db(cfg, pw_gen, distro, dbname, utf8=False):
|
||||
else:
|
||||
createcmd = distro.get_command(dbtype, 'create_db_utf8', silent=True)
|
||||
if createcmd:
|
||||
LOG.debug('Creating %s database %s', dbtype, dbname)
|
||||
LOG.info('Creating %s database: %s', colorizer.quote(dbtype), colorizer.quote(dbname))
|
||||
params = dict()
|
||||
params['PASSWORD'] = pw_gen.get_password("sql", PASSWORD_PROMPT)
|
||||
params['USER'] = cfg.getdefaulted("db", "sql_user", 'root')
|
||||
|
@ -17,6 +17,7 @@
|
||||
import io
|
||||
|
||||
from devstack import cfg
|
||||
from devstack import colorizer
|
||||
from devstack import component as comp
|
||||
from devstack import log as logging
|
||||
from devstack import shell as sh
|
||||
@ -99,7 +100,6 @@ class GlanceInstaller(GlanceMixin, comp.PythonInstallComponent):
|
||||
self._setup_db()
|
||||
|
||||
def _setup_db(self):
|
||||
LOG.info("Fixing up database named %r", DB_NAME)
|
||||
db.drop_db(self.cfg, self.pw_gen, self.distro, DB_NAME)
|
||||
db.create_db(self.cfg, self.pw_gen, self.distro, DB_NAME, utf8=True)
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from devstack import colorizer
|
||||
from devstack import component as comp
|
||||
from devstack import exceptions as excp
|
||||
from devstack import log as logging
|
||||
@ -55,6 +56,7 @@ BAD_APACHE_USERS = ['root']
|
||||
# Apache logs will go here
|
||||
LOGS_DIR = "logs"
|
||||
|
||||
# This db will be dropped and created
|
||||
DB_NAME = 'horizon'
|
||||
|
||||
|
||||
@ -123,11 +125,10 @@ class HorizonInstaller(comp.PythonInstallComponent):
|
||||
def _sync_db(self):
|
||||
# Initialize the horizon database (it stores sessions and notices shown to users).
|
||||
# The user system is external (keystone).
|
||||
LOG.info("Initializing the horizon database.")
|
||||
LOG.info("Syncing horizon to database: %s", colorizer.quote(DB_NAME))
|
||||
sh.execute(*DB_SYNC_CMD, cwd=self.app_dir)
|
||||
|
||||
def _setup_db(self):
|
||||
LOG.info("Fixing up database named %r", DB_NAME)
|
||||
db.drop_db(self.cfg, self.pw_gen, self.distro, DB_NAME)
|
||||
db.create_db(self.cfg, self.pw_gen, self.distro, DB_NAME, utf8=True)
|
||||
|
||||
|
@ -19,6 +19,7 @@ import io
|
||||
from urlparse import urlunparse
|
||||
|
||||
from devstack import cfg
|
||||
from devstack import colorizer
|
||||
from devstack import component as comp
|
||||
from devstack import log as logging
|
||||
from devstack import shell as sh
|
||||
@ -113,7 +114,7 @@ class KeystoneInstaller(comp.PythonInstallComponent):
|
||||
return set(['swift', 'quantum'])
|
||||
|
||||
def _sync_db(self):
|
||||
LOG.info("Syncing keystone to database named %r", DB_NAME)
|
||||
LOG.info("Syncing keystone to database: %s", colorizer.quote(DB_NAME))
|
||||
mp = self._get_param_map(None)
|
||||
cmds = [{'cmd': SYNC_DB_CMD}]
|
||||
utils.execute_template(*cmds, cwd=self.bin_dir, params=mp)
|
||||
@ -122,12 +123,11 @@ class KeystoneInstaller(comp.PythonInstallComponent):
|
||||
return list(CONFIGS)
|
||||
|
||||
def _setup_db(self):
|
||||
LOG.info("Fixing up database named %r", DB_NAME)
|
||||
db.drop_db(self.cfg, self.pw_gen, self.distro, DB_NAME)
|
||||
db.create_db(self.cfg, self.pw_gen, self.distro, DB_NAME, utf8=True)
|
||||
|
||||
def _setup_initer(self):
|
||||
LOG.info("Configuring keystone initializer template %r", MANAGE_DATA_CONF)
|
||||
LOG.info("Configuring keystone initializer template: %s", colorizer.quote(MANAGE_DATA_CONF))
|
||||
(_, contents) = utils.load_template(self.component_name, MANAGE_DATA_CONF)
|
||||
mp = self._get_param_map(MANAGE_DATA_CONF)
|
||||
contents = utils.param_replace(contents, mp, True)
|
||||
|
@ -17,6 +17,7 @@
|
||||
import io
|
||||
|
||||
from devstack import cfg
|
||||
from devstack import colorizer
|
||||
from devstack import component as comp
|
||||
from devstack import log as logging
|
||||
from devstack import shell as sh
|
||||
@ -75,7 +76,6 @@ class MelangeInstaller(comp.PythonInstallComponent):
|
||||
return places
|
||||
|
||||
def _setup_db(self):
|
||||
LOG.info("Fixing up database named %r", DB_NAME)
|
||||
db.drop_db(self.cfg, self.pw_gen, self.distro, DB_NAME)
|
||||
db.create_db(self.cfg, self.pw_gen, self.distro, DB_NAME, utf8=True)
|
||||
|
||||
@ -85,7 +85,7 @@ class MelangeInstaller(comp.PythonInstallComponent):
|
||||
self._sync_db()
|
||||
|
||||
def _sync_db(self):
|
||||
LOG.info("Syncing melange to database named %r", DB_NAME)
|
||||
LOG.info("Syncing melange to database: %s", colorizer.quote(DB_NAME))
|
||||
utils.execute_template(*DB_SYNC_CMD, params=self._get_param_map(None))
|
||||
|
||||
def _get_param_map(self, config_fn):
|
||||
|
@ -21,6 +21,7 @@ import weakref
|
||||
from urlparse import urlunparse
|
||||
|
||||
from devstack import cfg
|
||||
from devstack import colorizer
|
||||
from devstack import component as comp
|
||||
from devstack import date
|
||||
from devstack import exceptions
|
||||
@ -240,7 +241,7 @@ class NovaUninstaller(NovaMixin, comp.PythonUninstallComponent):
|
||||
env['VOLUME_NAME_PREFIX'] = self.cfg.getdefaulted('nova', 'volume_name_prefix', DEF_VOL_PREFIX)
|
||||
cleaner_fn = sh.joinpths(self.bin_dir, CLEANER_DATA_CONF)
|
||||
if sh.isfile(cleaner_fn):
|
||||
LOG.info("Cleaning up your system by running nova cleaner script %r" % (cleaner_fn))
|
||||
LOG.info("Cleaning up your system by running nova cleaner script: %s", colorizer.quote(cleaner_fn))
|
||||
cmd = CLEANER_CMD_ROOT + [cleaner_fn]
|
||||
sh.execute(*cmd, run_as_root=True, env_overrides=env)
|
||||
|
||||
@ -288,7 +289,7 @@ class NovaInstaller(NovaMixin, comp.PythonInstallComponent):
|
||||
self.pw_gen.get_password(pw_key, pw_prompt)
|
||||
|
||||
def _setup_network_initer(self):
|
||||
LOG.info("Configuring nova network initializer template %r", NET_INIT_CONF)
|
||||
LOG.info("Configuring nova network initializer template: %s", colorizer.quote(NET_INIT_CONF))
|
||||
(_, contents) = utils.load_template(self.component_name, NET_INIT_CONF)
|
||||
params = self._get_param_map(NET_INIT_CONF)
|
||||
contents = utils.param_replace(contents, params, True)
|
||||
@ -299,7 +300,7 @@ class NovaInstaller(NovaMixin, comp.PythonInstallComponent):
|
||||
self.tracewriter.file_touched(tgt_fn)
|
||||
|
||||
def _sync_db(self):
|
||||
LOG.info("Syncing nova to database named %r", DB_NAME)
|
||||
LOG.info("Syncing nova to database named: %s", colorizer.quote(DB_NAME))
|
||||
mp = self._get_param_map(None)
|
||||
utils.execute_template(*DB_SYNC_CMD, params=mp)
|
||||
|
||||
@ -315,7 +316,7 @@ class NovaInstaller(NovaMixin, comp.PythonInstallComponent):
|
||||
self.volume_maker.setup_volumes()
|
||||
|
||||
def _setup_cleaner(self):
|
||||
LOG.info("Configuring cleaner template %r", CLEANER_DATA_CONF)
|
||||
LOG.info("Configuring cleaner template: %s", colorizer.quote(CLEANER_DATA_CONF))
|
||||
(_, contents) = utils.load_template(self.component_name, CLEANER_DATA_CONF)
|
||||
# FIXME, stop placing in checkout dir...
|
||||
tgt_fn = sh.joinpths(self.bin_dir, CLEANER_DATA_CONF)
|
||||
@ -324,13 +325,12 @@ class NovaInstaller(NovaMixin, comp.PythonInstallComponent):
|
||||
self.tracewriter.file_touched(tgt_fn)
|
||||
|
||||
def _setup_db(self):
|
||||
LOG.info("Fixing up database named %r", DB_NAME)
|
||||
db.drop_db(self.cfg, self.pw_gen, self.distro, DB_NAME)
|
||||
db.create_db(self.cfg, self.pw_gen, self.distro, DB_NAME)
|
||||
|
||||
def _generate_nova_conf(self, root_wrapped):
|
||||
conf_fn = self._get_target_config_name(API_CONF)
|
||||
LOG.info("Generating dynamic content for nova: %r" % (conf_fn))
|
||||
LOG.info("Generating dynamic content for nova: %s", colorizer.quote(conf_fn))
|
||||
nova_conf_contents = self.conf_maker.configure(root_wrapped)
|
||||
self.tracewriter.dirs_made(*sh.mkdirslist(sh.dirname(conf_fn)))
|
||||
self.tracewriter.cfg_file_written(sh.write_file(conf_fn, nova_conf_contents))
|
||||
|
@ -17,6 +17,7 @@
|
||||
import io
|
||||
|
||||
from devstack import cfg
|
||||
from devstack import colorizer
|
||||
from devstack import component as comp
|
||||
from devstack import log as logging
|
||||
from devstack import shell as sh
|
||||
@ -116,7 +117,7 @@ class QuantumInstaller(QuantumMixin, comp.PkgInstallComponent):
|
||||
'no-ovs-bridge-init' in self.options:
|
||||
return
|
||||
bridge = self.cfg.getdefaulted("quantum", "ovs_bridge", 'br-int')
|
||||
LOG.info("Fixing up ovs bridge named %s.", bridge)
|
||||
LOG.info("Fixing up ovs bridge named: %s", colorizer.quote(bridge))
|
||||
external_id = self.cfg.getdefaulted("quantum", 'ovs_bridge_external_name', bridge)
|
||||
params = dict()
|
||||
params['OVS_BRIDGE'] = bridge
|
||||
@ -138,7 +139,6 @@ class QuantumInstaller(QuantumMixin, comp.PkgInstallComponent):
|
||||
if not self.q_vswitch_service or \
|
||||
'no-ovs-db-init' in self.options:
|
||||
return
|
||||
LOG.info("Fixing up database named %r", DB_NAME)
|
||||
db.drop_db(self.cfg, self.pw_gen, self.distro, DB_NAME)
|
||||
db.create_db(self.cfg, self.pw_gen, self.distro, DB_NAME, utf8=True)
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
from tempfile import TemporaryFile
|
||||
|
||||
from devstack import colorizer
|
||||
from devstack import component as comp
|
||||
from devstack import log as logging
|
||||
from devstack import shell as sh
|
||||
@ -46,12 +47,12 @@ class RabbitUninstaller(comp.PkgUninstallComponent):
|
||||
def pre_uninstall(self):
|
||||
try:
|
||||
self.runtime.restart()
|
||||
LOG.info("Attempting to reset the rabbit-mq guest password to %r", RESET_BASE_PW)
|
||||
LOG.info("Attempting to reset the rabbit-mq guest password to: %s", colorizer.quote(RESET_BASE_PW))
|
||||
cmd = self.distro.get_command('rabbit-mq', 'change_password') + [RESET_BASE_PW]
|
||||
sh.execute(*cmd, run_as_root=True)
|
||||
except IOError:
|
||||
LOG.warn(("Could not reset the rabbit-mq password. You might have to manually "
|
||||
"reset the password to %r before the next install") % (RESET_BASE_PW))
|
||||
"reset the password to %s before the next install"), colorizer.quote(RESET_BASE_PW))
|
||||
|
||||
|
||||
class RabbitInstaller(comp.PkgInstallComponent):
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
import re
|
||||
|
||||
from devstack import colorizer
|
||||
from devstack import component as comp
|
||||
from devstack import log as logging
|
||||
from devstack import shell as sh
|
||||
|
@ -33,7 +33,7 @@ LOG = logging.getLogger(__name__)
|
||||
class DBInstaller(db.DBInstaller):
|
||||
|
||||
def _configure_db_confs(self):
|
||||
LOG.info("Fixing up %r mysql configs.", self.distro.name)
|
||||
LOG.info("Fixing up %s mysql configs.", colorizer.quote(self.distro.name))
|
||||
fc = sh.load_file('/etc/mysql/my.cnf')
|
||||
lines = fc.splitlines()
|
||||
new_lines = list()
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
import re
|
||||
|
||||
from devstack import colorizer
|
||||
from devstack import log as logging
|
||||
from devstack import shell as sh
|
||||
from devstack import utils
|
||||
@ -50,7 +51,7 @@ DEF_IDENT = 'unix-group:libvirtd'
|
||||
class DBInstaller(db.DBInstaller):
|
||||
|
||||
def _configure_db_confs(self):
|
||||
LOG.info("Fixing up %r mysql configs.", self.distro.name)
|
||||
LOG.info("Fixing up %s mysql configs.", colorizer.quote(self.distro.name))
|
||||
fc = sh.load_file('/etc/my.cnf')
|
||||
lines = fc.splitlines()
|
||||
new_lines = list()
|
||||
@ -68,14 +69,14 @@ class HorizonInstaller(horizon.HorizonInstaller):
|
||||
def _config_fix_wsgi(self):
|
||||
# This is recorded so it gets cleaned up during uninstall
|
||||
self.tracewriter.file_touched("/etc/httpd/conf.d/wsgi-socket-prefix.conf")
|
||||
LOG.info("Fixing up %r" % ("/etc/httpd/conf.d/wsgi-socket-prefix.conf"))
|
||||
LOG.info("Fixing up: %s", colorizer.quote("/etc/httpd/conf.d/wsgi-socket-prefix.conf"))
|
||||
contents = "WSGISocketPrefix %s" % (sh.joinpths(self.log_dir, "wsgi-socket"))
|
||||
with sh.Rooted(True):
|
||||
# The name seems to need to come after wsgi.conf (so thats what we are doing)
|
||||
sh.write_file("/etc/httpd/conf.d/wsgi-socket-prefix.conf", contents)
|
||||
|
||||
def _config_fix_httpd(self):
|
||||
LOG.info("Fixing up %r" % ('/etc/httpd/conf/httpd.conf'))
|
||||
LOG.info("Fixing up: %s", colorizer.quote('/etc/httpd/conf/httpd.conf'))
|
||||
(user, group) = self._get_apache_user_group()
|
||||
old_lines = sh.load_file('/etc/httpd/conf/httpd.conf').splitlines()
|
||||
new_lines = list()
|
||||
|
Loading…
x
Reference in New Issue
Block a user