From d72e8292b74d8d65bfd1a66c1d96a17bbcc35135 Mon Sep 17 00:00:00 2001 From: Sebastian Kalinowski Date: Wed, 24 Jun 2015 19:52:19 +0200 Subject: [PATCH] Rename all "utils/*_utils.py" NAME_utils.py was completely redundant and caused confusion so it was renamed to just utils/NAME.py Change-Id: Ifd9178772cca385f687ac9806e6043cfbf27813e Implements: blueprint volume-manager-refactoring --- etc/fuel-agent/fuel-agent.conf.sample | 4 ++-- fuel_agent/drivers/nailgun.py | 2 +- fuel_agent/manager.py | 14 +++++++------- fuel_agent/tests/test_artifact_utils.py | 2 +- fuel_agent/tests/test_build_utils.py | 16 ++++++++-------- fuel_agent/tests/test_fs_utils.py | 2 +- fuel_agent/tests/test_grub_utils.py | 6 +++--- fuel_agent/tests/test_hardware_utils.py | 4 ++-- fuel_agent/tests/test_lvm_utils.py | 2 +- fuel_agent/tests/test_manager.py | 12 ++++++------ fuel_agent/tests/test_md_utils.py | 6 +++--- fuel_agent/tests/test_nailgun.py | 2 +- fuel_agent/tests/test_partition_utils.py | 2 +- .../utils/{artifact_utils.py => artifact.py} | 0 fuel_agent/utils/{build_utils.py => build.py} | 2 +- fuel_agent/utils/{fs_utils.py => fs.py} | 0 fuel_agent/utils/{grub_utils.py => grub.py} | 0 .../utils/{hardware_utils.py => hardware.py} | 0 fuel_agent/utils/{lvm_utils.py => lvm.py} | 0 fuel_agent/utils/{md_utils.py => md.py} | 2 +- .../utils/{partition_utils.py => partition.py} | 0 21 files changed, 39 insertions(+), 39 deletions(-) rename fuel_agent/utils/{artifact_utils.py => artifact.py} (100%) rename fuel_agent/utils/{build_utils.py => build.py} (99%) rename fuel_agent/utils/{fs_utils.py => fs.py} (100%) rename fuel_agent/utils/{grub_utils.py => grub.py} (100%) rename fuel_agent/utils/{hardware_utils.py => hardware.py} (100%) rename fuel_agent/utils/{lvm_utils.py => lvm.py} (100%) rename fuel_agent/utils/{md_utils.py => md.py} (99%) rename fuel_agent/utils/{partition_utils.py => partition.py} (100%) diff --git a/etc/fuel-agent/fuel-agent.conf.sample b/etc/fuel-agent/fuel-agent.conf.sample index 0359d21..d86cf44 100644 --- a/etc/fuel-agent/fuel-agent.conf.sample +++ b/etc/fuel-agent/fuel-agent.conf.sample @@ -143,7 +143,7 @@ log_file=/var/log/fuel-agent.log # -# Options defined in fuel_agent.utils.artifact_utils +# Options defined in fuel_agent.utils.artifact # # Size of data chunk to operate with images (integer value) @@ -151,7 +151,7 @@ log_file=/var/log/fuel-agent.log # -# Options defined in fuel_agent.utils.build_utils +# Options defined in fuel_agent.utils.build # # Maximum allowed loop devices count to use (integer value) diff --git a/fuel_agent/drivers/nailgun.py b/fuel_agent/drivers/nailgun.py index 9c8d64d..63befa3 100644 --- a/fuel_agent/drivers/nailgun.py +++ b/fuel_agent/drivers/nailgun.py @@ -27,7 +27,7 @@ from fuel_agent.drivers import ks_spaces_validator from fuel_agent import errors from fuel_agent import objects from fuel_agent.openstack.common import log as logging -from fuel_agent.utils import hardware_utils as hu +from fuel_agent.utils import hardware as hu from fuel_agent.utils import utils diff --git a/fuel_agent/manager.py b/fuel_agent/manager.py index 89d4cf4..8455f79 100644 --- a/fuel_agent/manager.py +++ b/fuel_agent/manager.py @@ -22,13 +22,13 @@ from oslo.config import cfg from fuel_agent import errors from fuel_agent.openstack.common import log as logging -from fuel_agent.utils import artifact_utils as au -from fuel_agent.utils import build_utils as bu -from fuel_agent.utils import fs_utils as fu -from fuel_agent.utils import grub_utils as gu -from fuel_agent.utils import lvm_utils as lu -from fuel_agent.utils import md_utils as mu -from fuel_agent.utils import partition_utils as pu +from fuel_agent.utils import artifact as au +from fuel_agent.utils import build as bu +from fuel_agent.utils import fs as fu +from fuel_agent.utils import grub as gu +from fuel_agent.utils import lvm as lu +from fuel_agent.utils import md as mu +from fuel_agent.utils import partition as pu from fuel_agent.utils import utils opts = [ diff --git a/fuel_agent/tests/test_artifact_utils.py b/fuel_agent/tests/test_artifact_utils.py index a93f66e..d3dc07f 100644 --- a/fuel_agent/tests/test_artifact_utils.py +++ b/fuel_agent/tests/test_artifact_utils.py @@ -19,7 +19,7 @@ import zlib from oslo.config import cfg from fuel_agent import errors -from fuel_agent.utils import artifact_utils as au +from fuel_agent.utils import artifact as au from fuel_agent.utils import utils diff --git a/fuel_agent/tests/test_build_utils.py b/fuel_agent/tests/test_build_utils.py index f67346a..28972b6 100644 --- a/fuel_agent/tests/test_build_utils.py +++ b/fuel_agent/tests/test_build_utils.py @@ -21,8 +21,8 @@ import mock from oslo.config import cfg from fuel_agent import errors -from fuel_agent.utils import build_utils as bu -from fuel_agent.utils import hardware_utils as hu +from fuel_agent.utils import build as bu +from fuel_agent.utils import hardware as hu from fuel_agent.utils import utils @@ -160,7 +160,7 @@ class BuildUtilsTestCase(testtools.TestCase): 'etc/apt/apt.conf.d/%s' % 'force_ipv4', 'etc/apt/apt.conf.d/%s' % 'unsigned']) - @mock.patch('fuel_agent.utils.build_utils.open', + @mock.patch('fuel_agent.utils.build.open', create=True, new_callable=mock.mock_open) @mock.patch.object(os, 'path') @mock.patch.object(bu, 'clean_apt_settings') @@ -186,9 +186,9 @@ class BuildUtilsTestCase(testtools.TestCase): self.assertEqual(mock_path_join_expected_calls, mock_path.join.call_args_list) - @mock.patch('fuel_agent.utils.build_utils.open', + @mock.patch('fuel_agent.utils.build.open', create=True, new_callable=mock.mock_open) - @mock.patch('fuel_agent.utils.build_utils.time.sleep') + @mock.patch('fuel_agent.utils.build.time.sleep') @mock.patch.object(os, 'kill') @mock.patch.object(os, 'readlink', return_value='chroot') @mock.patch.object(utils, 'execute') @@ -333,7 +333,7 @@ class BuildUtilsTestCase(testtools.TestCase): mock_path.join.call_args_list) @mock.patch.object(os, 'path') - @mock.patch('fuel_agent.utils.build_utils.utils.init_http_request', + @mock.patch('fuel_agent.utils.build.utils.init_http_request', return_value=mock.Mock(text=_fake_ubuntu_release)) def test_add_apt_preference(self, mock_get, mock_path): with mock.patch('six.moves.builtins.open', create=True) as mock_open: @@ -371,7 +371,7 @@ class BuildUtilsTestCase(testtools.TestCase): mock_path.join.call_args_list) @mock.patch.object(os, 'path') - @mock.patch('fuel_agent.utils.build_utils.utils.init_http_request', + @mock.patch('fuel_agent.utils.build.utils.init_http_request', return_value=mock.Mock(text=_fake_ubuntu_release)) def test_add_apt_preference_multuple_sections(self, mock_get, mock_path): with mock.patch('six.moves.builtins.open', create=True) as mock_open: @@ -414,7 +414,7 @@ class BuildUtilsTestCase(testtools.TestCase): mock_path.join.call_args_list) @mock.patch.object(os, 'path') - @mock.patch('fuel_agent.utils.build_utils.utils.init_http_request', + @mock.patch('fuel_agent.utils.build.utils.init_http_request', return_value=mock.Mock(text=_fake_ubuntu_release)) def test_add_apt_preference_no_sections(self, mock_get, mock_path): with mock.patch('six.moves.builtins.open', create=True) as mock_open: diff --git a/fuel_agent/tests/test_fs_utils.py b/fuel_agent/tests/test_fs_utils.py index a76bf32..359f2dc 100644 --- a/fuel_agent/tests/test_fs_utils.py +++ b/fuel_agent/tests/test_fs_utils.py @@ -16,7 +16,7 @@ import mock from oslotest import base as test_base from fuel_agent import errors -from fuel_agent.utils import fs_utils as fu +from fuel_agent.utils import fs as fu from fuel_agent.utils import utils diff --git a/fuel_agent/tests/test_grub_utils.py b/fuel_agent/tests/test_grub_utils.py index e310063..f98482e 100644 --- a/fuel_agent/tests/test_grub_utils.py +++ b/fuel_agent/tests/test_grub_utils.py @@ -24,7 +24,7 @@ else: OPEN_FUNCTION_NAME = 'builtins.open' from fuel_agent import errors -from fuel_agent.utils import grub_utils as gu +from fuel_agent.utils import grub as gu from fuel_agent.utils import utils @@ -205,7 +205,7 @@ class TestGrubUtils(test_base.BaseTestCase): self.assertEqual(gu.guess_grub_install('/target'), '/usr/sbin/grub2-install') - @mock.patch('fuel_agent.utils.grub_utils.utils.guess_filename') + @mock.patch('fuel_agent.utils.grub.utils.guess_filename') def test_guess_kernel(self, mock_guess): mock_guess.return_value = 'vmlinuz-version' self.assertEqual(gu.guess_kernel('/target'), 'vmlinuz-version') @@ -223,7 +223,7 @@ class TestGrubUtils(test_base.BaseTestCase): mock_guess.return_value = None self.assertRaises(errors.GrubUtilsError, gu.guess_kernel, '/target') - @mock.patch('fuel_agent.utils.grub_utils.utils.guess_filename') + @mock.patch('fuel_agent.utils.grub.utils.guess_filename') def test_guess_initrd(self, mock_guess): mock_guess.return_value = 'initrd-version' self.assertEqual(gu.guess_initrd('/target'), 'initrd-version') diff --git a/fuel_agent/tests/test_hardware_utils.py b/fuel_agent/tests/test_hardware_utils.py index 452495b..eeb47e6 100644 --- a/fuel_agent/tests/test_hardware_utils.py +++ b/fuel_agent/tests/test_hardware_utils.py @@ -15,7 +15,7 @@ import mock from oslotest import base as test_base -from fuel_agent.utils import hardware_utils as hu +from fuel_agent.utils import hardware as hu from fuel_agent.utils import utils @@ -280,7 +280,7 @@ supports-register-dump: yes } self.assertFalse(hu.is_disk('/dev/fake', bspec=bspec)) - @mock.patch('fuel_agent.utils.hardware_utils.utils.execute') + @mock.patch('fuel_agent.utils.hardware.utils.execute') def test_get_block_devices_from_udev_db(self, mock_exec): mock_exec.return_value = ("""P: /devices/virtual/block/loop0 N: loop0 diff --git a/fuel_agent/tests/test_lvm_utils.py b/fuel_agent/tests/test_lvm_utils.py index 7cb52e8..d4e7048 100644 --- a/fuel_agent/tests/test_lvm_utils.py +++ b/fuel_agent/tests/test_lvm_utils.py @@ -16,7 +16,7 @@ import mock from oslotest import base as test_base from fuel_agent import errors -from fuel_agent.utils import lvm_utils as lu +from fuel_agent.utils import lvm as lu from fuel_agent.utils import utils diff --git a/fuel_agent/tests/test_manager.py b/fuel_agent/tests/test_manager.py index 176b61e..f8d99b1 100644 --- a/fuel_agent/tests/test_manager.py +++ b/fuel_agent/tests/test_manager.py @@ -24,12 +24,12 @@ from fuel_agent import manager from fuel_agent import objects from fuel_agent.objects import partition from fuel_agent.tests import test_nailgun -from fuel_agent.utils import artifact_utils as au -from fuel_agent.utils import fs_utils as fu -from fuel_agent.utils import hardware_utils as hu -from fuel_agent.utils import lvm_utils as lu -from fuel_agent.utils import md_utils as mu -from fuel_agent.utils import partition_utils as pu +from fuel_agent.utils import artifact as au +from fuel_agent.utils import fs as fu +from fuel_agent.utils import hardware as hu +from fuel_agent.utils import lvm as lu +from fuel_agent.utils import md as mu +from fuel_agent.utils import partition as pu from fuel_agent.utils import utils CONF = cfg.CONF diff --git a/fuel_agent/tests/test_md_utils.py b/fuel_agent/tests/test_md_utils.py index 0e7a015..4be957f 100644 --- a/fuel_agent/tests/test_md_utils.py +++ b/fuel_agent/tests/test_md_utils.py @@ -17,8 +17,8 @@ from oslotest import base as test_base import six from fuel_agent import errors -from fuel_agent.utils import hardware_utils as hu -from fuel_agent.utils import md_utils as mu +from fuel_agent.utils import hardware as hu +from fuel_agent.utils import md as mu from fuel_agent.utils import utils @@ -30,7 +30,7 @@ else: class TestMdUtils(test_base.BaseTestCase): - @mock.patch('fuel_agent.utils.md_utils.utils.execute') + @mock.patch('fuel_agent.utils.md.utils.execute') def test_mddisplay_nostate_detail(self, mock_exec): mock_exec.return_value = ( """/dev/md127: diff --git a/fuel_agent/tests/test_nailgun.py b/fuel_agent/tests/test_nailgun.py index e391b28..8fc5929 100644 --- a/fuel_agent/tests/test_nailgun.py +++ b/fuel_agent/tests/test_nailgun.py @@ -21,7 +21,7 @@ import yaml from fuel_agent.drivers import nailgun from fuel_agent import errors from fuel_agent.objects import image -from fuel_agent.utils import hardware_utils as hu +from fuel_agent.utils import hardware as hu from fuel_agent.utils import utils diff --git a/fuel_agent/tests/test_partition_utils.py b/fuel_agent/tests/test_partition_utils.py index 9f05b3b..563dbf6 100644 --- a/fuel_agent/tests/test_partition_utils.py +++ b/fuel_agent/tests/test_partition_utils.py @@ -17,7 +17,7 @@ from oslotest import base as test_base import time from fuel_agent import errors -from fuel_agent.utils import partition_utils as pu +from fuel_agent.utils import partition as pu from fuel_agent.utils import utils diff --git a/fuel_agent/utils/artifact_utils.py b/fuel_agent/utils/artifact.py similarity index 100% rename from fuel_agent/utils/artifact_utils.py rename to fuel_agent/utils/artifact.py diff --git a/fuel_agent/utils/build_utils.py b/fuel_agent/utils/build.py similarity index 99% rename from fuel_agent/utils/build_utils.py rename to fuel_agent/utils/build.py index 4f53fee..d028053 100644 --- a/fuel_agent/utils/build_utils.py +++ b/fuel_agent/utils/build.py @@ -28,7 +28,7 @@ from oslo.config import cfg from fuel_agent import errors from fuel_agent.openstack.common import log as logging -from fuel_agent.utils import hardware_utils as hu +from fuel_agent.utils import hardware as hu from fuel_agent.utils import utils LOG = logging.getLogger(__name__) diff --git a/fuel_agent/utils/fs_utils.py b/fuel_agent/utils/fs.py similarity index 100% rename from fuel_agent/utils/fs_utils.py rename to fuel_agent/utils/fs.py diff --git a/fuel_agent/utils/grub_utils.py b/fuel_agent/utils/grub.py similarity index 100% rename from fuel_agent/utils/grub_utils.py rename to fuel_agent/utils/grub.py diff --git a/fuel_agent/utils/hardware_utils.py b/fuel_agent/utils/hardware.py similarity index 100% rename from fuel_agent/utils/hardware_utils.py rename to fuel_agent/utils/hardware.py diff --git a/fuel_agent/utils/lvm_utils.py b/fuel_agent/utils/lvm.py similarity index 100% rename from fuel_agent/utils/lvm_utils.py rename to fuel_agent/utils/lvm.py diff --git a/fuel_agent/utils/md_utils.py b/fuel_agent/utils/md.py similarity index 99% rename from fuel_agent/utils/md_utils.py rename to fuel_agent/utils/md.py index 88c7a8a..b08deb8 100644 --- a/fuel_agent/utils/md_utils.py +++ b/fuel_agent/utils/md.py @@ -16,7 +16,7 @@ import re from fuel_agent import errors from fuel_agent.openstack.common import log as logging -from fuel_agent.utils import hardware_utils as hu +from fuel_agent.utils import hardware as hu from fuel_agent.utils import utils LOG = logging.getLogger(__name__) diff --git a/fuel_agent/utils/partition_utils.py b/fuel_agent/utils/partition.py similarity index 100% rename from fuel_agent/utils/partition_utils.py rename to fuel_agent/utils/partition.py