Merge "We don't need utils.trycmd any more."

This commit is contained in:
Zuul 2018-05-16 14:45:43 +00:00 committed by Gerrit Code Review
commit 3693caa541
3 changed files with 4 additions and 15 deletions

View File

@ -67,9 +67,8 @@ class ConfigDriveTestCase(test.NoDBTestCase):
@mock.patch('nova.privsep.fs.unprivileged_mkfs', return_value=None)
@mock.patch('nova.privsep.fs.mount', return_value=('', ''))
@mock.patch('nova.privsep.fs.umount', return_value=None)
@mock.patch.object(utils, 'trycmd', return_value=(None, None))
def test_create_configdrive_vfat(self, mock_trycmd, mock_umount,
mock_mount, mock_mkfs):
def test_create_configdrive_vfat(
self, mock_umount, mock_mount, mock_mkfs):
CONF.set_override('config_drive_format', 'vfat')
imagefile = None
try:

View File

@ -243,17 +243,6 @@ def ssh_execute(dest, *cmd, **kwargs):
return execute(*ssh_cmd, **kwargs)
def trycmd(*args, **kwargs):
"""Convenience wrapper around oslo's trycmd() method."""
if kwargs.get('run_as_root', False):
if CONF.use_rootwrap_daemon:
return RootwrapDaemonHelper(CONF.rootwrap_config).trycmd(
*args, **kwargs)
else:
return RootwrapProcessHelper().trycmd(*args, **kwargs)
return processutils.trycmd(*args, **kwargs)
def generate_uid(topic, size=8):
characters = '01234567890abcdefghijklmnopqrstuvwxyz'
choices = [random.choice(characters) for _x in range(size)]

View File

@ -21,6 +21,7 @@ import os
import shutil
from castellan import key_manager
from oslo_concurrency import processutils
from oslo_log import log as logging
from oslo_serialization import jsonutils
from oslo_utils import excutils
@ -259,7 +260,7 @@ class Image(object):
can_fallocate = getattr(self.__class__, 'can_fallocate', None)
if can_fallocate is None:
test_path = self.path + '.fallocate_test'
_out, err = utils.trycmd('fallocate', '-l', '1', test_path)
_out, err = processutils.trycmd('fallocate', '-l', '1', test_path)
fileutils.delete_if_exists(test_path)
can_fallocate = not err
self.__class__.can_fallocate = can_fallocate