Merge "Remove locals() from messages in virt/disk/api.py"
This commit is contained in:
commit
505af894f3
@ -131,7 +131,8 @@ def can_resize_fs(image, size, use_cow=False):
|
||||
"""Check whether we can resize contained file system."""
|
||||
|
||||
LOG.debug(_('Checking if we can resize image %(image)s. '
|
||||
'size=%(size)s, CoW=%(use_cow)s'), locals())
|
||||
'size=%(size)s, CoW=%(use_cow)s'),
|
||||
{'image': image, 'size': size, 'use_cow': use_cow})
|
||||
|
||||
# Check that we're increasing the size
|
||||
virt_size = get_disk_size(image)
|
||||
@ -281,9 +282,10 @@ def inject_data(image, key=None, net=None, metadata=None, admin_password=None,
|
||||
Raises an exception if a mandatory item can't be injected.
|
||||
"""
|
||||
LOG.debug(_("Inject data image=%(image)s key=%(key)s net=%(net)s "
|
||||
"metadata=%(metadata)s admin_password=ha-ha-not-telling-you "
|
||||
"files=%(files)s partition=%(partition)s use_cow=%(use_cow)s")
|
||||
% locals())
|
||||
"metadata=%(metadata)s admin_password=<SANITIZED> "
|
||||
"files=%(files)s partition=%(partition)s use_cow=%(use_cow)s"),
|
||||
{'image': image, 'key': key, 'net': net, 'metadata': metadata,
|
||||
'files': files, 'partition': partition, 'use_cow': use_cow})
|
||||
fmt = "raw"
|
||||
if use_cow:
|
||||
fmt = "qcow2"
|
||||
@ -298,7 +300,7 @@ def inject_data(image, key=None, net=None, metadata=None, admin_password=None,
|
||||
if inject_val:
|
||||
raise
|
||||
LOG.warn(_('Ignoring error injecting data into image '
|
||||
'(%(e)s)') % locals())
|
||||
'(%(e)s)'), {'e': e})
|
||||
return False
|
||||
|
||||
try:
|
||||
@ -317,7 +319,7 @@ def setup_container(image, container_dir, use_cow=False):
|
||||
img = _DiskImage(image=image, use_cow=use_cow, mount_dir=container_dir)
|
||||
if not img.mount():
|
||||
LOG.error(_("Failed to mount container filesystem '%(image)s' "
|
||||
"on '%(target)s': %(errors)s") %
|
||||
"on '%(target)s': %(errors)s"),
|
||||
{"image": img, "target": container_dir,
|
||||
"errors": img.errors})
|
||||
raise exception.NovaException(img.errors)
|
||||
@ -372,7 +374,7 @@ def inject_data_into_fs(fs, key, net, metadata, admin_password, files,
|
||||
if inject in mandatory:
|
||||
raise
|
||||
LOG.warn(_('Ignoring error injecting %(inject)s into image '
|
||||
'(%(e)s)') % locals())
|
||||
'(%(e)s)'), {'e': e})
|
||||
status = False
|
||||
return status
|
||||
|
||||
@ -383,8 +385,8 @@ def _inject_files_into_fs(files, fs):
|
||||
|
||||
|
||||
def _inject_file_into_fs(fs, path, contents, append=False):
|
||||
LOG.debug(_("Inject file fs=%(fs)s path=%(path)s append=%(append)s") %
|
||||
locals())
|
||||
LOG.debug(_("Inject file fs=%(fs)s path=%(path)s append=%(append)s"),
|
||||
{'fs': fs, 'path': path, 'append': append})
|
||||
if append:
|
||||
fs.append_file(path, contents)
|
||||
else:
|
||||
@ -392,8 +394,8 @@ def _inject_file_into_fs(fs, path, contents, append=False):
|
||||
|
||||
|
||||
def _inject_metadata_into_fs(metadata, fs):
|
||||
LOG.debug(_("Inject metadata fs=%(fs)s metadata=%(metadata)s") %
|
||||
locals())
|
||||
LOG.debug(_("Inject metadata fs=%(fs)s metadata=%(metadata)s"),
|
||||
{'fs': fs, 'metadata': metadata})
|
||||
metadata = dict([(m['key'], m['value']) for m in metadata])
|
||||
_inject_file_into_fs(fs, 'meta.js', jsonutils.dumps(metadata))
|
||||
|
||||
@ -433,8 +435,7 @@ def _inject_key_into_fs(key, fs):
|
||||
fs is the path to the base of the filesystem into which to inject the key.
|
||||
"""
|
||||
|
||||
LOG.debug(_("Inject key fs=%(fs)s key=%(key)s") %
|
||||
locals())
|
||||
LOG.debug(_("Inject key fs=%(fs)s key=%(key)s"), {'fs': fs, 'key': key})
|
||||
sshdir = os.path.join('root', '.ssh')
|
||||
fs.make_path(sshdir)
|
||||
fs.set_ownership(sshdir, "root", "root")
|
||||
@ -462,8 +463,7 @@ def _inject_net_into_fs(net, fs):
|
||||
net is the contents of /etc/network/interfaces.
|
||||
"""
|
||||
|
||||
LOG.debug(_("Inject key fs=%(fs)s net=%(net)s") %
|
||||
locals())
|
||||
LOG.debug(_("Inject key fs=%(fs)s net=%(net)s"), {'fs': fs, 'net': net})
|
||||
netdir = os.path.join('etc', 'network')
|
||||
fs.make_path(netdir)
|
||||
fs.set_ownership(netdir, "root", "root")
|
||||
@ -489,8 +489,7 @@ def _inject_admin_password_into_fs(admin_passwd, fs):
|
||||
# necessary changes, and then copy them back.
|
||||
|
||||
LOG.debug(_("Inject admin password fs=%(fs)s "
|
||||
"admin_passwd=ha-ha-not-telling-you") %
|
||||
locals())
|
||||
"admin_passwd=<SANITIZED>"), {'fs': fs})
|
||||
admin_user = 'root'
|
||||
|
||||
fd, tmp_passwd = tempfile.mkstemp()
|
||||
|
Loading…
Reference in New Issue
Block a user