Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/3.3-devel' into 3.3-release
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtechtrefny committed Oct 20, 2020
2 parents 1034cbb + d990f20 commit 79f03d8
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 15 deletions.
13 changes: 13 additions & 0 deletions .packit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
actions:
get-current-version:
- "python3 ./setup.py --version"
create-archive:
- "make local"
- 'bash -c "ls *.tar*"'
jobs:
- job: tests
metadata:
targets:
- fedora-all
- fedora-eln
trigger: pull_request
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ archive: po-pull
git archive --format=tar --prefix=$(PKGNAME)-$(VERSION)/ $(VERSION_TAG) | tar -xf -
cp -r po $(PKGNAME)-$(VERSION)
cp ChangeLog $(PKGNAME)-$(VERSION)/
( cd $(PKGNAME)-$(VERSION) && $(PYTHON) setup.py -q sdist --dist-dir .. )
( cd $(PKGNAME)-$(VERSION) && $(PYTHON) setup.py -q sdist --dist-dir .. --mode release )
rm -rf $(PKGNAME)-$(VERSION)
@echo "The archive is in $(PKGNAME)-$(VERSION).tar.gz"
@make tests-archive
Expand All @@ -146,7 +146,7 @@ tests-archive:

local: po-pull
@make -B ChangeLog
$(PYTHON) setup.py -q sdist --dist-dir .
$(PYTHON) setup.py -q sdist --dist-dir . --mode normal
@echo "The archive is in $(PKGNAME)-$(VERSION).tar.gz"
git ls-files tests/ | tar -T- -czf $(PKGNAME)-$(VERSION)-tests.tar.gz
@echo "The test archive is in $(PKGNAME)-$(VERSION)-tests.tar.gz"
Expand Down
8 changes: 4 additions & 4 deletions blivet/blivet.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ def new_vg(self, *args, **kwargs):
safe_name, name)
name = safe_name
else:
name = self.suggest_container_name()
name = self.suggest_container_name(container_type=devicefactory.DEVICE_TYPE_LVM)

if name in self.names:
raise ValueError("name already in use")
Expand Down Expand Up @@ -721,7 +721,7 @@ def new_btrfs(self, *args, **kwargs):
dev_class = BTRFSVolumeDevice
# set up the volume label, using hostname if necessary
if not name:
name = self.suggest_container_name()
name = self.suggest_container_name(container_type=devicefactory.DEVICE_TYPE_BTRFS)
if "label" not in fmt_args:
fmt_args["label"] = name
fmt_args["subvolspec"] = MAIN_VOLUME_ID
Expand Down Expand Up @@ -929,15 +929,15 @@ def safe_device_name(self, name, device_type=None):
def _get_container_name_template(self, prefix=None):
return prefix or ""

def suggest_container_name(self, prefix=""):
def suggest_container_name(self, prefix="", container_type=None):
""" Return a reasonable, unused device name.
:keyword prefix: a prefix for the container name
:returns: the suggested name
:rtype: str
"""
if not prefix:
prefix = self.short_product_name
prefix = self.safe_device_name(self.short_product_name, container_type)

template = self._get_container_name_template(prefix=prefix)
names = self.names
Expand Down
3 changes: 2 additions & 1 deletion blivet/devicelibs/edd.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@ def collect_mbrs(devices, root=None):
"""
mbr_dict = {}
for dev in devices:
fd = -1
try:
path = util.Path("/dev", root=root) + dev.name
fd = os.open(path.ondisk, os.O_RDONLY)
Expand All @@ -679,7 +680,7 @@ def collect_mbrs(devices, root=None):
testdata_log.debug("device %s data[440:443] raised %s", path, e)
log.error("edd: could not read mbrsig from disk %s: %s",
dev.name, str(e))
if fd:
if fd > 0:
os.close(fd)
continue

Expand Down
4 changes: 2 additions & 2 deletions blivet/devicetree.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

from .actionlist import ActionList
from .callbacks import callbacks
from .errors import DeviceError, DeviceTreeError, StorageError, DuplicateUUIDError
from .errors import DeviceError, DeviceTreeError, StorageError, DuplicateUUIDError, InvalidMultideviceSelection
from .deviceaction import ActionDestroyDevice, ActionDestroyFormat
from .devices import BTRFSDevice, NoDevice, PartitionDevice
from .devices import LVMLogicalVolumeDevice, LVMVolumeGroupDevice
Expand Down Expand Up @@ -963,7 +963,7 @@ def _hide_ignored_disks(self):
if is_ignored:
if len(disk.children) == 1:
if not all(self._is_ignored_disk(d) for d in disk.children[0].parents):
raise DeviceTreeError("Including only a subset of raid/multipath member disks is not allowed.")
raise InvalidMultideviceSelection("Including only a subset of raid/multipath member disks is not allowed.")

# and also children like fwraid or mpath
self.hide(disk.children[0])
Expand Down
6 changes: 6 additions & 0 deletions blivet/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,12 @@ class DuplicateVGError(UnusableConfigurationError):
"Hint 2: You can get the VG UUIDs by running "
"'pvs -o +vg_uuid'.")


class InvalidMultideviceSelection(UnusableConfigurationError):
suggestion = N_("All parent devices must be selected when choosing exclusive "
"or ignored disks for a multipath or firmware RAID device.")


# DeviceAction


Expand Down
3 changes: 3 additions & 0 deletions blivet/iscsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,9 @@ def startup(self):
if not has_iscsi():
return

# make sure that the file /etc/iscsi/initiatorname.iscsi exists
util.run_program(["systemctl", "start", "iscsi-init.service"])

if self._initiator == "":
log.info("no initiator set")
return
Expand Down
3 changes: 3 additions & 0 deletions blivet/populator/populator.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ def parted_exn_handler(exn_type, exn_options, exn_msg):
if exn_type == parted.EXCEPTION_TYPE_ERROR and \
exn_options == parted.EXCEPTION_OPT_YES_NO:
ret = parted.EXCEPTION_RESOLVE_YES
elif exn_type == parted.EXCEPTION_TYPE_WARNING and \
exn_options & parted.EXCEPTION_RESOLVE_FIX:
ret = parted.EXCEPTION_RESOLVE_FIX
return ret


Expand Down
20 changes: 16 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ def findall(dirname=os.curdir):

# Extend the sdist command
class blivet_sdist(sdist):
user_options = sdist.user_options + [('mode=', None, "specify mode for sdist; one of 'release', 'normal'"),]

def initialize_options(self):
sdist.initialize_options(self)
self.mode = None

def finalize_options(self):
sdist.finalize_options(self)
if self.mode not in (None, 'release', 'normal'):
raise AttributeError('Unknown mode %s' % self.mode)

def run(self):
# Build the .mo files
subprocess.check_call(['make', '-C', 'po'])
Expand All @@ -55,10 +66,11 @@ def make_release_tree(self, base_dir, files):
# Run the parent command first
sdist.make_release_tree(self, base_dir, files)

# Run translation-canary in release mode to remove any bad translations
sys.path.append('translation-canary')
from translation_canary.translated import testSourceTree # pylint: disable=import-error
testSourceTree(base_dir, releaseMode=True)
if self.mode == "release":
# Run translation-canary in release mode to remove any bad translations
sys.path.append('translation-canary')
from translation_canary.translated import testSourceTree # pylint: disable=import-error
testSourceTree(base_dir, releaseMode=True)


data_files = [
Expand Down
4 changes: 2 additions & 2 deletions tests/devicetree_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import unittest

from blivet.actionlist import ActionList
from blivet.errors import DeviceTreeError, DuplicateUUIDError
from blivet.errors import DeviceTreeError, DuplicateUUIDError, InvalidMultideviceSelection
from blivet.deviceaction import ACTION_TYPE_DESTROY, ACTION_OBJECT_DEVICE
from blivet.devicelibs import lvm
from blivet.devices import DiskDevice
Expand Down Expand Up @@ -541,5 +541,5 @@ def test_ignored_disks_multipath_3(self):
self.tree.ignored_disks = ["sda", "sdb"]
self.tree.exclusive_disks = []

with self.assertRaises(DeviceTreeError):
with self.assertRaises(InvalidMultideviceSelection):
self.tree._hide_ignored_disks()

0 comments on commit 79f03d8

Please sign in to comment.