Rename fuel_agent into bareon

Change-Id: I5c0552db35595b726c35ab5dab626cc326ef759f
Closes-bug: #1524269
This commit is contained in:
Evgeniy L 2015-12-15 12:44:53 +03:00
parent 12a5d7e567
commit 99528c2de7
82 changed files with 442 additions and 442 deletions

View File

@ -65,7 +65,7 @@ bareon
├── contrib ├── contrib
├── debian ├── debian
├── etc ├── etc
├── fuel_agent ├── bareon
│   ├── cmd │   ├── cmd
│   ├── drivers │   ├── drivers
│   ├── objects │   ├── objects
@ -108,28 +108,28 @@ Included debian rules are mainly suitable for Ubuntu 12.04 or higher.
This folder contains the sample config file for bareon. Every parameter is well documented. This folder contains the sample config file for bareon. Every parameter is well documented.
We use oslo-config as a configuration module. We use oslo-config as a configuration module.
### fuel_agent ### bareon
This folder contains the python code: drivers, objects, unit tests and utils, manager and entry points. This folder contains the python code: drivers, objects, unit tests and utils, manager and entry points.
- fuel_agent/cmd/agent.py - bareon/cmd/agent.py
* That is where executable entry points are. It reads input data and * That is where executable entry points are. It reads input data and
instantiates Manager class with these data. instantiates Manager class with these data.
- fuel_agent/manager.py - bareon/manager.py
* That is the file where the top level agent logic is implemented. * That is the file where the top level agent logic is implemented.
It contains all those methods which do something useful (do_*) It contains all those methods which do something useful (do_*)
- fuel_agent/drivers - bareon/drivers
* That is where input data drivers are located. * That is where input data drivers are located.
(Nailgun, NailgunBuildImage, Simple etc.) (Nailgun, NailgunBuildImage, Simple etc.)
Data drivers convert json into a set of python objects. Data drivers convert json into a set of python objects.
- fuel_agent/objects - bareon/objects
* Here is the place where python objects are defined. Bareon manager * Here is the place where python objects are defined. Bareon manager
does not understand any particular data format except these objects. does not understand any particular data format except these objects.
For example, to do disk partitioning we need PartitionScheme object. For example, to do disk partitioning we need PartitionScheme object.
PartitionScheme object in turn contains disk labels, plain partitions, PartitionScheme object in turn contains disk labels, plain partitions,
lvm, md, fs objects. This PartitionScheme object is to be created by input lvm, md, fs objects. This PartitionScheme object is to be created by input
data driver. data driver.
- fuel_agent/utils - bareon/utils
* That is the place where we put the code which does something useful on the OS * That is the place where we put the code which does something useful on the OS
level. Here we have simple parted, lvm, md, grub bindings, etc. level. Here we have simple parted, lvm, md, grub bindings, etc.
@ -172,7 +172,7 @@ input data drivers available. Those are
In order to be able to use another specific data format one can implement his own data In order to be able to use another specific data format one can implement his own data
driver and install it independently. Bareon uses stevedore to find installed drivers. driver and install it independently. Bareon uses stevedore to find installed drivers.
A new driver needs to be exposed via fuel_agent.driver setuptools name space. See for example A new driver needs to be exposed via bareon.driver setuptools name space. See for example
setup.cfg file where entry points are defined. setup.cfg file where entry points are defined.
One can also take a look at ```contrib``` directory for some additional examples. One can also take a look at ```contrib``` directory for some additional examples.

View File

@ -18,9 +18,9 @@ from oslo_config import cfg
import six import six
import yaml import yaml
from fuel_agent import manager as manager from bareon import manager as manager
from fuel_agent.openstack.common import log as logging from bareon.openstack.common import log as logging
from fuel_agent import version from bareon import version
cli_opts = [ cli_opts = [
cfg.StrOpt( cfg.StrOpt(
@ -81,10 +81,10 @@ def handle_exception(exc):
def main(actions=None): def main(actions=None):
CONF(sys.argv[1:], project='fuel-agent', CONF(sys.argv[1:], project='bareon',
version=version.version_info.release_string()) version=version.version_info.release_string())
logging.setup('fuel-agent') logging.setup('bareon')
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
try: try:

View File

@ -18,7 +18,7 @@ import time
import requests import requests
from fuel_agent.utils import utils from bareon.utils import utils
def _process_error(message): def _process_error(message):

View File

@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from fuel_agent.drivers import nailgun from bareon.drivers import nailgun
from fuel_agent.objects import base from bareon.objects import base
class BootstrapBuildImage(nailgun.NailgunBuildImage): class BootstrapBuildImage(nailgun.NailgunBuildImage):

View File

@ -14,8 +14,8 @@
import jsonschema import jsonschema
from fuel_agent import errors from bareon import errors
from fuel_agent.openstack.common import log as logging from bareon.openstack.common import log as logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -23,20 +23,20 @@ from six.moves.urllib.parse import urlparse
from six.moves.urllib.parse import urlsplit from six.moves.urllib.parse import urlsplit
import yaml import yaml
from fuel_agent.drivers.base import BaseDataDriver from bareon.drivers.base import BaseDataDriver
from fuel_agent.drivers import ks_spaces_validator from bareon.drivers import ks_spaces_validator
from fuel_agent import errors from bareon import errors
from fuel_agent import objects from bareon import objects
from fuel_agent.openstack.common import log as logging from bareon.openstack.common import log as logging
from fuel_agent.utils import hardware as hu from bareon.utils import hardware as hu
from fuel_agent.utils import utils from bareon.utils import utils
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
CONF = cfg.CONF CONF = cfg.CONF
CONF.import_opt('prepare_configdrive', 'fuel_agent.manager') CONF.import_opt('prepare_configdrive', 'bareon.manager')
CONF.import_opt('config_drive_path', 'fuel_agent.manager') CONF.import_opt('config_drive_path', 'bareon.manager')
def match_device(hu_disk, ks_disk): def match_device(hu_disk, ks_disk):
@ -333,7 +333,7 @@ class Nailgun(BaseDataDriver):
# FIXME(agordeev): NVMe drives should be skipped as # FIXME(agordeev): NVMe drives should be skipped as
# accessing such drives during the boot typically # accessing such drives during the boot typically
# requires using UEFI which is still not supported # requires using UEFI which is still not supported
# by fuel-agent (it always installs BIOS variant of # by bareon (it always installs BIOS variant of
# grub) # grub)
# * grub bug (http://savannah.gnu.org/bugs/?41883) # * grub bug (http://savannah.gnu.org/bugs/?41883)
# NOTE(kozhukalov): On some hardware GRUB is not able # NOTE(kozhukalov): On some hardware GRUB is not able

View File

@ -14,8 +14,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from fuel_agent.drivers import nailgun from bareon.drivers import nailgun
from fuel_agent import objects from bareon import objects
class NailgunSimpleDriver(nailgun.Nailgun): class NailgunSimpleDriver(nailgun.Nailgun):
@ -23,7 +23,7 @@ class NailgunSimpleDriver(nailgun.Nailgun):
This driver digest information that already has all required This driver digest information that already has all required
information how to perform partitioning. information how to perform partitioning.
Service that sends data to fuel_agent is responsible for preparing Service that sends data to bareon is responsible for preparing
it in correct format. it in correct format.
""" """

View File

@ -21,22 +21,22 @@ from oslo_config import cfg
import six import six
import yaml import yaml
from fuel_agent import errors from bareon import errors
from fuel_agent.openstack.common import log as logging from bareon.openstack.common import log as logging
from fuel_agent.utils import artifact as au from bareon.utils import artifact as au
from fuel_agent.utils import build as bu from bareon.utils import build as bu
from fuel_agent.utils import fs as fu from bareon.utils import fs as fu
from fuel_agent.utils import grub as gu from bareon.utils import grub as gu
from fuel_agent.utils import hardware as hw from bareon.utils import hardware as hw
from fuel_agent.utils import lvm as lu from bareon.utils import lvm as lu
from fuel_agent.utils import md as mu from bareon.utils import md as mu
from fuel_agent.utils import partition as pu from bareon.utils import partition as pu
from fuel_agent.utils import utils from bareon.utils import utils
opts = [ opts = [
cfg.StrOpt( cfg.StrOpt(
'nc_template_path', 'nc_template_path',
default='/usr/share/fuel-agent/cloud-init-templates', default='/usr/share/bareon/cloud-init-templates',
help='Path to directory with cloud init templates', help='Path to directory with cloud init templates',
), ),
cfg.StrOpt( cfg.StrOpt(
@ -71,7 +71,7 @@ opts = [
), ),
cfg.StrOpt( cfg.StrOpt(
'image_build_suffix', 'image_build_suffix',
default='.fuel-agent-image', default='.bareon-image',
help='Suffix which is used while creating temporary files', help='Suffix which is used while creating temporary files',
), ),
cfg.IntOpt( cfg.IntOpt(
@ -704,7 +704,7 @@ class Manager(object):
# should work # should work
with open(chroot + '/etc/udev/rules.d/70-persistent-net.rules', with open(chroot + '/etc/udev/rules.d/70-persistent-net.rules',
'wt', encoding='utf-8') as f: 'wt', encoding='utf-8') as f:
f.write(u'# Generated by fuel-agent during provisioning: ' f.write(u'# Generated by bareon during provisioning: '
u'BEGIN\n') u'BEGIN\n')
# pattern is aa:bb:cc:dd:ee:ff_eth0,aa:bb:cc:dd:ee:ff_eth1 # pattern is aa:bb:cc:dd:ee:ff_eth0,aa:bb:cc:dd:ee:ff_eth1
for mapping in self.driver.configdrive_scheme. \ for mapping in self.driver.configdrive_scheme. \
@ -715,13 +715,13 @@ class Manager(object):
u'KERNEL=="eth*", NAME="%s"\n' % (mac_addr, u'KERNEL=="eth*", NAME="%s"\n' % (mac_addr,
nic_name)) nic_name))
f.write( f.write(
u'# Generated by fuel-agent during provisioning: END\n') u'# Generated by bareon during provisioning: END\n')
# FIXME(agordeev): Disable net-generator that will add new etries # FIXME(agordeev): Disable net-generator that will add new etries
# to 70-persistent-net.rules # to 70-persistent-net.rules
with open(chroot + '/etc/udev/rules.d/' with open(chroot + '/etc/udev/rules.d/'
'75-persistent-net-generator.rules', 'wt', '75-persistent-net-generator.rules', 'wt',
encoding='utf-8') as f: encoding='utf-8') as f:
f.write(u'# Generated by fuel-agent during provisioning:\n' f.write(u'# Generated by bareon during provisioning:\n'
u'# DO NOT DELETE. It is needed to disable ' u'# DO NOT DELETE. It is needed to disable '
u'net-generator\n') u'net-generator\n')

View File

@ -0,0 +1,73 @@
# Copyright 2014 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from bareon.objects.bootloader import Grub
from bareon.objects.configdrive import ConfigDriveCommon
from bareon.objects.configdrive import ConfigDriveMcollective
from bareon.objects.configdrive import ConfigDrivePuppet
from bareon.objects.configdrive import ConfigDriveScheme
from bareon.objects.device import Loop
from bareon.objects.image import Image
from bareon.objects.image import ImageScheme
from bareon.objects.operating_system import Centos
from bareon.objects.operating_system import OperatingSystem
from bareon.objects.operating_system import Ubuntu
from bareon.objects.partition.fs import FileSystem
from bareon.objects.partition.lv import LogicalVolume
from bareon.objects.partition.md import MultipleDevice
from bareon.objects.partition.parted import Parted
from bareon.objects.partition.parted import Partition
from bareon.objects.partition.pv import PhysicalVolume
from bareon.objects.partition.scheme import PartitionScheme
from bareon.objects.partition.vg import VolumeGroup
from bareon.objects.repo import DEBRepo
from bareon.objects.repo import Repo
from bareon.objects.repo import RepoProxies
PV = PhysicalVolume
VG = VolumeGroup
LV = LogicalVolume
MD = MultipleDevice
FS = FileSystem
__all__ = [
'Partition',
'Parted',
'PhysicalVolume',
'PV',
'VolumeGroup',
'VG',
'LogicalVolume',
'LV',
'MultipleDevice',
'MD',
'FileSystem',
'FS',
'PartitionScheme',
'ConfigDriveCommon',
'ConfigDrivePuppet',
'ConfigDriveMcollective',
'ConfigDriveScheme',
'Image',
'ImageScheme',
'Grub',
'OperatingSystem',
'Ubuntu',
'Centos',
'Repo',
'DEBRepo',
'Loop',
'RepoProxies'
]

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from fuel_agent import errors from bareon import errors
class ConfigDriveCommon(object): class ConfigDriveCommon(object):

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from fuel_agent import errors from bareon import errors
class Loop(object): class Loop(object):

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from fuel_agent import errors from bareon import errors
class Image(object): class Image(object):

View File

@ -13,7 +13,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from fuel_agent.objects import base from bareon.objects import base
class FileSystem(base.Serializable): class FileSystem(base.Serializable):

View File

@ -13,7 +13,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from fuel_agent.objects import base from bareon.objects import base
class LogicalVolume(base.Serializable): class LogicalVolume(base.Serializable):

View File

@ -13,8 +13,8 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from fuel_agent import errors from bareon import errors
from fuel_agent.objects import base from bareon.objects import base
class MultipleDevice(base.Serializable): class MultipleDevice(base.Serializable):

View File

@ -16,8 +16,8 @@
import copy import copy
from fuel_agent.objects import base from bareon.objects import base
from fuel_agent.openstack.common import log as logging from bareon.openstack.common import log as logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -13,7 +13,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from fuel_agent.objects import base from bareon.objects import base
class PhysicalVolume(base.Serializable): class PhysicalVolume(base.Serializable):

View File

@ -15,15 +15,15 @@
# under the License. # under the License.
import os import os
from fuel_agent import errors from bareon import errors
from fuel_agent.objects.partition.fs import FileSystem from bareon.objects.partition.fs import FileSystem
from fuel_agent.objects.partition.lv import LogicalVolume from bareon.objects.partition.lv import LogicalVolume
from fuel_agent.objects.partition.md import MultipleDevice from bareon.objects.partition.md import MultipleDevice
from fuel_agent.objects.partition.parted import Parted from bareon.objects.partition.parted import Parted
from fuel_agent.objects.partition.pv import PhysicalVolume from bareon.objects.partition.pv import PhysicalVolume
from fuel_agent.objects.partition.vg import VolumeGroup from bareon.objects.partition.vg import VolumeGroup
from fuel_agent.openstack.common import log as logging from bareon.openstack.common import log as logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -13,7 +13,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from fuel_agent.objects import base from bareon.objects import base
class VolumeGroup(base.Serializable): class VolumeGroup(base.Serializable):

View File

@ -31,10 +31,10 @@ from oslo_config import cfg
import six import six
import stevedore.named import stevedore.named
from fuel_agent.openstack.common import gettextutils from bareon.openstack.common import gettextutils
from fuel_agent.openstack.common import importutils from bareon.openstack.common import importutils
gettextutils.install('fuel_agent') gettextutils.install('bareon')
STROPT = "StrOpt" STROPT = "StrOpt"
BOOLOPT = "BoolOpt" BOOLOPT = "BoolOpt"
@ -238,11 +238,11 @@ def _sanitize_default(name, value):
return '10.0.0.1' return '10.0.0.1'
elif value in (hostname, fqdn): elif value in (hostname, fqdn):
if 'host' in name: if 'host' in name:
return 'fuel_agent' return 'bareon'
elif value.endswith(hostname): elif value.endswith(hostname):
return value.replace(hostname, 'fuel_agent') return value.replace(hostname, 'bareon')
elif value.endswith(fqdn): elif value.endswith(fqdn):
return value.replace(fqdn, 'fuel_agent') return value.replace(fqdn, 'bareon')
elif value.strip() != value: elif value.strip() != value:
return '"%s"' % value return '"%s"' % value
return value return value

View File

@ -19,7 +19,7 @@ gettext for openstack-common modules.
Usual usage in an openstack.common module: Usual usage in an openstack.common module:
from fuel_agent.openstack.common.gettextutils import _ from bareon.openstack.common.gettextutils import _
""" """
import copy import copy
@ -120,7 +120,7 @@ class TranslatorFactory(object):
# module within each application. # module within each application.
# Create the global translation functions. # Create the global translation functions.
_translators = TranslatorFactory('fuel_agent') _translators = TranslatorFactory('bareon')
# The primary translation function using the well-known name "_" # The primary translation function using the well-known name "_"
_ = _translators.primary _ = _translators.primary
@ -150,7 +150,7 @@ def enable_lazy():
# FIXME(dhellmann): This function will be removed in oslo.i18n, # FIXME(dhellmann): This function will be removed in oslo.i18n,
# because the TranslatorFactory makes it superfluous. # because the TranslatorFactory makes it superfluous.
global _, _LI, _LW, _LE, _LC, USE_LAZY global _, _LI, _LW, _LE, _LC, USE_LAZY
tf = TranslatorFactory('fuel_agent', lazy=True) tf = TranslatorFactory('bareon', lazy=True)
_ = tf.primary _ = tf.primary
_LI = tf.log_info _LI = tf.log_info
_LW = tf.log_warning _LW = tf.log_warning
@ -201,7 +201,7 @@ class Message(six.text_type):
""" """
def __new__(cls, msgid, msgtext=None, params=None, def __new__(cls, msgid, msgtext=None, params=None,
domain='fuel_agent', *args): domain='bareon', *args):
"""Create a new Message object. """Create a new Message object.
In order for translation to work gettext requires a message ID, this In order for translation to work gettext requires a message ID, this

View File

@ -59,7 +59,7 @@ def import_module(import_str):
def import_versioned_module(version, submodule=None): def import_versioned_module(version, submodule=None):
module = 'fuel_agent.v%s' % version module = 'bareon.v%s' % version
if submodule: if submodule:
module = '.'.join((module, submodule)) module = '.'.join((module, submodule))
return import_module(module) return import_module(module)

View File

@ -42,9 +42,9 @@ from oslo_serialization import jsonutils
import six import six
from six import moves from six import moves
from fuel_agent.openstack.common.gettextutils import _ from bareon.openstack.common.gettextutils import _
from fuel_agent.openstack.common import importutils from bareon.openstack.common import importutils
from fuel_agent.openstack.common import local from bareon.openstack.common import local
_DEFAULT_LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S" _DEFAULT_LOG_DATE_FORMAT = "%Y-%m-%d %H:%M:%S"
@ -542,7 +542,7 @@ def _setup_logging_from_conf(project, version):
if CONF.publish_errors: if CONF.publish_errors:
handler = importutils.import_object( handler = importutils.import_object(
"fuel_agent.openstack.common.log_handler.PublishErrorsHandler", "bareon.openstack.common.log_handler.PublishErrorsHandler",
logging.ERROR) logging.ERROR)
log_root.addHandler(handler) log_root.addHandler(handler)

View File

@ -28,8 +28,8 @@ from eventlet.green import subprocess
from eventlet import greenthread from eventlet import greenthread
import six import six
from fuel_agent.openstack.common.gettextutils import _ from bareon.openstack.common.gettextutils import _
from fuel_agent.openstack.common import log as logging from bareon.openstack.common import log as logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -24,7 +24,7 @@ import unicodedata
import six import six
from fuel_agent.openstack.common.gettextutils import _ from bareon.openstack.common.gettextutils import _
UNIT_PREFIX_EXPONENT = { UNIT_PREFIX_EXPONENT = {

View File

@ -17,9 +17,9 @@ from oslo_config import cfg
import unittest2 import unittest2
import zlib import zlib
from fuel_agent import errors from bareon import errors
from fuel_agent.utils import artifact as au from bareon.utils import artifact as au
from fuel_agent.utils import utils from bareon.utils import utils
CONF = cfg.CONF CONF = cfg.CONF

View File

@ -19,10 +19,10 @@ import signal
import mock import mock
import unittest2 import unittest2
from fuel_agent import errors from bareon import errors
from fuel_agent.utils import build as bu from bareon.utils import build as bu
from fuel_agent.utils import hardware as hu from bareon.utils import hardware as hu
from fuel_agent.utils import utils from bareon.utils import utils
class BuildUtilsTestCase(unittest2.TestCase): class BuildUtilsTestCase(unittest2.TestCase):
@ -37,7 +37,7 @@ class BuildUtilsTestCase(unittest2.TestCase):
def setUp(self): def setUp(self):
super(BuildUtilsTestCase, self).setUp() super(BuildUtilsTestCase, self).setUp()
@mock.patch('fuel_agent.utils.build.os', environ={}) @mock.patch('bareon.utils.build.os', environ={})
@mock.patch.object(utils, 'execute', return_value=(None, None)) @mock.patch.object(utils, 'execute', return_value=(None, None))
def test_run_debootstrap(self, mock_exec, mock_environ): def test_run_debootstrap(self, mock_exec, mock_environ):
bu.run_debootstrap('uri', 'suite', 'chroot', 'arch', attempts=2) bu.run_debootstrap('uri', 'suite', 'chroot', 'arch', attempts=2)
@ -46,7 +46,7 @@ class BuildUtilsTestCase(unittest2.TestCase):
'suite', 'chroot', 'uri', attempts=2, 'suite', 'chroot', 'uri', attempts=2,
env_variables={}) env_variables={})
@mock.patch('fuel_agent.utils.build.os', environ={}) @mock.patch('bareon.utils.build.os', environ={})
@mock.patch.object(utils, 'execute', return_value=(None, None)) @mock.patch.object(utils, 'execute', return_value=(None, None))
def test_run_debootstrap_eatmydata(self, mock_exec, mock_environ): def test_run_debootstrap_eatmydata(self, mock_exec, mock_environ):
bu.run_debootstrap('uri', 'suite', 'chroot', 'arch', eatmydata=True, bu.run_debootstrap('uri', 'suite', 'chroot', 'arch', eatmydata=True,
@ -162,15 +162,15 @@ class BuildUtilsTestCase(unittest2.TestCase):
files = set(['etc/apt/sources.list', 'etc/apt/preferences', files = set(['etc/apt/sources.list', 'etc/apt/preferences',
'etc/apt/apt.conf.d/%s' % 'force_ipv4', 'etc/apt/apt.conf.d/%s' % 'force_ipv4',
'etc/apt/apt.conf.d/%s' % 'unsigned', 'etc/apt/apt.conf.d/%s' % 'unsigned',
'etc/apt/apt.conf.d/01fuel_agent-use-proxy-ftp', 'etc/apt/apt.conf.d/01bareon-use-proxy-ftp',
'etc/apt/apt.conf.d/01fuel_agent-use-proxy-http', 'etc/apt/apt.conf.d/01bareon-use-proxy-http',
'etc/apt/apt.conf.d/01fuel_agent-use-proxy-https']) 'etc/apt/apt.conf.d/01bareon-use-proxy-https'])
self.assertEqual('chroot', mock_files.call_args[0][0]) self.assertEqual('chroot', mock_files.call_args[0][0])
self.assertEqual(files, set(mock_files.call_args[0][1])) self.assertEqual(files, set(mock_files.call_args[0][1]))
@mock.patch('fuel_agent.utils.build.open', @mock.patch('bareon.utils.build.open',
create=True, new_callable=mock.mock_open) create=True, new_callable=mock.mock_open)
@mock.patch('fuel_agent.utils.build.os.path') @mock.patch('bareon.utils.build.os.path')
@mock.patch.object(bu, 'clean_apt_settings') @mock.patch.object(bu, 'clean_apt_settings')
@mock.patch.object(bu, 'remove_files') @mock.patch.object(bu, 'remove_files')
@mock.patch.object(utils, 'execute') @mock.patch.object(utils, 'execute')
@ -206,9 +206,9 @@ class BuildUtilsTestCase(unittest2.TestCase):
self.assertEqual(mock_path_join_expected_calls, self.assertEqual(mock_path_join_expected_calls,
mock_path.join.call_args_list) mock_path.join.call_args_list)
@mock.patch('fuel_agent.utils.build.open', @mock.patch('bareon.utils.build.open',
create=True, new_callable=mock.mock_open) create=True, new_callable=mock.mock_open)
@mock.patch('fuel_agent.utils.build.time.sleep') @mock.patch('bareon.utils.build.time.sleep')
@mock.patch.object(os, 'kill') @mock.patch.object(os, 'kill')
@mock.patch.object(os, 'readlink', return_value='chroot') @mock.patch.object(os, 'readlink', return_value='chroot')
@mock.patch.object(utils, 'execute') @mock.patch.object(utils, 'execute')
@ -353,7 +353,7 @@ class BuildUtilsTestCase(unittest2.TestCase):
mock_path.join.call_args_list) mock_path.join.call_args_list)
@mock.patch.object(os, 'path') @mock.patch.object(os, 'path')
@mock.patch('fuel_agent.utils.build.utils.init_http_request', @mock.patch('bareon.utils.build.utils.init_http_request',
return_value=mock.Mock(text=_fake_ubuntu_release)) return_value=mock.Mock(text=_fake_ubuntu_release))
def test_add_apt_preference(self, mock_get, mock_path): def test_add_apt_preference(self, mock_get, mock_path):
with mock.patch('six.moves.builtins.open', create=True) as mock_open: with mock.patch('six.moves.builtins.open', create=True) as mock_open:
@ -390,7 +390,7 @@ class BuildUtilsTestCase(unittest2.TestCase):
mock_path.join.call_args_list) mock_path.join.call_args_list)
@mock.patch.object(os, 'path') @mock.patch.object(os, 'path')
@mock.patch('fuel_agent.utils.build.utils.init_http_request', @mock.patch('bareon.utils.build.utils.init_http_request',
return_value=mock.Mock(text=_fake_ubuntu_release)) return_value=mock.Mock(text=_fake_ubuntu_release))
def test_add_apt_preference_multuple_sections(self, mock_get, mock_path): def test_add_apt_preference_multuple_sections(self, mock_get, mock_path):
with mock.patch('six.moves.builtins.open', create=True) as mock_open: with mock.patch('six.moves.builtins.open', create=True) as mock_open:
@ -433,7 +433,7 @@ class BuildUtilsTestCase(unittest2.TestCase):
mock_path.join.call_args_list) mock_path.join.call_args_list)
@mock.patch.object(os, 'path') @mock.patch.object(os, 'path')
@mock.patch('fuel_agent.utils.build.utils.init_http_request', @mock.patch('bareon.utils.build.utils.init_http_request',
return_value=mock.Mock(text=_fake_ubuntu_release)) return_value=mock.Mock(text=_fake_ubuntu_release))
def test_add_apt_preference_no_sections(self, mock_get, mock_path): def test_add_apt_preference_no_sections(self, mock_get, mock_path):
with mock.patch('six.moves.builtins.open', create=True) as mock_open: with mock.patch('six.moves.builtins.open', create=True) as mock_open:
@ -520,8 +520,8 @@ class BuildUtilsTestCase(unittest2.TestCase):
self.assertRaises(errors.WrongImageDataError, bu.containerize, 'file', self.assertRaises(errors.WrongImageDataError, bu.containerize, 'file',
'fake') 'fake')
@mock.patch('fuel_agent.utils.build.get_free_loop_device') @mock.patch('bareon.utils.build.get_free_loop_device')
@mock.patch('fuel_agent.utils.build.attach_file_to_loop') @mock.patch('bareon.utils.build.attach_file_to_loop')
def test_do_build_image_retries_attach_image_max_attempts_exceeded( def test_do_build_image_retries_attach_image_max_attempts_exceeded(
self, mock_attach_file, mock_get_free_loop_device): self, mock_attach_file, mock_get_free_loop_device):
@ -534,8 +534,8 @@ class BuildUtilsTestCase(unittest2.TestCase):
self.assertEqual(mock_attach_file.call_count, 3) self.assertEqual(mock_attach_file.call_count, 3)
@mock.patch('fuel_agent.utils.build.get_free_loop_device') @mock.patch('bareon.utils.build.get_free_loop_device')
@mock.patch('fuel_agent.utils.build.attach_file_to_loop') @mock.patch('bareon.utils.build.attach_file_to_loop')
def test_do_build_image_retries_attach_image( def test_do_build_image_retries_attach_image(
self, mock_attach_file, mock_get_free_loop_device): self, mock_attach_file, mock_get_free_loop_device):
@ -573,12 +573,12 @@ class BuildUtilsTestCase(unittest2.TestCase):
mock_exec.assert_called_once_with('rsync', '-rlptDKv', src + '/', mock_exec.assert_called_once_with('rsync', '-rlptDKv', src + '/',
dst + '/', logged=True) dst + '/', logged=True)
@mock.patch('fuel_agent.utils.build.open', @mock.patch('bareon.utils.build.open',
create=True, new_callable=mock.mock_open) create=True, new_callable=mock.mock_open)
@mock.patch.object(utils, 'makedirs_if_not_exists') @mock.patch.object(utils, 'makedirs_if_not_exists')
@mock.patch.object(os, 'path', return_value=True) @mock.patch.object(os, 'path', return_value=True)
@mock.patch('fuel_agent.utils.build.yaml.load', return_value={'test': 22}) @mock.patch('bareon.utils.build.yaml.load', return_value={'test': 22})
@mock.patch('fuel_agent.utils.build.yaml.safe_dump') @mock.patch('bareon.utils.build.yaml.safe_dump')
def test_dump_runtime_uuid(self, mock_open, mock_makedirs_if_not_exists, def test_dump_runtime_uuid(self, mock_open, mock_makedirs_if_not_exists,
mock_os, mock_load_yaml, mock_safe_dump_yaml): mock_os, mock_load_yaml, mock_safe_dump_yaml):
uuid = "8" uuid = "8"
@ -619,7 +619,7 @@ class BuildUtilsTestCase(unittest2.TestCase):
@mock.patch.object(utils, 'makedirs_if_not_exists') @mock.patch.object(utils, 'makedirs_if_not_exists')
@mock.patch.object(utils, 'execute') @mock.patch.object(utils, 'execute')
@mock.patch('fuel_agent.utils.build.uuid.uuid4', return_value='fake_uuid') @mock.patch('bareon.utils.build.uuid.uuid4', return_value='fake_uuid')
def test_make_targz(self, mock_uuid, mock_exec, mock_makedirs): def test_make_targz(self, mock_uuid, mock_exec, mock_makedirs):
self.assertEqual(bu.make_targz('/test/path'), 'fake_uuid.tar.gz') self.assertEqual(bu.make_targz('/test/path'), 'fake_uuid.tar.gz')
mock_exec.assert_called_with('tar', '-czf', 'fake_uuid.tar.gz', mock_exec.assert_called_with('tar', '-czf', 'fake_uuid.tar.gz',
@ -646,8 +646,8 @@ class BuildUtilsTestCase(unittest2.TestCase):
@mock.patch.object(utils, 'execute') @mock.patch.object(utils, 'execute')
@mock.patch.object(bu, 'remove_files') @mock.patch.object(bu, 'remove_files')
@mock.patch('fuel_agent.utils.build.glob.glob', return_value=[]) @mock.patch('bareon.utils.build.glob.glob', return_value=[])
@mock.patch('fuel_agent.utils.build.os', environ={}) @mock.patch('bareon.utils.build.os', environ={})
def test_recompress_initramfs(self, mock_os, mock_glob, mock_rm_files, def test_recompress_initramfs(self, mock_os, mock_glob, mock_rm_files,
mock_exec): mock_exec):
bu.recompress_initramfs('/test/path') bu.recompress_initramfs('/test/path')
@ -671,7 +671,7 @@ class BuildUtilsTestCase(unittest2.TestCase):
@mock.patch.object(utils, 'makedirs_if_not_exists') @mock.patch.object(utils, 'makedirs_if_not_exists')
@mock.patch.object(utils, 'execute') @mock.patch.object(utils, 'execute')
@mock.patch('fuel_agent.utils.build.glob.glob') @mock.patch('bareon.utils.build.glob.glob')
@mock.patch.object(shutil, 'copy') @mock.patch.object(shutil, 'copy')
def test_copy_kernel_initramfs(self, mock_copy, mock_glob, mock_exec, def test_copy_kernel_initramfs(self, mock_copy, mock_glob, mock_exec,
mock_makedirs): mock_makedirs):
@ -687,7 +687,7 @@ class BuildUtilsTestCase(unittest2.TestCase):
@mock.patch.object(utils, 'makedirs_if_not_exists') @mock.patch.object(utils, 'makedirs_if_not_exists')
@mock.patch.object(utils, 'execute') @mock.patch.object(utils, 'execute')
@mock.patch('fuel_agent.utils.build.glob.glob') @mock.patch('bareon.utils.build.glob.glob')
@mock.patch.object(shutil, 'copy') @mock.patch.object(shutil, 'copy')
@mock.patch.object(bu, 'remove_files') @mock.patch.object(bu, 'remove_files')
def test_copy_kernel_initramfs_with_remove(self, mock_rm, mock_copy, def test_copy_kernel_initramfs_with_remove(self, mock_rm, mock_copy,
@ -711,10 +711,10 @@ class BuildUtilsTestCase(unittest2.TestCase):
@mock.patch.object(utils, 'makedirs_if_not_exists') @mock.patch.object(utils, 'makedirs_if_not_exists')
@mock.patch.object(utils, 'execute') @mock.patch.object(utils, 'execute')
@mock.patch.object(shutil, 'move') @mock.patch.object(shutil, 'move')
@mock.patch('fuel_agent.utils.build.fu.mount_fs') @mock.patch('bareon.utils.build.fu.mount_fs')
@mock.patch('fuel_agent.utils.build.fu.umount_fs') @mock.patch('bareon.utils.build.fu.umount_fs')
@mock.patch.object(bu, 'stop_chrooted_processes') @mock.patch.object(bu, 'stop_chrooted_processes')
@mock.patch('fuel_agent.utils.build.uuid.uuid4', return_value='fake_uuid') @mock.patch('bareon.utils.build.uuid.uuid4', return_value='fake_uuid')
def test_run_mksquashfs(self, mock_uuid, mock_stop_proc, mock_umount, def test_run_mksquashfs(self, mock_uuid, mock_stop_proc, mock_umount,
mock_mount, mock_move, mock_exec, mock_makedirs): mock_mount, mock_move, mock_exec, mock_makedirs):
bu.run_mksquashfs('/test/dst/dir') bu.run_mksquashfs('/test/dst/dir')
@ -744,10 +744,10 @@ class BuildUtilsTestCase(unittest2.TestCase):
@mock.patch.object(utils, 'makedirs_if_not_exists') @mock.patch.object(utils, 'makedirs_if_not_exists')
@mock.patch.object(utils, 'execute') @mock.patch.object(utils, 'execute')
@mock.patch.object(shutil, 'move') @mock.patch.object(shutil, 'move')
@mock.patch('fuel_agent.utils.build.fu.mount_fs') @mock.patch('bareon.utils.build.fu.mount_fs')
@mock.patch('fuel_agent.utils.build.fu.umount_fs') @mock.patch('bareon.utils.build.fu.umount_fs')
@mock.patch.object(bu, 'stop_chrooted_processes') @mock.patch.object(bu, 'stop_chrooted_processes')
@mock.patch('fuel_agent.utils.build.uuid.uuid4', return_value='fake_uuid') @mock.patch('bareon.utils.build.uuid.uuid4', return_value='fake_uuid')
def test_run_mksquashfs_with_name(self, mock_uuid, mock_stop_proc, def test_run_mksquashfs_with_name(self, mock_uuid, mock_stop_proc,
mock_umount, mock_mount, mock_move, mock_umount, mock_mount, mock_move,
mock_exec, mock_makedirs): mock_exec, mock_makedirs):

View File

@ -15,8 +15,8 @@
import unittest2 import unittest2
from fuel_agent import errors from bareon import errors
from fuel_agent.objects import configdrive from bareon.objects import configdrive
class TestConfigDriveScheme(unittest2.TestCase): class TestConfigDriveScheme(unittest2.TestCase):

View File

@ -15,9 +15,9 @@
import mock import mock
import unittest2 import unittest2
from fuel_agent import errors from bareon import errors
from fuel_agent.utils import fs as fu from bareon.utils import fs as fu
from fuel_agent.utils import utils from bareon.utils import utils
@mock.patch.object(utils, 'execute') @mock.patch.object(utils, 'execute')

View File

@ -18,13 +18,13 @@ import mock
from six import StringIO from six import StringIO
import unittest2 import unittest2
from fuel_agent import errors from bareon import errors
from fuel_agent.utils import grub as gu from bareon.utils import grub as gu
class TestGrubUtils(unittest2.TestCase): class TestGrubUtils(unittest2.TestCase):
@mock.patch('fuel_agent.utils.grub.os.path.isdir') @mock.patch('bareon.utils.grub.os.path.isdir')
def test_guess_grub2_conf(self, mock_isdir): def test_guess_grub2_conf(self, mock_isdir):
side_effect_values = { side_effect_values = {
'/target/boot/grub': True, '/target/boot/grub': True,
@ -45,12 +45,12 @@ class TestGrubUtils(unittest2.TestCase):
self.assertEqual(gu.guess_grub2_conf('/target'), self.assertEqual(gu.guess_grub2_conf('/target'),
'/boot/grub2/grub.cfg') '/boot/grub2/grub.cfg')
@mock.patch('fuel_agent.utils.grub.os.path.isdir', return_value=False) @mock.patch('bareon.utils.grub.os.path.isdir', return_value=False)
def test_guess_grub2_conf_not_found(self, mock_isdir): def test_guess_grub2_conf_not_found(self, mock_isdir):
self.assertRaises(errors.GrubUtilsError, gu.guess_grub2_conf, self.assertRaises(errors.GrubUtilsError, gu.guess_grub2_conf,
'/target') '/target')
@mock.patch('fuel_agent.utils.grub.os.path.isfile') @mock.patch('bareon.utils.grub.os.path.isfile')
def test_guess_grub2_default(self, mock_isfile): def test_guess_grub2_default(self, mock_isfile):
side_effect_values = { side_effect_values = {
'/target/etc/default/grub': True, '/target/etc/default/grub': True,
@ -71,17 +71,17 @@ class TestGrubUtils(unittest2.TestCase):
self.assertEqual(gu.guess_grub2_default('/target'), self.assertEqual(gu.guess_grub2_default('/target'),
'/etc/sysconfig/grub') '/etc/sysconfig/grub')
@mock.patch('fuel_agent.utils.grub.os.path.isfile', return_value=False) @mock.patch('bareon.utils.grub.os.path.isfile', return_value=False)
def test_guess_grub2_default_not_found(self, mock_isfile): def test_guess_grub2_default_not_found(self, mock_isfile):
self.assertRaises(errors.GrubUtilsError, gu.guess_grub2_default, self.assertRaises(errors.GrubUtilsError, gu.guess_grub2_default,
'/target') '/target')
@mock.patch('fuel_agent.utils.grub.os.path.isfile', return_value=False) @mock.patch('bareon.utils.grub.os.path.isfile', return_value=False)
def test_guess_grub2_mkconfig_not_found(self, mock_isfile): def test_guess_grub2_mkconfig_not_found(self, mock_isfile):
self.assertRaises(errors.GrubUtilsError, gu.guess_grub2_mkconfig, self.assertRaises(errors.GrubUtilsError, gu.guess_grub2_mkconfig,
'/target') '/target')
@mock.patch('fuel_agent.utils.grub.os.path.isfile') @mock.patch('bareon.utils.grub.os.path.isfile')
def test_guess_grub2_mkconfig(self, mock_isfile): def test_guess_grub2_mkconfig(self, mock_isfile):
side_effect_values = { side_effect_values = {
'/target/sbin/grub-mkconfig': True, '/target/sbin/grub-mkconfig': True,
@ -124,8 +124,8 @@ class TestGrubUtils(unittest2.TestCase):
self.assertEqual(gu.guess_grub2_mkconfig('/target'), self.assertEqual(gu.guess_grub2_mkconfig('/target'),
'/usr/sbin/grub2-mkconfig') '/usr/sbin/grub2-mkconfig')
@mock.patch('fuel_agent.utils.grub.guess_grub_install') @mock.patch('bareon.utils.grub.guess_grub_install')
@mock.patch('fuel_agent.utils.grub.utils.execute') @mock.patch('bareon.utils.grub.utils.execute')
def test_guess_grub_version_1(self, mock_exec, mock_ggi): def test_guess_grub_version_1(self, mock_exec, mock_ggi):
mock_ggi.return_value = '/grub_install' mock_ggi.return_value = '/grub_install'
mock_exec.return_value = ('foo 0.97 bar', '') mock_exec.return_value = ('foo 0.97 bar', '')
@ -134,8 +134,8 @@ class TestGrubUtils(unittest2.TestCase):
mock_exec.assert_called_once_with(*cmd) mock_exec.assert_called_once_with(*cmd)
self.assertEqual(version, 1) self.assertEqual(version, 1)
@mock.patch('fuel_agent.utils.grub.guess_grub_install') @mock.patch('bareon.utils.grub.guess_grub_install')
@mock.patch('fuel_agent.utils.grub.utils.execute') @mock.patch('bareon.utils.grub.utils.execute')
def test_guess_grub_version_2(self, mock_exec, mock_ggi): def test_guess_grub_version_2(self, mock_exec, mock_ggi):
mock_ggi.return_value = '/grub_install' mock_ggi.return_value = '/grub_install'
mock_exec.return_value = ('foo bar', '') mock_exec.return_value = ('foo bar', '')
@ -144,7 +144,7 @@ class TestGrubUtils(unittest2.TestCase):
mock_exec.assert_called_once_with(*cmd) mock_exec.assert_called_once_with(*cmd)
self.assertEqual(version, 2) self.assertEqual(version, 2)
@mock.patch('fuel_agent.utils.grub.os.path.isfile') @mock.patch('bareon.utils.grub.os.path.isfile')
def test_guess_grub(self, mock_isfile): def test_guess_grub(self, mock_isfile):
side_effect_values = { side_effect_values = {
'/target/sbin/grub': True, '/target/sbin/grub': True,
@ -171,12 +171,12 @@ class TestGrubUtils(unittest2.TestCase):
} }
self.assertRaises(errors.GrubUtilsError, gu.guess_grub, '/target') self.assertRaises(errors.GrubUtilsError, gu.guess_grub, '/target')
@mock.patch('fuel_agent.utils.grub.os.path.isfile', return_value=False) @mock.patch('bareon.utils.grub.os.path.isfile', return_value=False)
def test_guess_grub_install_not_found(self, mock_isfile): def test_guess_grub_install_not_found(self, mock_isfile):
self.assertRaises(errors.GrubUtilsError, gu.guess_grub_install, self.assertRaises(errors.GrubUtilsError, gu.guess_grub_install,
'/target') '/target')
@mock.patch('fuel_agent.utils.grub.os.path.isfile') @mock.patch('bareon.utils.grub.os.path.isfile')
def test_guess_grub_install(self, mock_isfile): def test_guess_grub_install(self, mock_isfile):
side_effect_values = { side_effect_values = {
'/target/sbin/grub-install': True, '/target/sbin/grub-install': True,
@ -219,25 +219,25 @@ class TestGrubUtils(unittest2.TestCase):
self.assertEqual(gu.guess_grub_install('/target'), self.assertEqual(gu.guess_grub_install('/target'),
'/usr/sbin/grub2-install') '/usr/sbin/grub2-install')
@mock.patch('fuel_agent.utils.grub.os.listdir') @mock.patch('bareon.utils.grub.os.listdir')
def test_guess_grub1_datadir_default(self, mock_listdir): def test_guess_grub1_datadir_default(self, mock_listdir):
mock_listdir.return_value = ['dir', 'x86_64_dir'] mock_listdir.return_value = ['dir', 'x86_64_dir']
self.assertEqual('/usr/share/grub/x86_64_dir', self.assertEqual('/usr/share/grub/x86_64_dir',
gu.guess_grub1_datadir('/target')) gu.guess_grub1_datadir('/target'))
@mock.patch('fuel_agent.utils.grub.os.listdir') @mock.patch('bareon.utils.grub.os.listdir')
def test_guess_grub1_datadir_arch(self, mock_listdir): def test_guess_grub1_datadir_arch(self, mock_listdir):
mock_listdir.return_value = ['dir', 'x86_64_dir', 'i386_dir'] mock_listdir.return_value = ['dir', 'x86_64_dir', 'i386_dir']
self.assertEqual('/usr/share/grub/i386_dir', self.assertEqual('/usr/share/grub/i386_dir',
gu.guess_grub1_datadir('/target', 'i386')) gu.guess_grub1_datadir('/target', 'i386'))
@mock.patch('fuel_agent.utils.grub.os.listdir') @mock.patch('bareon.utils.grub.os.listdir')
def test_guess_grub1_datadir_not_found(self, mock_listdir): def test_guess_grub1_datadir_not_found(self, mock_listdir):
mock_listdir.return_value = ['dir', 'x86_64_dir', 'i386_dir'] mock_listdir.return_value = ['dir', 'x86_64_dir', 'i386_dir']
self.assertRaises(errors.GrubUtilsError, self.assertRaises(errors.GrubUtilsError,
gu.guess_grub1_datadir, '/target', 'fake_arch') gu.guess_grub1_datadir, '/target', 'fake_arch')
@mock.patch('fuel_agent.utils.grub.utils.guess_filename') @mock.patch('bareon.utils.grub.utils.guess_filename')
def test_guess_kernel(self, mock_guess): def test_guess_kernel(self, mock_guess):
mock_guess.return_value = 'vmlinuz-version' mock_guess.return_value = 'vmlinuz-version'
self.assertEqual(gu.guess_kernel('/target'), 'vmlinuz-version') self.assertEqual(gu.guess_kernel('/target'), 'vmlinuz-version')
@ -255,7 +255,7 @@ class TestGrubUtils(unittest2.TestCase):
mock_guess.return_value = None mock_guess.return_value = None
self.assertRaises(errors.GrubUtilsError, gu.guess_kernel, '/target') self.assertRaises(errors.GrubUtilsError, gu.guess_kernel, '/target')
@mock.patch('fuel_agent.utils.grub.utils.guess_filename') @mock.patch('bareon.utils.grub.utils.guess_filename')
def test_guess_initrd(self, mock_guess): def test_guess_initrd(self, mock_guess):
mock_guess.return_value = 'initrd-version' mock_guess.return_value = 'initrd-version'
self.assertEqual(gu.guess_initrd('/target'), 'initrd-version') self.assertEqual(gu.guess_initrd('/target'), 'initrd-version')
@ -273,8 +273,8 @@ class TestGrubUtils(unittest2.TestCase):
mock_guess.return_value = None mock_guess.return_value = None
self.assertRaises(errors.GrubUtilsError, gu.guess_initrd, '/target') self.assertRaises(errors.GrubUtilsError, gu.guess_initrd, '/target')
@mock.patch('fuel_agent.utils.grub.grub1_stage1') @mock.patch('bareon.utils.grub.grub1_stage1')
@mock.patch('fuel_agent.utils.grub.grub1_mbr') @mock.patch('bareon.utils.grub.grub1_mbr')
def test_grub1_install(self, mock_mbr, mock_stage1): def test_grub1_install(self, mock_mbr, mock_stage1):
install_devices = ['/dev/foo', '/dev/bar'] install_devices = ['/dev/foo', '/dev/bar']
expected_calls_mbr = [] expected_calls_mbr = []
@ -289,9 +289,9 @@ class TestGrubUtils(unittest2.TestCase):
self.assertRaises(errors.GrubUtilsError, gu.grub1_install, self.assertRaises(errors.GrubUtilsError, gu.grub1_install,
'/dev/foo', '/dev/foo', chroot='/target') '/dev/foo', '/dev/foo', chroot='/target')
@mock.patch('fuel_agent.utils.grub.guess_grub') @mock.patch('bareon.utils.grub.guess_grub')
@mock.patch('fuel_agent.utils.grub.os.chmod') @mock.patch('bareon.utils.grub.os.chmod')
@mock.patch('fuel_agent.utils.grub.utils.execute') @mock.patch('bareon.utils.grub.utils.execute')
def test_grub1_mbr_install_differs_boot(self, mock_exec, def test_grub1_mbr_install_differs_boot(self, mock_exec,
mock_chmod, mock_guess): mock_chmod, mock_guess):
mock_guess.return_value = '/sbin/grub' mock_guess.return_value = '/sbin/grub'
@ -308,7 +308,7 @@ class TestGrubUtils(unittest2.TestCase):
script = 'cat /tmp/grub.batch | /sbin/grub --no-floppy --batch' script = 'cat /tmp/grub.batch | /sbin/grub --no-floppy --batch'
mock_open = mock.mock_open() mock_open = mock.mock_open()
with mock.patch('fuel_agent.utils.grub.open', new=mock_open, with mock.patch('bareon.utils.grub.open', new=mock_open,
create=True): create=True):
gu.grub1_mbr('/dev/foo', '/dev/bar', '0', chroot='/target') gu.grub1_mbr('/dev/foo', '/dev/bar', '0', chroot='/target')
self.assertEqual( self.assertEqual(
@ -326,9 +326,9 @@ class TestGrubUtils(unittest2.TestCase):
'chroot', '/target', '/tmp/grub.sh', 'chroot', '/target', '/tmp/grub.sh',
run_as_root=True, check_exit_code=[0]) run_as_root=True, check_exit_code=[0])
@mock.patch('fuel_agent.utils.grub.guess_grub') @mock.patch('bareon.utils.grub.guess_grub')
@mock.patch('fuel_agent.utils.grub.os.chmod') @mock.patch('bareon.utils.grub.os.chmod')
@mock.patch('fuel_agent.utils.grub.utils.execute') @mock.patch('bareon.utils.grub.utils.execute')
def test_grub1_mbr_install_same_as_boot(self, mock_exec, def test_grub1_mbr_install_same_as_boot(self, mock_exec,
mock_chmod, mock_guess): mock_chmod, mock_guess):
mock_guess.return_value = '/sbin/grub' mock_guess.return_value = '/sbin/grub'
@ -343,7 +343,7 @@ class TestGrubUtils(unittest2.TestCase):
script = 'cat /tmp/grub.batch | /sbin/grub --no-floppy --batch' script = 'cat /tmp/grub.batch | /sbin/grub --no-floppy --batch'
mock_open = mock.mock_open() mock_open = mock.mock_open()
with mock.patch('fuel_agent.utils.grub.open', new=mock_open, with mock.patch('bareon.utils.grub.open', new=mock_open,
create=True): create=True):
gu.grub1_mbr('/dev/foo', '/dev/foo', '0', chroot='/target') gu.grub1_mbr('/dev/foo', '/dev/foo', '0', chroot='/target')
self.assertEqual( self.assertEqual(
@ -361,11 +361,11 @@ class TestGrubUtils(unittest2.TestCase):
'chroot', '/target', '/tmp/grub.sh', 'chroot', '/target', '/tmp/grub.sh',
run_as_root=True, check_exit_code=[0]) run_as_root=True, check_exit_code=[0])
@mock.patch('fuel_agent.utils.grub.shutil.copy') @mock.patch('bareon.utils.grub.shutil.copy')
@mock.patch('fuel_agent.utils.grub.guess_grub1_datadir', @mock.patch('bareon.utils.grub.guess_grub1_datadir',
return_value='/fake_datadir') return_value='/fake_datadir')
@mock.patch('fuel_agent.utils.grub.os.remove') @mock.patch('bareon.utils.grub.os.remove')
@mock.patch('fuel_agent.utils.grub.os.listdir') @mock.patch('bareon.utils.grub.os.listdir')
def test_grub1_stage1(self, mock_listdir, mock_remove, mock_datadir, def test_grub1_stage1(self, mock_listdir, mock_remove, mock_datadir,
mock_copy): mock_copy):
mock_listdir.side_effect = [['stage1', 'stage2', 'e2fs_stage_1_5', mock_listdir.side_effect = [['stage1', 'stage2', 'e2fs_stage_1_5',
@ -390,8 +390,8 @@ class TestGrubUtils(unittest2.TestCase):
'/target/boot/grub/jfs_stage1_5')] '/target/boot/grub/jfs_stage1_5')]
self.assertEqual(expected_copy_calls, mock_copy.call_args_list) self.assertEqual(expected_copy_calls, mock_copy.call_args_list)
@mock.patch('fuel_agent.utils.grub.guess_kernel') @mock.patch('bareon.utils.grub.guess_kernel')
@mock.patch('fuel_agent.utils.grub.guess_initrd') @mock.patch('bareon.utils.grub.guess_initrd')
def test_grub1_cfg_kernel_initrd_are_not_set(self, mock_initrd, def test_grub1_cfg_kernel_initrd_are_not_set(self, mock_initrd,
mock_kernel): mock_kernel):
mock_kernel.return_value = 'kernel-version' mock_kernel.return_value = 'kernel-version'
@ -405,7 +405,7 @@ title Default (kernel-version)
""" """
mock_open = mock.mock_open() mock_open = mock.mock_open()
with mock.patch('fuel_agent.utils.grub.open', new=mock_open, with mock.patch('bareon.utils.grub.open', new=mock_open,
create=True): create=True):
gu.grub1_cfg(chroot='/target', kernel_params='kernel-params') gu.grub1_cfg(chroot='/target', kernel_params='kernel-params')
mock_open.assert_called_once_with('/target/boot/grub/grub.conf', 'wt', mock_open.assert_called_once_with('/target/boot/grub/grub.conf', 'wt',
@ -423,7 +423,7 @@ title Default (kernel-version-set)
""" """
mock_open = mock.mock_open() mock_open = mock.mock_open()
with mock.patch('fuel_agent.utils.grub.open', new=mock_open, with mock.patch('bareon.utils.grub.open', new=mock_open,
create=True): create=True):
gu.grub1_cfg(kernel='kernel-version-set', gu.grub1_cfg(kernel='kernel-version-set',
initrd='initrd-version-set', initrd='initrd-version-set',
@ -434,8 +434,8 @@ title Default (kernel-version-set)
mock_open_file = mock_open() mock_open_file = mock_open()
mock_open_file.write.assert_called_once_with(config) mock_open_file.write.assert_called_once_with(config)
@mock.patch('fuel_agent.utils.grub.utils.execute') @mock.patch('bareon.utils.grub.utils.execute')
@mock.patch('fuel_agent.utils.grub.guess_grub_install') @mock.patch('bareon.utils.grub.guess_grub_install')
def test_grub2_install(self, mock_guess_grub, mock_exec): def test_grub2_install(self, mock_guess_grub, mock_exec):
mock_guess_grub.return_value = '/sbin/grub' mock_guess_grub.return_value = '/sbin/grub'
expected_calls = [ expected_calls = [
@ -447,10 +447,10 @@ title Default (kernel-version-set)
gu.grub2_install(['/dev/foo', '/dev/bar'], chroot='/target') gu.grub2_install(['/dev/foo', '/dev/bar'], chroot='/target')
self.assertEqual(mock_exec.call_args_list, expected_calls) self.assertEqual(mock_exec.call_args_list, expected_calls)
@mock.patch('fuel_agent.utils.grub.guess_grub2_conf') @mock.patch('bareon.utils.grub.guess_grub2_conf')
@mock.patch('fuel_agent.utils.grub.guess_grub2_mkconfig') @mock.patch('bareon.utils.grub.guess_grub2_mkconfig')
@mock.patch('fuel_agent.utils.grub.utils.execute') @mock.patch('bareon.utils.grub.utils.execute')
@mock.patch('fuel_agent.utils.grub.guess_grub2_default') @mock.patch('bareon.utils.grub.guess_grub2_default')
def test_grub2_cfg(self, mock_def, mock_exec, mock_mkconfig, mock_conf): def test_grub2_cfg(self, mock_def, mock_exec, mock_mkconfig, mock_conf):
mock_def.return_value = '/etc/default/grub' mock_def.return_value = '/etc/default/grub'
mock_mkconfig.return_value = '/sbin/grub-mkconfig' mock_mkconfig.return_value = '/sbin/grub-mkconfig'
@ -464,7 +464,7 @@ bar
GRUB_RECORDFAIL_TIMEOUT=10 GRUB_RECORDFAIL_TIMEOUT=10
""" """
with mock.patch('fuel_agent.utils.grub.open', with mock.patch('bareon.utils.grub.open',
new=mock.mock_open(read_data=orig_content), new=mock.mock_open(read_data=orig_content),
create=True) as mock_open: create=True) as mock_open:
mock_open.return_value = mock.MagicMock(spec=io.IOBase) mock_open.return_value = mock.MagicMock(spec=io.IOBase)

View File

@ -15,9 +15,9 @@
import six import six
import unittest2 import unittest2
from fuel_agent import errors from bareon import errors
from fuel_agent.utils import hardware as hu from bareon.utils import hardware as hu
from fuel_agent.utils import utils from bareon.utils import utils
if six.PY2: if six.PY2:
import mock import mock
@ -289,7 +289,7 @@ supports-register-dump: yes
} }
self.assertFalse(hu.is_disk('/dev/fake', bspec=bspec)) self.assertFalse(hu.is_disk('/dev/fake', bspec=bspec))
@mock.patch('fuel_agent.utils.hardware.utils.execute') @mock.patch('bareon.utils.hardware.utils.execute')
def test_get_block_devices_from_udev_db(self, mock_exec): def test_get_block_devices_from_udev_db(self, mock_exec):
mock_exec.return_value = ("""P: /devices/virtual/block/loop0 mock_exec.return_value = ("""P: /devices/virtual/block/loop0
N: loop0 N: loop0

View File

@ -15,8 +15,8 @@
import unittest2 import unittest2
from fuel_agent import errors from bareon import errors
from fuel_agent.objects import image from bareon.objects import image
class TestImage(unittest2.TestCase): class TestImage(unittest2.TestCase):

View File

@ -16,8 +16,8 @@ import copy
import unittest2 import unittest2
from fuel_agent.drivers import ks_spaces_validator as kssv from bareon.drivers import ks_spaces_validator as kssv
from fuel_agent import errors from bareon import errors
SAMPLE_SCHEME = [ SAMPLE_SCHEME = [
{ {

View File

@ -15,9 +15,9 @@
import mock import mock
import unittest2 import unittest2
from fuel_agent import errors from bareon import errors
from fuel_agent.utils import lvm as lu from bareon.utils import lvm as lu
from fuel_agent.utils import utils from bareon.utils import utils
class TestLvmUtils(unittest2.TestCase): class TestLvmUtils(unittest2.TestCase):

View File

@ -20,18 +20,18 @@ from oslo_config import cfg
import six import six
import unittest2 import unittest2
from fuel_agent.drivers import nailgun from bareon.drivers import nailgun
from fuel_agent import errors from bareon import errors
from fuel_agent import manager from bareon import manager
from fuel_agent import objects from bareon import objects
from fuel_agent.tests import test_nailgun from bareon.tests import test_nailgun
from fuel_agent.utils import artifact as au from bareon.utils import artifact as au
from fuel_agent.utils import fs as fu from bareon.utils import fs as fu
from fuel_agent.utils import hardware as hu from bareon.utils import hardware as hu
from fuel_agent.utils import lvm as lu from bareon.utils import lvm as lu
from fuel_agent.utils import md as mu from bareon.utils import md as mu
from fuel_agent.utils import partition as pu from bareon.utils import partition as pu
from fuel_agent.utils import utils from bareon.utils import utils
if six.PY2: if six.PY2:
import mock import mock
@ -53,7 +53,7 @@ class FakeChain(object):
class TestManager(unittest2.TestCase): class TestManager(unittest2.TestCase):
@mock.patch('fuel_agent.drivers.nailgun.Nailgun.parse_image_meta', @mock.patch('bareon.drivers.nailgun.Nailgun.parse_image_meta',
return_value={}) return_value={})
@mock.patch.object(hu, 'list_block_devices') @mock.patch.object(hu, 'list_block_devices')
def setUp(self, mock_lbd, mock_image_meta): def setUp(self, mock_lbd, mock_image_meta):
@ -61,10 +61,10 @@ class TestManager(unittest2.TestCase):
mock_lbd.return_value = test_nailgun.LIST_BLOCK_DEVICES_SAMPLE mock_lbd.return_value = test_nailgun.LIST_BLOCK_DEVICES_SAMPLE
self.mgr = manager.Manager(test_nailgun.PROVISION_SAMPLE_DATA) self.mgr = manager.Manager(test_nailgun.PROVISION_SAMPLE_DATA)
@mock.patch('fuel_agent.manager.open', @mock.patch('bareon.manager.open',
create=True, new_callable=mock.mock_open) create=True, new_callable=mock.mock_open)
@mock.patch('fuel_agent.manager.gu', create=True) @mock.patch('bareon.manager.gu', create=True)
@mock.patch('fuel_agent.manager.utils', create=True) @mock.patch('bareon.manager.utils', create=True)
@mock.patch.object(manager.Manager, 'mount_target') @mock.patch.object(manager.Manager, 'mount_target')
@mock.patch.object(manager.Manager, 'umount_target') @mock.patch.object(manager.Manager, 'umount_target')
def test_do_bootloader_grub1_kernel_initrd_guessed(self, mock_umount, def test_do_bootloader_grub1_kernel_initrd_guessed(self, mock_umount,
@ -95,10 +95,10 @@ class TestManager(unittest2.TestCase):
mock_gu.guess_kernel.assert_called_once_with( mock_gu.guess_kernel.assert_called_once_with(
regexp='fake_kernel_regexp', chroot='/tmp/target') regexp='fake_kernel_regexp', chroot='/tmp/target')
@mock.patch('fuel_agent.manager.open', @mock.patch('bareon.manager.open',
create=True, new_callable=mock.mock_open) create=True, new_callable=mock.mock_open)
@mock.patch('fuel_agent.manager.gu', create=True) @mock.patch('bareon.manager.gu', create=True)
@mock.patch('fuel_agent.manager.utils', create=True) @mock.patch('bareon.manager.utils', create=True)
@mock.patch.object(manager.Manager, 'mount_target') @mock.patch.object(manager.Manager, 'mount_target')
@mock.patch.object(manager.Manager, 'umount_target') @mock.patch.object(manager.Manager, 'umount_target')
def test_do_bootloader_grub1_kernel_initrd_set(self, mock_umount, def test_do_bootloader_grub1_kernel_initrd_set(self, mock_umount,
@ -123,11 +123,11 @@ class TestManager(unittest2.TestCase):
self.assertFalse(mock_gu.guess_initrd.called) self.assertFalse(mock_gu.guess_initrd.called)
self.assertFalse(mock_gu.guess_kernel.called) self.assertFalse(mock_gu.guess_kernel.called)
@mock.patch('fuel_agent.objects.bootloader.Grub', autospec=True) @mock.patch('bareon.objects.bootloader.Grub', autospec=True)
@mock.patch('fuel_agent.manager.open', @mock.patch('bareon.manager.open',
create=True, new_callable=mock.mock_open) create=True, new_callable=mock.mock_open)
@mock.patch('fuel_agent.manager.gu', create=True) @mock.patch('bareon.manager.gu', create=True)
@mock.patch('fuel_agent.manager.utils', create=True) @mock.patch('bareon.manager.utils', create=True)
@mock.patch.object(manager.Manager, 'mount_target') @mock.patch.object(manager.Manager, 'mount_target')
@mock.patch.object(manager.Manager, 'umount_target') @mock.patch.object(manager.Manager, 'umount_target')
def test_do_bootloader_rootfs_uuid(self, mock_umount, mock_mount, def test_do_bootloader_rootfs_uuid(self, mock_umount, mock_mount,
@ -150,7 +150,7 @@ class TestManager(unittest2.TestCase):
'root=UUID=FAKE_ROOTFS_UUID ') 'root=UUID=FAKE_ROOTFS_UUID ')
self.assertEqual(2, mock_grub.version) self.assertEqual(2, mock_grub.version)
@mock.patch('fuel_agent.manager.utils', create=True) @mock.patch('bareon.manager.utils', create=True)
@mock.patch.object(manager.Manager, 'mount_target') @mock.patch.object(manager.Manager, 'mount_target')
def test_do_bootloader_rootfs_not_found(self, mock_umount, mock_utils): def test_do_bootloader_rootfs_not_found(self, mock_umount, mock_utils):
mock_utils.execute.return_value = ('fake', 'fake') mock_utils.execute.return_value = ('fake', 'fake')
@ -162,10 +162,10 @@ class TestManager(unittest2.TestCase):
self.assertRaises(errors.WrongPartitionSchemeError, self.assertRaises(errors.WrongPartitionSchemeError,
self.mgr.do_bootloader) self.mgr.do_bootloader)
@mock.patch('fuel_agent.manager.open', @mock.patch('bareon.manager.open',
create=True, new_callable=mock.mock_open) create=True, new_callable=mock.mock_open)
@mock.patch('fuel_agent.manager.gu', create=True) @mock.patch('bareon.manager.gu', create=True)
@mock.patch('fuel_agent.manager.utils', create=True) @mock.patch('bareon.manager.utils', create=True)
@mock.patch.object(manager.Manager, 'mount_target') @mock.patch.object(manager.Manager, 'mount_target')
@mock.patch.object(manager.Manager, 'umount_target') @mock.patch.object(manager.Manager, 'umount_target')
def test_do_bootloader_grub_version_changes( def test_do_bootloader_grub_version_changes(
@ -178,10 +178,10 @@ class TestManager(unittest2.TestCase):
chroot='/tmp/target') chroot='/tmp/target')
self.assertEqual('expected_version', self.mgr.driver.grub.version) self.assertEqual('expected_version', self.mgr.driver.grub.version)
@mock.patch('fuel_agent.manager.open', @mock.patch('bareon.manager.open',
create=True, new_callable=mock.mock_open) create=True, new_callable=mock.mock_open)
@mock.patch('fuel_agent.manager.gu', create=True) @mock.patch('bareon.manager.gu', create=True)
@mock.patch('fuel_agent.manager.utils', create=True) @mock.patch('bareon.manager.utils', create=True)
@mock.patch.object(manager.Manager, 'mount_target') @mock.patch.object(manager.Manager, 'mount_target')
@mock.patch.object(manager.Manager, 'umount_target') @mock.patch.object(manager.Manager, 'umount_target')
def test_do_bootloader_grub1(self, mock_umount, mock_mount, mock_utils, def test_do_bootloader_grub1(self, mock_umount, mock_mount, mock_utils,
@ -207,10 +207,10 @@ class TestManager(unittest2.TestCase):
self.assertFalse(mock_gu.grub2_cfg.called) self.assertFalse(mock_gu.grub2_cfg.called)
self.assertFalse(mock_gu.grub2_install.called) self.assertFalse(mock_gu.grub2_install.called)
@mock.patch('fuel_agent.manager.open', @mock.patch('bareon.manager.open',
create=True, new_callable=mock.mock_open) create=True, new_callable=mock.mock_open)
@mock.patch('fuel_agent.manager.gu', create=True) @mock.patch('bareon.manager.gu', create=True)
@mock.patch('fuel_agent.manager.utils', create=True) @mock.patch('bareon.manager.utils', create=True)
@mock.patch.object(manager.Manager, 'mount_target') @mock.patch.object(manager.Manager, 'mount_target')
@mock.patch.object(manager.Manager, 'umount_target') @mock.patch.object(manager.Manager, 'umount_target')
def test_do_bootloader_grub2(self, mock_umount, mock_mount, mock_utils, def test_do_bootloader_grub2(self, mock_umount, mock_mount, mock_utils,
@ -231,15 +231,15 @@ class TestManager(unittest2.TestCase):
self.assertFalse(mock_gu.grub1_cfg.called) self.assertFalse(mock_gu.grub1_cfg.called)
self.assertFalse(mock_gu.grub1_install.called) self.assertFalse(mock_gu.grub1_install.called)
@mock.patch('fuel_agent.manager.gu', create=True) @mock.patch('bareon.manager.gu', create=True)
@mock.patch('fuel_agent.manager.utils', create=True) @mock.patch('bareon.manager.utils', create=True)
@mock.patch.object(manager.Manager, 'mount_target') @mock.patch.object(manager.Manager, 'mount_target')
@mock.patch.object(manager.Manager, 'umount_target') @mock.patch.object(manager.Manager, 'umount_target')
def test_do_bootloader_writes(self, mock_umount, mock_mount, mock_utils, def test_do_bootloader_writes(self, mock_umount, mock_mount, mock_utils,
mock_gu): mock_gu):
# actually covers only write() calls # actually covers only write() calls
mock_utils.execute.return_value = ('fake_UUID\n', None) mock_utils.execute.return_value = ('fake_UUID\n', None)
with mock.patch('fuel_agent.manager.open', create=True) as mock_open: with mock.patch('bareon.manager.open', create=True) as mock_open:
file_handle_mock = mock_open.return_value.__enter__.return_value file_handle_mock = mock_open.return_value.__enter__.return_value
self.mgr.do_bootloader() self.mgr.do_bootloader()
expected_open_calls = [ expected_open_calls = [
@ -251,7 +251,7 @@ class TestManager(unittest2.TestCase):
mock.call('/tmp/target/etc/fstab', 'wt', encoding='utf-8')] mock.call('/tmp/target/etc/fstab', 'wt', encoding='utf-8')]
self.assertEqual(expected_open_calls, mock_open.call_args_list) self.assertEqual(expected_open_calls, mock_open.call_args_list)
expected_write_calls = [ expected_write_calls = [
mock.call('# Generated by fuel-agent during provisioning: ' mock.call('# Generated by bareon during provisioning: '
'BEGIN\n'), 'BEGIN\n'),
mock.call('SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ' mock.call('SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", '
'ATTR{address}=="08:00:27:79:da:80", ATTR{type}=="1"' 'ATTR{address}=="08:00:27:79:da:80", ATTR{type}=="1"'
@ -262,9 +262,9 @@ class TestManager(unittest2.TestCase):
mock.call('SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ' mock.call('SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", '
'ATTR{address}=="08:00:27:b1:d7:15", ATTR{type}=="1"' 'ATTR{address}=="08:00:27:b1:d7:15", ATTR{type}=="1"'
', KERNEL=="eth*", NAME="eth2"\n'), ', KERNEL=="eth*", NAME="eth2"\n'),
mock.call('# Generated by fuel-agent during provisioning: ' mock.call('# Generated by bareon during provisioning: '
'END\n'), 'END\n'),
mock.call('# Generated by fuel-agent during provisioning:\n# ' mock.call('# Generated by bareon during provisioning:\n# '
'DO NOT DELETE. It is needed to disable ' 'DO NOT DELETE. It is needed to disable '
'net-generator\n'), 'net-generator\n'),
mock.call('UUID=fake_UUID /boot ext2 defaults 0 0\n'), mock.call('UUID=fake_UUID /boot ext2 defaults 0 0\n'),
@ -281,7 +281,7 @@ class TestManager(unittest2.TestCase):
mock_utils.makedirs_if_not_exists.assert_called_once_with( mock_utils.makedirs_if_not_exists.assert_called_once_with(
'/tmp/target/etc/nailgun-agent') '/tmp/target/etc/nailgun-agent')
@mock.patch('fuel_agent.drivers.nailgun.Nailgun.parse_image_meta', @mock.patch('bareon.drivers.nailgun.Nailgun.parse_image_meta',
return_value={}) return_value={})
@mock.patch.object(hu, 'list_block_devices') @mock.patch.object(hu, 'list_block_devices')
@mock.patch.object(fu, 'make_fs') @mock.patch.object(fu, 'make_fs')
@ -429,9 +429,9 @@ class TestManager(unittest2.TestCase):
mock.call('xfs', '', '', '/dev/mapper/image-glance')] mock.call('xfs', '', '', '/dev/mapper/image-glance')]
self.assertEqual(mock_fu_mf_expected_calls, mock_fu_mf.call_args_list) self.assertEqual(mock_fu_mf_expected_calls, mock_fu_mf.call_args_list)
@mock.patch('fuel_agent.drivers.nailgun.Nailgun.parse_image_meta', @mock.patch('bareon.drivers.nailgun.Nailgun.parse_image_meta',
return_value={}) return_value={})
@mock.patch('fuel_agent.drivers.nailgun.Nailgun.parse_operating_system') @mock.patch('bareon.drivers.nailgun.Nailgun.parse_operating_system')
@mock.patch.object(utils, 'calculate_md5') @mock.patch.object(utils, 'calculate_md5')
@mock.patch('os.path.getsize') @mock.patch('os.path.getsize')
@mock.patch('yaml.load') @mock.patch('yaml.load')
@ -676,11 +676,11 @@ class TestManager(unittest2.TestCase):
self.assertRaises(errors.ImageChecksumMismatchError, self.assertRaises(errors.ImageChecksumMismatchError,
self.mgr.do_copyimage) self.mgr.do_copyimage)
@mock.patch('fuel_agent.manager.fu', create=True) @mock.patch('bareon.manager.fu', create=True)
@mock.patch('fuel_agent.manager.utils', create=True) @mock.patch('bareon.manager.utils', create=True)
@mock.patch('fuel_agent.manager.open', @mock.patch('bareon.manager.open',
create=True, new_callable=mock.mock_open) create=True, new_callable=mock.mock_open)
@mock.patch('fuel_agent.manager.os', create=True) @mock.patch('bareon.manager.os', create=True)
def test_mount_target_mtab_is_link(self, mock_os, mock_open, mock_utils, def test_mount_target_mtab_is_link(self, mock_os, mock_open, mock_utils,
mock_fu): mock_fu):
mock_os.path.islink.return_value = True mock_os.path.islink.return_value = True
@ -692,11 +692,11 @@ class TestManager(unittest2.TestCase):
mock_os.path.islink.assert_called_once_with('fake_chroot/etc/mtab') mock_os.path.islink.assert_called_once_with('fake_chroot/etc/mtab')
mock_os.remove.assert_called_once_with('fake_chroot/etc/mtab') mock_os.remove.assert_called_once_with('fake_chroot/etc/mtab')
@mock.patch('fuel_agent.manager.fu', create=True) @mock.patch('bareon.manager.fu', create=True)
@mock.patch('fuel_agent.manager.utils', create=True) @mock.patch('bareon.manager.utils', create=True)
@mock.patch('fuel_agent.manager.open', @mock.patch('bareon.manager.open',
create=True, new_callable=mock.mock_open) create=True, new_callable=mock.mock_open)
@mock.patch('fuel_agent.manager.os', create=True) @mock.patch('bareon.manager.os', create=True)
def test_mount_target(self, mock_os, mock_open, mock_utils, mock_fu): def test_mount_target(self, mock_os, mock_open, mock_utils, mock_fu):
mock_os.path.islink.return_value = False mock_os.path.islink.return_value = False
self.mgr.driver._partition_scheme = objects.PartitionScheme() self.mgr.driver._partition_scheme = objects.PartitionScheme()
@ -747,7 +747,7 @@ none /run/shm tmpfs rw,nosuid,nodev 0 0"""
mock_os.path.islink.assert_called_once_with('fake_chroot/etc/mtab') mock_os.path.islink.assert_called_once_with('fake_chroot/etc/mtab')
self.assertFalse(mock_os.remove.called) self.assertFalse(mock_os.remove.called)
@mock.patch('fuel_agent.manager.fu', create=True) @mock.patch('bareon.manager.fu', create=True)
def test_umount_target(self, mock_fu): def test_umount_target(self, mock_fu):
self.mgr.driver._partition_scheme = objects.PartitionScheme() self.mgr.driver._partition_scheme = objects.PartitionScheme()
self.mgr.driver.partition_scheme.add_fs( self.mgr.driver.partition_scheme.add_fs(
@ -804,14 +804,14 @@ class TestImageBuild(unittest2.TestCase):
self.mgr = manager.Manager(image_conf) self.mgr = manager.Manager(image_conf)
@mock.patch.object(manager.Manager, '_set_apt_repos') @mock.patch.object(manager.Manager, '_set_apt_repos')
@mock.patch('fuel_agent.manager.bu', create=True) @mock.patch('bareon.manager.bu', create=True)
@mock.patch('fuel_agent.manager.fu', create=True) @mock.patch('bareon.manager.fu', create=True)
@mock.patch('fuel_agent.manager.utils', create=True) @mock.patch('bareon.manager.utils', create=True)
@mock.patch('fuel_agent.manager.os', create=True) @mock.patch('bareon.manager.os', create=True)
@mock.patch('fuel_agent.manager.shutil.move') @mock.patch('bareon.manager.shutil.move')
@mock.patch('fuel_agent.manager.open', @mock.patch('bareon.manager.open',
create=True, new_callable=mock.mock_open) create=True, new_callable=mock.mock_open)
@mock.patch('fuel_agent.manager.yaml.safe_dump') @mock.patch('bareon.manager.yaml.safe_dump')
@mock.patch.object(manager.Manager, 'mount_target') @mock.patch.object(manager.Manager, 'mount_target')
@mock.patch.object(manager.Manager, 'umount_target') @mock.patch.object(manager.Manager, 'umount_target')
def test_do_build_image(self, mock_umount_target, mock_mount_target, def test_do_build_image(self, mock_umount_target, mock_mount_target,

View File

@ -15,10 +15,10 @@
import six import six
import unittest2 import unittest2
from fuel_agent import errors from bareon import errors
from fuel_agent.utils import hardware as hu from bareon.utils import hardware as hu
from fuel_agent.utils import md as mu from bareon.utils import md as mu
from fuel_agent.utils import utils from bareon.utils import utils
if six.PY2: if six.PY2:
@ -31,7 +31,7 @@ else:
class TestMdUtils(unittest2.TestCase): class TestMdUtils(unittest2.TestCase):
@mock.patch('fuel_agent.utils.md.utils.execute') @mock.patch('bareon.utils.md.utils.execute')
def test_mddisplay_nostate_detail(self, mock_exec): def test_mddisplay_nostate_detail(self, mock_exec):
mock_exec.return_value = ( mock_exec.return_value = (
"""/dev/md127: """/dev/md127:

View File

@ -19,11 +19,11 @@ import six
import unittest2 import unittest2
import yaml import yaml
from fuel_agent.drivers import nailgun from bareon.drivers import nailgun
from fuel_agent import errors from bareon import errors
from fuel_agent import objects from bareon import objects
from fuel_agent.objects import image from bareon.objects import image
from fuel_agent.utils import utils from bareon.utils import utils
CEPH_JOURNAL = { CEPH_JOURNAL = {
@ -932,7 +932,7 @@ class TestNailgunGetOSMethods(unittest2.TestCase):
@mock.patch.object(nailgun.Nailgun, 'parse_image_meta', return_value={}) @mock.patch.object(nailgun.Nailgun, 'parse_image_meta', return_value={})
@mock.patch('fuel_agent.drivers.nailgun.hu.list_block_devices') @mock.patch('bareon.drivers.nailgun.hu.list_block_devices')
class TestNailgunMockedMeta(unittest2.TestCase): class TestNailgunMockedMeta(unittest2.TestCase):
def test_configdrive_scheme(self, mock_lbd, mock_image_meta): def test_configdrive_scheme(self, mock_lbd, mock_image_meta):
mock_lbd.return_value = LIST_BLOCK_DEVICES_SAMPLE mock_lbd.return_value = LIST_BLOCK_DEVICES_SAMPLE
@ -1280,7 +1280,7 @@ class TestNailgunMockedMeta(unittest2.TestCase):
@mock.patch.object(utils, 'init_http_request') @mock.patch.object(utils, 'init_http_request')
@mock.patch('fuel_agent.drivers.nailgun.hu.list_block_devices') @mock.patch('bareon.drivers.nailgun.hu.list_block_devices')
class TestNailgunImageMeta(unittest2.TestCase): class TestNailgunImageMeta(unittest2.TestCase):
def test_parse_image_meta(self, mock_lbd, mock_http_req): def test_parse_image_meta(self, mock_lbd, mock_http_req):
fake_image_meta = {'images': [{'raw_md5': 'fakeroot', 'raw_size': 1, fake_image_meta = {'images': [{'raw_md5': 'fakeroot', 'raw_size': 1,

View File

@ -19,9 +19,9 @@ import six
from six.moves.urllib.parse import urlsplit from six.moves.urllib.parse import urlsplit
import unittest2 import unittest2
from fuel_agent.drivers.nailgun import NailgunBuildImage from bareon.drivers.nailgun import NailgunBuildImage
from fuel_agent import errors from bareon import errors
from fuel_agent import objects from bareon import objects
DEFAULT_TRUSTY_PACKAGES = [ DEFAULT_TRUSTY_PACKAGES = [
"acl", "acl",
@ -114,8 +114,8 @@ class TestNailgunBuildImage(unittest2.TestCase):
data = {'codename': 'not-trusty'} data = {'codename': 'not-trusty'}
NailgunBuildImage(data) NailgunBuildImage(data)
@mock.patch('fuel_agent.objects.RepoProxies') @mock.patch('bareon.objects.RepoProxies')
@mock.patch('fuel_agent.objects.Ubuntu') @mock.patch('bareon.objects.Ubuntu')
@mock.patch.object(NailgunBuildImage, 'parse_schemes') @mock.patch.object(NailgunBuildImage, 'parse_schemes')
def test_parse_operating_system_packages_given(self, mock_parse_schemes, def test_parse_operating_system_packages_given(self, mock_parse_schemes,
mock_ub, mock_proxies): mock_ub, mock_proxies):
@ -132,8 +132,8 @@ class TestNailgunBuildImage(unittest2.TestCase):
proxies=mock_proxies.return_value) proxies=mock_proxies.return_value)
self.assertEqual(driver.operating_system.packages, data['packages']) self.assertEqual(driver.operating_system.packages, data['packages'])
@mock.patch('fuel_agent.objects.RepoProxies') @mock.patch('bareon.objects.RepoProxies')
@mock.patch('fuel_agent.objects.Ubuntu') @mock.patch('bareon.objects.Ubuntu')
@mock.patch.object(NailgunBuildImage, 'parse_schemes') @mock.patch.object(NailgunBuildImage, 'parse_schemes')
def test_parse_operating_system_packages_not_given( def test_parse_operating_system_packages_not_given(
self, mock_parse_schemes, mock_ub, mock_proxies): self, mock_parse_schemes, mock_ub, mock_proxies):
@ -150,9 +150,9 @@ class TestNailgunBuildImage(unittest2.TestCase):
self.assertEqual(driver.operating_system.packages, self.assertEqual(driver.operating_system.packages,
NailgunBuildImage.DEFAULT_TRUSTY_PACKAGES) NailgunBuildImage.DEFAULT_TRUSTY_PACKAGES)
@mock.patch('fuel_agent.objects.RepoProxies') @mock.patch('bareon.objects.RepoProxies')
@mock.patch('fuel_agent.objects.DEBRepo') @mock.patch('bareon.objects.DEBRepo')
@mock.patch('fuel_agent.objects.Ubuntu') @mock.patch('bareon.objects.Ubuntu')
@mock.patch.object(NailgunBuildImage, 'parse_schemes') @mock.patch.object(NailgunBuildImage, 'parse_schemes')
def test_parse_operating_system_repos(self, mock_parse_schemes, mock_ub, def test_parse_operating_system_repos(self, mock_parse_schemes, mock_ub,
mock_deb, mock_proxies): mock_deb, mock_proxies):
@ -183,11 +183,11 @@ class TestNailgunBuildImage(unittest2.TestCase):
mock_deb.call_args_list[:len(REPOS_SAMPLE)]) mock_deb.call_args_list[:len(REPOS_SAMPLE)])
self.assertEqual(driver.operating_system.repos, repos) self.assertEqual(driver.operating_system.repos, repos)
@mock.patch('fuel_agent.drivers.nailgun.objects.Loop') @mock.patch('bareon.drivers.nailgun.objects.Loop')
@mock.patch('fuel_agent.objects.Image') @mock.patch('bareon.objects.Image')
@mock.patch('fuel_agent.objects.FS') @mock.patch('bareon.objects.FS')
@mock.patch('fuel_agent.objects.PartitionScheme') @mock.patch('bareon.objects.PartitionScheme')
@mock.patch('fuel_agent.objects.ImageScheme') @mock.patch('bareon.objects.ImageScheme')
@mock.patch.object(NailgunBuildImage, 'parse_operating_system') @mock.patch.object(NailgunBuildImage, 'parse_operating_system')
def test_parse_schemes( def test_parse_schemes(
self, mock_parse_os, mock_imgsch, mock_partsch, self, mock_parse_os, mock_imgsch, mock_partsch,

View File

@ -15,8 +15,8 @@
import mock import mock
import unittest2 import unittest2
from fuel_agent import errors from bareon import errors
from fuel_agent import objects from bareon import objects
class TestMultipleDevice(unittest2.TestCase): class TestMultipleDevice(unittest2.TestCase):

View File

@ -17,9 +17,9 @@ import time
import mock import mock
import unittest2 import unittest2
from fuel_agent import errors from bareon import errors
from fuel_agent.utils import partition as pu from bareon.utils import partition as pu
from fuel_agent.utils import utils from bareon.utils import utils
class TestPartitionUtils(unittest2.TestCase): class TestPartitionUtils(unittest2.TestCase):

View File

@ -18,4 +18,4 @@ from pkg_resources import require
def test_check_requirements_conflicts(): def test_check_requirements_conflicts():
require('fuel_agent') require('bareon')

View File

@ -17,9 +17,9 @@ import mock
import requests_mock import requests_mock
import unittest2 import unittest2
from fuel_agent.drivers import simple from bareon.drivers import simple
from fuel_agent import objects from bareon import objects
from fuel_agent.tests import base from bareon.tests import base
@mock.patch.multiple( @mock.patch.multiple(

View File

@ -22,8 +22,8 @@ import stevedore
import unittest2 import unittest2
import urllib3 import urllib3
from fuel_agent import errors from bareon import errors
from fuel_agent.utils import utils from bareon.utils import utils
if six.PY2: if six.PY2:
import mock import mock
@ -96,8 +96,8 @@ class ExecuteTestCase(unittest2.TestCase):
utils.execute, utils.execute,
'/usr/bin/env', 'false', check_exit_code=True) '/usr/bin/env', 'false', check_exit_code=True)
@mock.patch('fuel_agent.utils.utils.time.sleep') @mock.patch('bareon.utils.utils.time.sleep')
@mock.patch('fuel_agent.utils.utils.subprocess.Popen') @mock.patch('bareon.utils.utils.subprocess.Popen')
def test_execute_ok_on_third_attempts(self, mock_popen, mock_sleep): def test_execute_ok_on_third_attempts(self, mock_popen, mock_sleep):
process = mock.Mock() process = mock.Mock()
mock_popen.side_effect = [OSError, ValueError, process] mock_popen.side_effect = [OSError, ValueError, process]
@ -107,8 +107,8 @@ class ExecuteTestCase(unittest2.TestCase):
self.assertEqual(2 * [mock.call(CONF.execute_retry_delay)], self.assertEqual(2 * [mock.call(CONF.execute_retry_delay)],
mock_sleep.call_args_list) mock_sleep.call_args_list)
@mock.patch('fuel_agent.utils.utils.time.sleep') @mock.patch('bareon.utils.utils.time.sleep')
@mock.patch('fuel_agent.utils.utils.subprocess.Popen') @mock.patch('bareon.utils.utils.subprocess.Popen')
def test_execute_failed(self, mock_popen, mock_sleep): def test_execute_failed(self, mock_popen, mock_sleep):
mock_popen.side_effect = OSError mock_popen.side_effect = OSError
self.assertRaises(errors.ProcessExecutionError, utils.execute, self.assertRaises(errors.ProcessExecutionError, utils.execute,
@ -199,44 +199,44 @@ class ExecuteTestCase(unittest2.TestCase):
self.assertRaises(errors.HttpUrlConnectionError, self.assertRaises(errors.HttpUrlConnectionError,
utils.init_http_request, 'fake_url') utils.init_http_request, 'fake_url')
@mock.patch('fuel_agent.utils.utils.os.makedirs') @mock.patch('bareon.utils.utils.os.makedirs')
@mock.patch('fuel_agent.utils.utils.os.path.isdir', return_value=False) @mock.patch('bareon.utils.utils.os.path.isdir', return_value=False)
def test_makedirs_if_not_exists(self, mock_isdir, mock_makedirs): def test_makedirs_if_not_exists(self, mock_isdir, mock_makedirs):
utils.makedirs_if_not_exists('/fake/path') utils.makedirs_if_not_exists('/fake/path')
mock_isdir.assert_called_once_with('/fake/path') mock_isdir.assert_called_once_with('/fake/path')
mock_makedirs.assert_called_once_with('/fake/path', mode=0o755) mock_makedirs.assert_called_once_with('/fake/path', mode=0o755)
@mock.patch('fuel_agent.utils.utils.os.makedirs') @mock.patch('bareon.utils.utils.os.makedirs')
@mock.patch('fuel_agent.utils.utils.os.path.isdir', return_value=False) @mock.patch('bareon.utils.utils.os.path.isdir', return_value=False)
def test_makedirs_if_not_exists_mode_given( def test_makedirs_if_not_exists_mode_given(
self, mock_isdir, mock_makedirs): self, mock_isdir, mock_makedirs):
utils.makedirs_if_not_exists('/fake/path', mode=0o000) utils.makedirs_if_not_exists('/fake/path', mode=0o000)
mock_isdir.assert_called_once_with('/fake/path') mock_isdir.assert_called_once_with('/fake/path')
mock_makedirs.assert_called_once_with('/fake/path', mode=0o000) mock_makedirs.assert_called_once_with('/fake/path', mode=0o000)
@mock.patch('fuel_agent.utils.utils.os.makedirs') @mock.patch('bareon.utils.utils.os.makedirs')
@mock.patch('fuel_agent.utils.utils.os.path.isdir', return_value=True) @mock.patch('bareon.utils.utils.os.path.isdir', return_value=True)
def test_makedirs_if_not_exists_already_exists( def test_makedirs_if_not_exists_already_exists(
self, mock_isdir, mock_makedirs): self, mock_isdir, mock_makedirs):
utils.makedirs_if_not_exists('/fake/path') utils.makedirs_if_not_exists('/fake/path')
mock_isdir.assert_called_once_with('/fake/path') mock_isdir.assert_called_once_with('/fake/path')
self.assertEqual(mock_makedirs.mock_calls, []) self.assertEqual(mock_makedirs.mock_calls, [])
@mock.patch('fuel_agent.utils.utils.os.listdir') @mock.patch('bareon.utils.utils.os.listdir')
def test_guess_filename(self, mock_oslistdir): def test_guess_filename(self, mock_oslistdir):
mock_oslistdir.return_value = ['file1', 'file2', 'file3'] mock_oslistdir.return_value = ['file1', 'file2', 'file3']
filename = utils.guess_filename('/some/path', '^file2.*') filename = utils.guess_filename('/some/path', '^file2.*')
self.assertEqual(filename, 'file2') self.assertEqual(filename, 'file2')
mock_oslistdir.assert_called_once_with('/some/path') mock_oslistdir.assert_called_once_with('/some/path')
@mock.patch('fuel_agent.utils.utils.os.listdir') @mock.patch('bareon.utils.utils.os.listdir')
def test_guess_filename_not_found(self, mock_oslistdir): def test_guess_filename_not_found(self, mock_oslistdir):
mock_oslistdir.return_value = ['file1', 'file2', 'file3'] mock_oslistdir.return_value = ['file1', 'file2', 'file3']
filename = utils.guess_filename('/some/path', '^file4.*') filename = utils.guess_filename('/some/path', '^file4.*')
self.assertIsNone(filename) self.assertIsNone(filename)
mock_oslistdir.assert_called_once_with('/some/path') mock_oslistdir.assert_called_once_with('/some/path')
@mock.patch('fuel_agent.utils.utils.os.listdir') @mock.patch('bareon.utils.utils.os.listdir')
def test_guess_filename_not_exact_match(self, mock_oslistdir): def test_guess_filename_not_exact_match(self, mock_oslistdir):
mock_oslistdir.return_value = ['file1', 'file2', 'file3'] mock_oslistdir.return_value = ['file1', 'file2', 'file3']
filename = utils.guess_filename('/some/path', '^file.*') filename = utils.guess_filename('/some/path', '^file.*')
@ -244,7 +244,7 @@ class ExecuteTestCase(unittest2.TestCase):
self.assertEqual(filename, 'file3') self.assertEqual(filename, 'file3')
mock_oslistdir.assert_called_once_with('/some/path') mock_oslistdir.assert_called_once_with('/some/path')
@mock.patch('fuel_agent.utils.utils.os.listdir') @mock.patch('bareon.utils.utils.os.listdir')
def test_guess_filename_not_exact_match_forward_sort(self, mock_oslistdir): def test_guess_filename_not_exact_match_forward_sort(self, mock_oslistdir):
mock_oslistdir.return_value = ['file1', 'file2', 'file3'] mock_oslistdir.return_value = ['file1', 'file2', 'file3']
filename = utils.guess_filename('/some/path', '^file.*', reverse=False) filename = utils.guess_filename('/some/path', '^file.*', reverse=False)

View File

@ -21,9 +21,9 @@ import zlib
from oslo_config import cfg from oslo_config import cfg
import six import six
from fuel_agent import errors from bareon import errors
from fuel_agent.openstack.common import log as logging from bareon.openstack.common import log as logging
from fuel_agent.utils import utils from bareon.utils import utils
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -28,11 +28,11 @@ import signal
import six import six
import yaml import yaml
from fuel_agent import errors from bareon import errors
from fuel_agent.openstack.common import log as logging from bareon.openstack.common import log as logging
from fuel_agent.utils import fs as fu from bareon.utils import fs as fu
from fuel_agent.utils import hardware as hu from bareon.utils import hardware as hu
from fuel_agent.utils import utils from bareon.utils import utils
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -49,9 +49,9 @@ DEFAULT_APT_PATH = {
# FIXME(azvyagintsev): Move to oslo_config # FIXME(azvyagintsev): Move to oslo_config
# Bug: https://bugs.launchpad.net/fuel/+bug/1514772 # Bug: https://bugs.launchpad.net/fuel/+bug/1514772
PROXY_PROTOCOLS = { PROXY_PROTOCOLS = {
'ftp': '01fuel_agent-use-proxy-ftp', 'ftp': '01bareon-use-proxy-ftp',
'http': '01fuel_agent-use-proxy-http', 'http': '01bareon-use-proxy-http',
'https': '01fuel_agent-use-proxy-https' 'https': '01bareon-use-proxy-https'
} }
# NOTE(agordeev): hardcoded to r00tme # NOTE(agordeev): hardcoded to r00tme
ROOT_PASSWORD = '$6$IInX3Cqo$5xytL1VZbZTusOewFnG6couuF0Ia61yS3rbC6P5YbZP2TYcl'\ ROOT_PASSWORD = '$6$IInX3Cqo$5xytL1VZbZTusOewFnG6couuF0Ia61yS3rbC6P5YbZP2TYcl'\
@ -187,7 +187,7 @@ def do_post_inst(chroot, allow_unsigned_file='allow_unsigned_packages',
# Being enabled by default, sometimes it leads to puppet service hanging # Being enabled by default, sometimes it leads to puppet service hanging
# and recognizing the deployment as failed. # and recognizing the deployment as failed.
# TODO(agordeev): take care of puppet service for other distros, once # TODO(agordeev): take care of puppet service for other distros, once
# fuel-agent will be capable of building images for them too. # bareon will be capable of building images for them too.
if os.path.exists(os.path.join(chroot, 'etc/init.d/puppet')): if os.path.exists(os.path.join(chroot, 'etc/init.d/puppet')):
utils.execute('chroot', chroot, 'update-rc.d', 'puppet', 'disable') utils.execute('chroot', chroot, 'update-rc.d', 'puppet', 'disable')
# NOTE(agordeev): disable mcollective to be automatically started on boot # NOTE(agordeev): disable mcollective to be automatically started on boot

View File

@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from fuel_agent import errors from bareon import errors
from fuel_agent.openstack.common import log as logging from bareon.openstack.common import log as logging
from fuel_agent.utils import utils from bareon.utils import utils
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -19,9 +19,9 @@ import shutil
import six import six
from fuel_agent import errors from bareon import errors
from fuel_agent.openstack.common import log as logging from bareon.openstack.common import log as logging
from fuel_agent.utils import utils from bareon.utils import utils
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -15,9 +15,9 @@
import os import os
import stat import stat
from fuel_agent import errors from bareon import errors
from fuel_agent.openstack.common import log as logging from bareon.openstack.common import log as logging
from fuel_agent.utils import utils from bareon.utils import utils
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -266,7 +266,7 @@ def get_block_devices_from_udev_db():
major = int(line.split()[1].split('=')[1]) major = int(line.split()[1].split('=')[1])
if major not in VALID_MAJORS: if major not in VALID_MAJORS:
# NOTE(agordeev): filter out cd/dvd drives and other # NOTE(agordeev): filter out cd/dvd drives and other
# block devices in which fuel-agent aren't interested # block devices in which bareon aren't interested
break break
if line.startswith('E: DEVNAME='): if line.startswith('E: DEVNAME='):
d = line.split()[1].split('=')[1] d = line.split()[1].split('=')[1]
@ -293,7 +293,7 @@ def list_block_devices(disks=True):
# - don't use HDIO_GETGEO [Phillip Susi] # - don't use HDIO_GETGEO [Phillip Susi]
# Since the bug only affects '--report' it is safe to use # Since the bug only affects '--report' it is safe to use
# 'blockdevreport'. # 'blockdevreport'.
# fuel-agent has to be switched to use udev database in order to # bareon has to be switched to use udev database in order to
# find all block devices recognized by kernel. # find all block devices recognized by kernel.
devs = get_block_devices_from_udev_db() devs = get_block_devices_from_udev_db()
for device in devs: for device in devs:
@ -315,7 +315,7 @@ def list_block_devices(disks=True):
'device': device, 'device': device,
# NOTE(agordeev): blockdev gets 'startsec' from sysfs, # NOTE(agordeev): blockdev gets 'startsec' from sysfs,
# 'size' is determined by ioctl call. # 'size' is determined by ioctl call.
# This data was not actually used by fuel-agent, # This data was not actually used by bareon,
# so it can be removed without side effects. # so it can be removed without side effects.
'uspec': uspec, 'uspec': uspec,
'bspec': bspec, 'bspec': bspec,

View File

@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from fuel_agent import errors from bareon import errors
from fuel_agent.openstack.common import log as logging from bareon.openstack.common import log as logging
from fuel_agent.utils import utils from bareon.utils import utils
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -219,7 +219,7 @@ def lvcreate(vgname, lvname, size):
# user's confirmation: # user's confirmation:
# "WARNING: <signature> signature detected on <device>. Wipe it? [y/n]" # "WARNING: <signature> signature detected on <device>. Wipe it? [y/n]"
# FIXME: the version of lvm2 shipped with Ubuntu 14.04 does not support # FIXME: the version of lvm2 shipped with Ubuntu 14.04 does not support
# --yes option. fuel-agent should properly decomission the storage # --yes option. bareon should properly decomission the storage
# (Ubuntu installer does that just fine). # (Ubuntu installer does that just fine).
stdout, stderr = utils.execute('lvcreate', '--help') stdout, stderr = utils.execute('lvcreate', '--help')
force_opt = '--yes' if '--yes' in stdout else '' force_opt = '--yes' if '--yes' in stdout else ''

View File

@ -15,10 +15,10 @@
import itertools import itertools
import re import re
from fuel_agent import errors from bareon import errors
from fuel_agent.openstack.common import log as logging from bareon.openstack.common import log as logging
from fuel_agent.utils import hardware as hu from bareon.utils import hardware as hu
from fuel_agent.utils import utils from bareon.utils import utils
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -14,9 +14,9 @@
import time import time
from fuel_agent import errors from bareon import errors
from fuel_agent.openstack.common import log as logging from bareon.openstack.common import log as logging
from fuel_agent.utils import utils from bareon.utils import utils
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)

View File

@ -31,8 +31,8 @@ import stevedore.driver
import urllib3 import urllib3
from fuel_agent import errors from bareon import errors
from fuel_agent.openstack.common import log as logging from bareon.openstack.common import log as logging
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -45,7 +45,7 @@ u_opts = [
), ),
cfg.FloatOpt( cfg.FloatOpt(
'http_request_timeout', 'http_request_timeout',
# Setting it to 10 secs will allow fuel-agent to overcome the momentary # Setting it to 10 secs will allow bareon to overcome the momentary
# peak loads when network bandwidth becomes as low as 0.1MiB/s, thus # peak loads when network bandwidth becomes as low as 0.1MiB/s, thus
# preventing of wasting too much retries on such false positives. # preventing of wasting too much retries on such false positives.
default=10.0, default=10.0,
@ -163,9 +163,9 @@ def B2MiB(b, ceil=True):
def get_driver(name): def get_driver(name):
LOG.debug('Trying to get driver: fuel_agent.drivers.%s', name) LOG.debug('Trying to get driver: bareon.drivers.%s', name)
driver = stevedore.driver.DriverManager( driver = stevedore.driver.DriverManager(
namespace='fuel_agent.drivers', name=name).driver namespace='bareon.drivers', name=name).driver
LOG.debug('Found driver: %s', driver.__name__) LOG.debug('Found driver: %s', driver.__name__)
return driver return driver

View File

@ -14,4 +14,4 @@
import pbr.version import pbr.version
version_info = pbr.version.VersionInfo('fuel-agent') version_info = pbr.version.VersionInfo('bareon')

View File

@ -21,7 +21,7 @@ import tarfile
import tempfile import tempfile
import yaml import yaml
from fuel_agent.utils import utils from bareon.utils import utils
from fuel_bootstrap import consts from fuel_bootstrap import consts
from fuel_bootstrap import errors from fuel_bootstrap import errors

View File

@ -1,7 +1,7 @@
[DEFAULT] [DEFAULT]
# #
# Options defined in fuel_agent.manager # Options defined in bareon.manager
# #
# Data driver (string value) # Data driver (string value)
@ -12,7 +12,7 @@
#image_build_dir=/tmp #image_build_dir=/tmp
# Path to directory with cloud init templates (string value) # Path to directory with cloud init templates (string value)
#nc_template_path=/usr/share/fuel-agent/cloud-init-templates #nc_template_path=/usr/share/bareon/cloud-init-templates
# Temporary directory for file manipulations (string value) # Temporary directory for file manipulations (string value)
#tmp_path=/tmp #tmp_path=/tmp
@ -38,7 +38,7 @@
# Suffix which is used while creating temporary files (string # Suffix which is used while creating temporary files (string
# value) # value)
#image_build_suffix=.fuel-agent-image #image_build_suffix=.bareon-image
# Timeout in secs for GRUB (integer value) # Timeout in secs for GRUB (integer value)
#grub_timeout=5 #grub_timeout=5
@ -73,7 +73,7 @@
# #
# Options defined in fuel_agent.cmd.agent # Options defined in bareon.cmd.agent
# #
# Input data file (string value) # Input data file (string value)
@ -84,7 +84,7 @@
# #
# Options defined in fuel_agent.openstack.common.log # Options defined in bareon.openstack.common.log
# #
# Print debugging output (set logging level to DEBUG instead # Print debugging output (set logging level to DEBUG instead
@ -154,7 +154,7 @@ logging_debug_format_suffix=
# (Optional) Name of log file to output to. If no default is # (Optional) Name of log file to output to. If no default is
# set, logging will go to stdout. (string value) # set, logging will go to stdout. (string value)
# Deprecated group/name - [DEFAULT]/logfile # Deprecated group/name - [DEFAULT]/logfile
log_file=/var/log/fuel-agent.log log_file=/var/log/bareon.log
# (Optional) The base directory used for relative --log-file # (Optional) The base directory used for relative --log-file
# paths. (string value) # paths. (string value)
@ -178,7 +178,7 @@ log_file=/var/log/fuel-agent.log
# #
# Options defined in fuel_agent.utils.artifact # Options defined in bareon.utils.artifact
# #
# Size of data chunk to operate with images (integer value) # Size of data chunk to operate with images (integer value)
@ -186,7 +186,7 @@ log_file=/var/log/fuel-agent.log
# #
# Options defined in fuel_agent.utils.utils # Options defined in bareon.utils.utils
# #
# Maximum retries count for http requests. 0 means infinite # Maximum retries count for http requests. 0 means infinite

View File

@ -1,73 +0,0 @@
# Copyright 2014 Mirantis, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from fuel_agent.objects.bootloader import Grub
from fuel_agent.objects.configdrive import ConfigDriveCommon
from fuel_agent.objects.configdrive import ConfigDriveMcollective
from fuel_agent.objects.configdrive import ConfigDrivePuppet
from fuel_agent.objects.configdrive import ConfigDriveScheme
from fuel_agent.objects.device import Loop
from fuel_agent.objects.image import Image
from fuel_agent.objects.image import ImageScheme
from fuel_agent.objects.operating_system import Centos
from fuel_agent.objects.operating_system import OperatingSystem
from fuel_agent.objects.operating_system import Ubuntu
from fuel_agent.objects.partition.fs import FileSystem
from fuel_agent.objects.partition.lv import LogicalVolume
from fuel_agent.objects.partition.md import MultipleDevice
from fuel_agent.objects.partition.parted import Parted
from fuel_agent.objects.partition.parted import Partition
from fuel_agent.objects.partition.pv import PhysicalVolume
from fuel_agent.objects.partition.scheme import PartitionScheme
from fuel_agent.objects.partition.vg import VolumeGroup
from fuel_agent.objects.repo import DEBRepo
from fuel_agent.objects.repo import Repo
from fuel_agent.objects.repo import RepoProxies
PV = PhysicalVolume
VG = VolumeGroup
LV = LogicalVolume
MD = MultipleDevice
FS = FileSystem
__all__ = [
'Partition',
'Parted',
'PhysicalVolume',
'PV',
'VolumeGroup',
'VG',
'LogicalVolume',
'LV',
'MultipleDevice',
'MD',
'FileSystem',
'FS',
'PartitionScheme',
'ConfigDriveCommon',
'ConfigDrivePuppet',
'ConfigDriveMcollective',
'ConfigDriveScheme',
'Image',
'ImageScheme',
'Grub',
'OperatingSystem',
'Ubuntu',
'Centos',
'Repo',
'DEBRepo',
'Loop',
'RepoProxies'
]

View File

@ -7,4 +7,4 @@ module=log
module=processutils module=processutils
# The base module to hold the copy of openstack.common # The base module to hold the copy of openstack.common
base=fuel_agent base=bareon

View File

@ -1,35 +1,35 @@
[metadata] [metadata]
name = fuel-agent name = bareon
version = 8.0.0 version = 1.0.0.dev
author = Mirantis author = Mirantis
author-email = fuel-dev@lists.launchpad.net author-email = openstack-dev@lists.openstack.org
summary = Fuel agent summary = Bareon
classifier = classifier =
Development Status :: 4 - Beta Development Status :: 4 - Beta
Programming Language :: Python Programming Language :: Python
[files] [files]
packages = packages =
fuel_agent bareon
[entry_points] [entry_points]
console_scripts = console_scripts =
# TODO(kozhukalov): rename entry point # TODO(kozhukalov): rename entry point
provision = fuel_agent.cmd.agent:provision provision = bareon.cmd.agent:provision
fa_partition = fuel_agent.cmd.agent:partition fa_partition = bareon.cmd.agent:partition
fa_configdrive = fuel_agent.cmd.agent:configdrive fa_configdrive = bareon.cmd.agent:configdrive
fa_copyimage = fuel_agent.cmd.agent:copyimage fa_copyimage = bareon.cmd.agent:copyimage
fa_bootloader = fuel_agent.cmd.agent:bootloader fa_bootloader = bareon.cmd.agent:bootloader
fa_build_image = fuel_agent.cmd.agent:build_image fa_build_image = bareon.cmd.agent:build_image
fa_ironic_callback = fuel_agent.cmd.ironic_callback:main fa_ironic_callback = bareon.cmd.ironic_callback:main
fa_mkbootstrap = fuel_agent.cmd.agent:mkbootstrap fa_mkbootstrap = bareon.cmd.agent:mkbootstrap
fuel_agent.drivers = bareon.drivers =
nailgun = fuel_agent.drivers.nailgun:Nailgun nailgun = bareon.drivers.nailgun:Nailgun
nailgun_simple = fuel_agent.drivers.simple:NailgunSimpleDriver nailgun_simple = bareon.drivers.simple:NailgunSimpleDriver
nailgun_build_image = fuel_agent.drivers.nailgun:NailgunBuildImage nailgun_build_image = bareon.drivers.nailgun:NailgunBuildImage
ironic = fuel_agent.drivers.nailgun:Ironic ironic = bareon.drivers.nailgun:Ironic
bootstrap_build_image = fuel_agent.drivers.bootstrap:BootstrapBuildImage bootstrap_build_image = bareon.drivers.bootstrap:BootstrapBuildImage
[pbr] [pbr]
autodoc_index_modules = True autodoc_index_modules = True
@ -40,7 +40,7 @@ skip_git_sdist = True
[global] [global]
setup-hooks = setup-hooks =
pbr.hooks.setup_hook pbr.hooks.setup_hook
fuel_agent.hooks.setup_hook bareon.hooks.setup_hook
[build_sphinx] [build_sphinx]
all_files = 1 all_files = 1

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
PROJECT_NAME=${PROJECT_NAME:-fuel_agent} PROJECT_NAME=${PROJECT_NAME:-bareon}
CFGFILE_NAME=${PROJECT_NAME}.conf.sample CFGFILE_NAME=${PROJECT_NAME}.conf.sample
if [ -e etc/${PROJECT_NAME}/${CFGFILE_NAME} ]; then if [ -e etc/${PROJECT_NAME}/${CFGFILE_NAME} ]; then

View File

@ -114,7 +114,7 @@ export EVENTLET_NO_GREENDNS=yes
OS_VARS=$(set | sed -n '/^OS_/s/=[^=]*$//gp' | xargs) OS_VARS=$(set | sed -n '/^OS_/s/=[^=]*$//gp' | xargs)
[ "$OS_VARS" ] && eval "unset \$OS_VARS" [ "$OS_VARS" ] && eval "unset \$OS_VARS"
DEFAULT_MODULEPATH=fuel_agent.openstack.common.config.generator DEFAULT_MODULEPATH=bareon.openstack.common.config.generator
MODULEPATH=${MODULEPATH:-$DEFAULT_MODULEPATH} MODULEPATH=${MODULEPATH:-$DEFAULT_MODULEPATH}
OUTPUTFILE=${OUTPUTFILE:-$OUTPUTDIR/$PACKAGENAME.conf.sample} OUTPUTFILE=${OUTPUTFILE:-$OUTPUTDIR/$PACKAGENAME.conf.sample}
python -m $MODULEPATH $MODULES $LIBRARIES $FILES > $OUTPUTFILE python -m $MODULEPATH $MODULES $LIBRARIES $FILES > $OUTPUTFILE

View File

@ -10,7 +10,7 @@ setenv = VIRTUAL_ENV={envdir}
deps = -r{toxinidir}/requirements.txt deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
commands = commands =
py.test -vv {posargs:fuel_agent/tests} py.test -vv {posargs:bareon/tests}
[tox:jenkins] [tox:jenkins]
downloadcache = ~/cache/pip downloadcache = ~/cache/pip
@ -18,13 +18,13 @@ downloadcache = ~/cache/pip
[testenv:pep8] [testenv:pep8]
deps = hacking==0.10.2 deps = hacking==0.10.2
commands = commands =
flake8 {posargs:fuel_agent} flake8 {posargs:bareon}
flake8 {posargs:contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap} flake8 {posargs:contrib/fuel_bootstrap/fuel_bootstrap_cli/fuel_bootstrap}
[testenv:cover] [testenv:cover]
setenv = VIRTUAL_ENV={envdir} setenv = VIRTUAL_ENV={envdir}
commands = commands =
py.test --cov fuel_agent {posargs:fuel_agent/tests} py.test --cov bareon {posargs:bareon/tests}
[testenv:venv] [testenv:venv]
commands = {posargs:} commands = {posargs:}
@ -43,4 +43,4 @@ show-source = True
count = True count = True
[hacking] [hacking]
import_exceptions = fuel_agent.openstack.common.gettextutils._,testtools.matchers import_exceptions = bareon.openstack.common.gettextutils._,testtools.matchers