[master] Only enable non-interactive yum plugins (#1111535)
by David Shea
The environment is no longer something we can control, so we must
instead control ourselves. Change the preconf.plugin_types variable so
we don't blow up when someone does an image install and also has the
changelog plugin installed.
---
pyanaconda/packaging/yumpayload.py | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index 2843e91..3e66b7f 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -230,9 +230,8 @@ class YumPayload(PackagePayload):
# Set some configuration parameters that don't get set through a config
# file. yum will know what to do with these.
- # Enable all types of yum plugins. We're somewhat careful about what
- # plugins we put in the environment.
- self._yum.preconf.plugin_types = yum.plugins.ALL_TYPES
+ # Only enable non-interactive yum plugins
+ self._yum.preconf.plugin_types = yum.plugins.TYPE_CORE
self._yum.preconf.enabled_plugins = YUM_PLUGINS
self._yum.preconf.fn = "/tmp/anaconda-yum.conf"
self._yum.preconf.root = root
--
2.1.0
9 years, 5 months
[blivet][master] prop up unit tests
by David Lehman
Patch 1 is needed for ImageBackedTestCase to work since something
reliably prevents kpartx from removing dm partition device nodes
when we remove the partitions using pyparted. For whatever reason,
we can remove them using dmsetup.
Patches 2 and 3 fix parted.Partition lookup for partitions on DiskFile
disks.
"Temporarily disable..." is just a hack so we can start running tests
without a proper solution to whatever the underlying problem is with
mdadm_test.
David Lehman (6):
Fix test that guards forcible removal of dm partition nodes.
devicePathToName should default to returning a basename.
Pass a path (not a name) to devicePathToName.
The minimum size for a btrfs member device has increased to 16 MiB.
Temporarily disable a test that isn't working.
Don't run selinux context tests when selinux is disabled.
blivet/devices/lib.py | 5 +++++
blivet/devices/partition.py | 6 ++++--
tests/devicelibs_test/btrfs_test.py | 2 +-
tests/devicelibs_test/mdraid_test.py | 1 +
tests/formats_test/selinux_test.py | 1 +
5 files changed, 12 insertions(+), 3 deletions(-)
--
1.9.3
9 years, 5 months
[f21/master] Disable payloads that failed to setup (#1162732)
by David Shea
Add a unsetup method to Payload that is called by PayloadManager when
setting up a payload fails. For dnf and tarpayload, just unset
some attributes during unsetup, for live unmount the tree, and for
yumpayload unset the _setup flag and expand the flag's use to disable
access to the yum comps magic properties.
This fixes a problem that is most troublesome with yum, where the setup
for a kickstart or command-line repo can fail, and a later variable
access in the software spoke will start yum downloading metadata from
somewhere else and setting half of the variables that we expect and
crashing. By invalidating the payload we avoid the accidental fallback
to the wrong repos.
---
pyanaconda/packaging/__init__.py | 8 ++++++++
pyanaconda/packaging/dnfpayload.py | 4 ++++
pyanaconda/packaging/livepayload.py | 13 +++++++++++++
pyanaconda/packaging/tarpayload.py | 4 ++++
pyanaconda/packaging/yumpayload.py | 7 +++++++
5 files changed, 36 insertions(+)
diff --git a/pyanaconda/packaging/__init__.py b/pyanaconda/packaging/__init__.py
index 9a82c77..df9b55c 100644
--- a/pyanaconda/packaging/__init__.py
+++ b/pyanaconda/packaging/__init__.py
@@ -138,6 +138,11 @@ class Payload(object):
self.storage = storage
self.instclass = instClass
+ def unsetup(self):
+ """ Invalidate a previously setup paylaod. """
+ self.storage = None
+ self.instclass = None
+
def preStorage(self):
""" Do any payload-specific work necessary before writing the storage
configuration. This method need not be provided by all payloads.
@@ -1243,6 +1248,7 @@ class PayloadManager(object):
log.error("PayloadError: %s", e)
self._error = self.ERROR_SETUP
self._setState(self.STATE_ERROR)
+ payload.unsetup()
return
# Gather the group data
@@ -1255,6 +1261,7 @@ class PayloadManager(object):
log.error("No base repo configured")
self._error = self.ERROR_MD
self._setState(self.STATE_ERROR)
+ payload.unsetup()
return
try:
@@ -1271,6 +1278,7 @@ class PayloadManager(object):
log.error("MetadataError: %s", e)
self._error = self.ERROR_SOURCE
self._setState(self.STATE_ERROR)
+ payload.unsetup()
return
self._setState(self.STATE_FINISHED)
diff --git a/pyanaconda/packaging/dnfpayload.py b/pyanaconda/packaging/dnfpayload.py
index 08c3d2f..64affc9 100644
--- a/pyanaconda/packaging/dnfpayload.py
+++ b/pyanaconda/packaging/dnfpayload.py
@@ -189,6 +189,10 @@ class DNFPayload(packaging.PackagePayload):
self._base = None
self._configure()
+ def unsetup(self):
+ super(DNFPayload, self).unsetup()
+ self._base = None
+
def _add_repo(self, ksrepo):
"""Add a repo to the dnf repo object
diff --git a/pyanaconda/packaging/livepayload.py b/pyanaconda/packaging/livepayload.py
index 729d40c..4810837 100644
--- a/pyanaconda/packaging/livepayload.py
+++ b/pyanaconda/packaging/livepayload.py
@@ -83,6 +83,15 @@ class LiveImagePayload(ImagePayload):
source = iutil.eintr_retry_call(os.statvfs, INSTALL_TREE)
self.source_size = source.f_frsize * (source.f_blocks - source.f_bfree)
+ def unsetup(self):
+ super(LiveImagePayload, self).unsetup()
+
+ # Unmount a previously mounted live tree
+ try:
+ blivet.util.umount(INSTALL_TREE)
+ except OSError:
+ pass
+
def preInstall(self, packages=None, groups=None):
""" Perform pre-installation tasks. """
super(LiveImagePayload, self).preInstall(packages=packages, groups=groups)
@@ -274,6 +283,10 @@ class LiveImageKSPayload(LiveImagePayload):
log.debug("liveimg size is %s", self._min_size)
+ def unsetup(self):
+ # Skip LiveImagePayload's unsetup method
+ ImagePayload.unsetup(self)
+
def preInstall(self, *args, **kwargs):
""" Download image and loopback mount it.
diff --git a/pyanaconda/packaging/tarpayload.py b/pyanaconda/packaging/tarpayload.py
index 74db9b4..b6328e0 100644
--- a/pyanaconda/packaging/tarpayload.py
+++ b/pyanaconda/packaging/tarpayload.py
@@ -61,6 +61,10 @@ class TarPayload(ArchivePayload):
log.error("opening tar archive %s: %s", self.image_file, e)
raise PayloadError("invalid payload format")
+ def unsetup(self):
+ super(TarPayload, self).unsetup()
+ self.archive = None
+
@property
def requiredSpace(self):
byte_count = sum(m.size for m in self.archive.getmembers())
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index c183e19..43e7d3e 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -196,6 +196,10 @@ class YumPayload(PackagePayload):
self._writeYumConfig()
self._setup = True
+ def unsetup(self):
+ super(YumPayload, self).unsetup()
+ self._setup = False
+
def _resetYum(self, root=None, keep_cache=False, releasever=None):
""" Delete and recreate the payload's YumBase instance.
@@ -998,6 +1002,9 @@ reposdir=%s
@property
def _yumGroups(self):
""" yum.comps.Comps instance. """
+ if not self._setup:
+ return []
+
from yum.Errors import RepoError, GroupsError
with _yum_lock:
if not self._groups:
--
2.1.0
9 years, 5 months
[PATCH] add code to handle liveimg --url=file:// as special case
by Gene Czarcinski
This patch addresses the problem in RHBZ#1140358.
The added code checks to see if --url=file:// was specified and,
if it was and if that file exists and if it is not a tarball,
then use the specified file directly rather than downloading
(copying) it.
Note: The file needs to be a squashfs file as created for a Live Install.
---
pyanaconda/packaging/livepayload.py | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/pyanaconda/packaging/livepayload.py b/pyanaconda/packaging/livepayload.py
index d6db00b..05d1afe 100644
--- a/pyanaconda/packaging/livepayload.py
+++ b/pyanaconda/packaging/livepayload.py
@@ -281,6 +281,28 @@ class LiveImageKSPayload(LiveImagePayload):
to grab the image. Download it to sysroot and provide feedback
during the download (using urlgrabber callback).
"""
+ # Handle the special case of liveimg --url=file:// and do not
+ # download. Instead, use the file directly.
+ test_special = not self.is_tarfile and self.data.method.url.startswith("file://")
+ test_special = test_special and os.path.exists(self.data.method.url[7:])
+ if test_special:
+ log.info("LiveImageKSPayload.preinstall handling special case of file://")
+ if not os.path.exists(IMAGE_DIR):
+ os.makedirs(IMAGE_DIR, 0O755)
+ blivet.util.mount(self.data.method.url[7:], IMAGE_DIR,
+ fstype="auto", options="ro")
+ if os.path.exists(IMAGE_DIR+"/LiveOS"):
+ img_files = glob.glob(IMAGE_DIR+"/LiveOS/*.img")
+ if img_files:
+ img_file = os.path.basename(sorted(img_files)[0])
+ blivet.util.mount(IMAGE_DIR+"/LiveOS/"+img_file,
+ INSTALL_TREE, fstype="auto", options="ro")
+ source = os.statvfs(INSTALL_TREE)
+ self.source_size = source.f_frsize * (source.f_blocks - source.f_bfree)
+ log.info("LiveImageKSPayload.preinstall for file:// is done")
+ return
+ else:
+ blivet.util.umount(IMAGE_DIR)
# Setup urlgrabber and call back to download image to sysroot
progress = URLGrabberProgress()
ugopts = {"ssl_verify_peer": not self.data.method.noverifyssl,
@@ -358,7 +380,9 @@ class LiveImageKSPayload(LiveImagePayload):
"""
# If it doesn't look like a tarfile use the super's install()
if not self.is_tarfile:
+ log.debug("LiveImageKSPayload.install starting")
super(LiveImageKSPayload, self).install()
+ log.debug("LiveImageKSPayload.install done")
return
# Use 2x the archive's size to estimate the size of the install
--
1.9.3
9 years, 5 months
[firstboot][PATCH] Mark Firstboot as an architecture specific package (#1162567)
by Martin Kolman
We conditionally include s390 specific files in the %files
section, so the package should not be noarch.
Resolves: rhbz#1162567
Signed-off-by: Martin Kolman <mkolman(a)redhat.com>
---
firstboot.spec | 1 -
1 file changed, 1 deletion(-)
diff --git a/firstboot.spec b/firstboot.spec
index fd21554..d28b8a0 100644
--- a/firstboot.spec
+++ b/firstboot.spec
@@ -13,7 +13,6 @@ Source0: %{name}-%{version}.tar.bz2
License: GPLv2+
Group: System Environment/Base
ExclusiveOS: Linux
-BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: gettext
BuildRequires: python-devel, python-setuptools-devel
--
1.9.3
9 years, 5 months
[PATCH rhel7-branch] network: fix a typo making creating virtual devices in %pre fail (#1075195)
by Radek Vykydal
Resolves: rhbz#1075195
---
pyanaconda/network.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pyanaconda/network.py b/pyanaconda/network.py
index e9b6ff1..05583b9 100644
--- a/pyanaconda/network.py
+++ b/pyanaconda/network.py
@@ -489,7 +489,7 @@ def add_connection_for_ksdata(networkdata, devname):
values.append(['vlan', 'id', int(networkdata.vlanid), 'u'])
dev_spec = None
# type "bridge"
- if networkdata.bridgeslaves:
+ elif networkdata.bridgeslaves:
# bridge connection is autoactivated
values.append(['connection', 'type', 'bridge', 's'])
values.append(['connection', 'id', devname, 's'])
--
1.9.3
9 years, 5 months