[PATCH] Revert "Fix up username checking regex a bit."
by David Shea
This re-enables usernames with capital-letters. I'm not saying they're a
good idea, but there's nothing that says you can't, and
system-config-users and adduser both allow them.
This reverts commit 2a8208c97e35f8287912a86bc593fe27b36a5e92.
---
pyanaconda/regexes.py | 2 +-
tests/regex_tests/username_test.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/pyanaconda/regexes.py b/pyanaconda/regexes.py
index 79136f9..5d8fd9b 100644
--- a/pyanaconda/regexes.py
+++ b/pyanaconda/regexes.py
@@ -44,7 +44,7 @@ GECOS_VALID = re.compile(r'^[^:]*$')
# a base expression without anchors, helpful for building other expressions
# If the string is the right length to match "root", use a lookback expression
# to make sure it isn't.
-_USERNAME_BASE = r'[a-z0-9._](([a-z0-9._-]{0,2})|([a-z0-9._-]{3}(?<!root))|([a-z0-9._-]{4,31})|([a-z0-9._-]{,30}\$))'
+_USERNAME_BASE = r'[a-zA-Z0-9._](([a-zA-Z0-9._-]{0,2})|([a-zA-Z0-9._-]{3}(?<!root))|([a-zA-Z0-9._-]{4,31})|([a-zA-Z0-9._-]{,30}\$))'
USERNAME_VALID = re.compile(r'^' + _USERNAME_BASE + '$')
GROUPNAME_VALID = USERNAME_VALID
diff --git a/tests/regex_tests/username_test.py b/tests/regex_tests/username_test.py
index 7195788..0c0d5d2 100644
--- a/tests/regex_tests/username_test.py
+++ b/tests/regex_tests/username_test.py
@@ -65,6 +65,7 @@ class UsernameRegexTestCase(unittest.TestCase):
"""Test a list of possible username values."""
good_tests = [
'gburdell',
+ 'GBurdell',
'gburdell$',
'g_burdell',
'_burdell',
@@ -89,7 +90,6 @@ class UsernameRegexTestCase(unittest.TestCase):
' gburdell',
':gburdell',
'root',
- 'GBurdell',
'$',
'-'
]
--
1.8.5.3
10 years, 3 months
[PATCH anaconda:rhel7/master] Change the string used to test for serial console (#1054951)
by d.marlin
The string used to test for serial console is a literal ("ttyS"). To support
serial consoles other than those starting with "ttyS", such as ttyAMA0 for ARM,
create a list of string values that may be used. Add a property to test if
the console device starts with any of these strings.
Note: 64-bit ARM (aarch64) hardware may use either ttyS0 or ttyAMA0 for the
serial console. The Foundation Model simulator currently uses ttyAMA0.
Resolves: rhbz#1054951
Signed-off-by: David A. Marlin <dmarlin(a)redhat.com>
---
pyanaconda/bootloader.py | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index 1fe292f..cab0c1b 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -1004,6 +1004,8 @@ class GRUB(BootLoader):
packages = ["grub"]
+ _serial_console = ["ttyS"]
+
def __init__(self):
super(GRUB, self).__init__()
self.encrypted_password = ""
@@ -1055,9 +1057,18 @@ class GRUB(BootLoader):
return GRUB._config_dir
@property
+ def hasSerialConsole(self):
+ """ true if the console is a serial console. """
+ for _console in self._serial_console:
+ if self.console.startswith(_console):
+ return True
+ return False
+
+
+ @property
def serial_command(self):
command = ""
- if self.console and self.console.startswith("ttyS"):
+ if self.console and self.hasSerialConsole:
unit = self.console[-1]
command = ["serial"]
s = parse_serial_opt(self.console_options)
@@ -1082,7 +1093,7 @@ class GRUB(BootLoader):
if not self.console:
return
- if self.console.startswith("ttyS"):
+ if self.hasSerialConsole:
config.write("%s\n" % self.serial_command)
config.write("terminal --timeout=%s serial console\n"
% self.timeout)
@@ -1462,7 +1473,7 @@ class GRUB2(GRUB):
defaults.write("GRUB_DISTRIBUTOR=\"$(sed 's, release .*$,,g' /etc/system-release)\"\n")
defaults.write("GRUB_DEFAULT=saved\n")
defaults.write("GRUB_DISABLE_SUBMENU=true\n")
- if self.console and self.console.startswith("ttyS"):
+ if self.console and self.hasSerialConsole:
defaults.write("GRUB_TERMINAL=\"serial console\"\n")
defaults.write("GRUB_SERIAL_COMMAND=\"%s\"\n" % self.serial_command)
else:
@@ -1730,6 +1741,9 @@ class EFIGRUB(GRUB2):
class Aarch64EFIGRUB(EFIGRUB):
packages = ["grub2-efi", "grubby"]
+ _serial_console = ["ttyAMA", "ttyS"]
+
+
class MacEFIGRUB(EFIGRUB):
def mactel_config(self):
if os.path.exists(ROOT_PATH + "/usr/libexec/mactel-boot-setup"):
--
1.7.1
10 years, 3 months
[PATCH] adjust Installation Options guide text for new partitioning workflow
by Adam Williamson
With the new partitioning workflow, you can't go from Installation Options
to custom partitioning any more, but the guide text still says you can. Here's
a possible re-wording.
---
pyanaconda/ui/gui/spokes/storage.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index fb08041..8dfdffd 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -169,9 +169,9 @@ class NeedSpaceDialog(InstallOptionsDialogBase):
label_text = _("<b>You don't have enough space available to install "
"%s</b>. You can shrink or remove existing partitions "
- "via our guided reclaim space tool, or you can adjust your "
- "partitions on your own in the custom partitioning "
- "interface.") % escape_markup(productName)
+ "via our guided reclaim space tool, or you can cancel "
+ "and change your package set or target disk "
+ "choices.") % escape_markup(productName)
self.builder.get_object("need_space_options_label").set_markup(label_text)
self._add_modify_watcher("need_space_desc_label")
--
1.8.5.3
10 years, 3 months
[anaconda:rhel7/master] Add description of --image option to boot-options.txt (#1056791)
by Anne Mulhern
Resolves: rhbz#1056791
Signed-off-by: mulhern <amulhern(a)redhat.com>
---
docs/boot-options.txt | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/docs/boot-options.txt b/docs/boot-options.txt
index 88fc238..6438e19 100644
--- a/docs/boot-options.txt
+++ b/docs/boot-options.txt
@@ -88,6 +88,23 @@ the space character (' ').
This specifies the location to fetch only the installer runtime image;
packages will be ignored. Otherwise the same as <<inst.repo,`inst.repo`>>.
+[[dest]]
+Installation Destination
+------------------------
+
+=== --image ===
+Specify disk image file to be used as installation destination.
+
+`--image=<path>[:<name>]`::
+Specify an image file located at `<path>` and an optional `<name>` to identify
+the disk.
+`<path>` must be local but it may be relative or absolute.
+If `<name>` is not specified, a name is synthesized from the basename of
+`<path>`.
+`<name>` may not contain a colon.
+May be used multiple times to specify multiple disks.
+It is inadvisable to specify the same disk path twice or to use duplicate names.
+
[[kickstart]]
Kickstart
---------
--
1.8.3.1
10 years, 3 months
[rhel7-branch] [PATCH] Use integer numbers of megabytes in the Reclaim dialog (#1034232)
by Vratislav Podzimek
Float numbers caused a number of bugs and issues that were really painful to
fix. It's time to stop playing with tenths and hundredths of megabytes nobody
really cares about in the year 2013.
(ported and squashed 03f4c0442d731697cfab2ee1856efc6537a47b04,
6ad78e90dd5a87a93c3ab33fb300f107b4993c70 and
8bf17db3f9fc880978770b9945001090eeda78ad
from master)
Signed-off-by: Vratislav Podzimek <vpodzime(a)redhat.com>
---
pyanaconda/ui/gui/spokes/lib/resize.glade | 2 +-
pyanaconda/ui/gui/spokes/lib/resize.py | 35 ++++++++++++++++---------------
2 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/lib/resize.glade b/pyanaconda/ui/gui/spokes/lib/resize.glade
index 73da596..a46201d 100644
--- a/pyanaconda/ui/gui/spokes/lib/resize.glade
+++ b/pyanaconda/ui/gui/spokes/lib/resize.glade
@@ -20,7 +20,7 @@
<!-- column-name diskTooltip -->
<column type="gchararray"/>
<!-- column-name diskResizeTarget -->
- <column type="gfloat"/>
+ <column type="gint"/>
<!-- column-name diskName -->
<column type="gchararray"/>
</columns>
diff --git a/pyanaconda/ui/gui/spokes/lib/resize.py b/pyanaconda/ui/gui/spokes/lib/resize.py
index a60d8da..e978f04 100644
--- a/pyanaconda/ui/gui/spokes/lib/resize.py
+++ b/pyanaconda/ui/gui/spokes/lib/resize.py
@@ -21,6 +21,7 @@
from __future__ import division
from collections import namedtuple
+from math import ceil
# pylint: disable-msg=E0611
from gi.repository import Gdk, Gtk
@@ -131,14 +132,14 @@ class ResizeDialog(GUIObject):
diskReclaimableSpace = disk.size
itr = self._diskStore.append(None, [disk.id,
- "%s %s" % (size_str(disk.size), disk.description),
+ "%s %s" % (size_str(int(disk.size)), disk.description),
fstype,
"<span foreground='grey' style='italic'>%s total</span>",
_(PRESERVE),
editable,
False,
self._get_tooltip(disk),
- disk.size,
+ int(disk.size),
disk.name])
if disk.partitioned:
@@ -151,7 +152,7 @@ class ResizeDialog(GUIObject):
if dev.resizable:
freeSize = dev.size - dev.minSize
resizeString = _("%(freeSize)s of %(devSize)s") \
- % {"freeSize": size_str(freeSize), "devSize": size_str(dev.size)}
+ % {"freeSize": size_str(int(freeSize)), "devSize": size_str(int(dev.size))}
if not dev.protected:
canShrinkSomething = True
else:
@@ -166,7 +167,7 @@ class ResizeDialog(GUIObject):
not dev.protected,
False,
self._get_tooltip(dev),
- dev.size,
+ int(dev.size),
dev.name])
diskReclaimableSpace += freeSize
@@ -183,13 +184,13 @@ class ResizeDialog(GUIObject):
False,
True,
self._get_tooltip(disk),
- float(converted),
+ int(converted),
""])
self._initialFreeSpace += diskFree
# And then go back and fill in the total reclaimable space for the
# disk, now that we know what each partition has reclaimable.
- self._diskStore[itr][RECLAIMABLE_COL] = self._diskStore[itr][RECLAIMABLE_COL] % size_str(diskReclaimableSpace)
+ self._diskStore[itr][RECLAIMABLE_COL] = self._diskStore[itr][RECLAIMABLE_COL] % size_str(int(diskReclaimableSpace))
totalDisks += 1
totalReclaimableSpace += diskReclaimableSpace
@@ -227,27 +228,27 @@ class ResizeDialog(GUIObject):
will not have a slider displayed, so they do not need to be worried
with here.
"""
- self._resizeSlider.set_range(device.minSize, device.size)
+ self._resizeSlider.set_range(int(ceil(device.minSize)), int(device.size))
self._resizeSlider.set_value(value)
# The slider needs to be keyboard-accessible. We'll make small movements change in
# 1% increments, and large movements in 5% increments.
- distance = device.size - device.minSize
+ distance = int(device.size) - int(ceil(device.minSize))
onePercent = distance*0.01
fivePercent = distance*0.05
twentyPercent = distance*0.2
adjustment = self.builder.get_object("resizeAdjustment")
- adjustment.configure(value, device.minSize, device.size, onePercent, fivePercent, 0)
+ adjustment.configure(value, int(ceil(device.minSize)), int(device.size), onePercent, fivePercent, 0)
# And then the slider needs a couple tick marks for easier navigation.
self._resizeSlider.clear_marks()
for i in range(1, 5):
- self._resizeSlider.add_mark(device.minSize + i*twentyPercent, Gtk.PositionType.BOTTOM, None)
+ self._resizeSlider.add_mark(int(ceil(device.minSize)) + i*twentyPercent, Gtk.PositionType.BOTTOM, None)
# Finally, add tick marks for the ends.
- self._resizeSlider.add_mark(device.minSize, Gtk.PositionType.BOTTOM, size_str(device.minSize))
- self._resizeSlider.add_mark(device.size, Gtk.PositionType.BOTTOM, size_str(device.size))
+ self._resizeSlider.add_mark(int(ceil(device.minSize)), Gtk.PositionType.BOTTOM, size_str(int(ceil(device.minSize))))
+ self._resizeSlider.add_mark(int(device.size), Gtk.PositionType.BOTTOM, size_str(int(device.size)))
def _update_action_buttons(self, row):
obj = PartStoreRow(*row)
@@ -323,9 +324,9 @@ class ResizeDialog(GUIObject):
if obj.action == _(PRESERVE):
return False
if obj.action == _(SHRINK):
- self._selectedReclaimableSpace += device.size - obj.target
+ self._selectedReclaimableSpace += int(device.size) - obj.target
elif obj.action == _(DELETE):
- self._selectedReclaimableSpace += device.size
+ self._selectedReclaimableSpace += int(device.size)
return False
@@ -451,14 +452,14 @@ class ResizeDialog(GUIObject):
def on_resize_value_changed(self, rng):
(model, itr) = self._selection.get_selected()
- old_delta = rng.get_adjustment().get_upper()-model[itr][RESIZE_TARGET_COL]
+ old_delta = int(rng.get_adjustment().get_upper())- model[itr][RESIZE_TARGET_COL]
self._selectedReclaimableSpace -= old_delta
# Update the target size in the store.
- model[itr][RESIZE_TARGET_COL] = rng.get_value()
+ model[itr][RESIZE_TARGET_COL] = int(rng.get_value())
# Update the "Total selected space" label.
- delta = rng.get_adjustment().get_upper()-rng.get_value()
+ delta = int(rng.get_adjustment().get_upper()) - int(rng.get_value())
self._selectedReclaimableSpace += delta
self._update_labels(selectedReclaimable=self._selectedReclaimableSpace)
--
1.8.5.3
10 years, 3 months
[PATCH master/rhel7-branch] Fix kickstart 'updates' command (#1056727)
by Will Woods
If parse-kickstart sees an 'updates' command it emits 'live.updates=..."
argument, which is handled by the 'livenet' module, not anaconda.
So as foretold by the TODO comment, we also need to call the livenet
cmdline parser here to set things up for downloading updates.
---
dracut/anaconda-lib.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dracut/anaconda-lib.sh b/dracut/anaconda-lib.sh
index 2b17b6b..d635393 100755
--- a/dracut/anaconda-lib.sh
+++ b/dracut/anaconda-lib.sh
@@ -205,7 +205,8 @@ run_kickstart() {
# re-parse new cmdline stuff from the kickstart
. $hookdir/cmdline/*parse-anaconda-repo.sh
- # TODO: parse for other stuff ks might set (updates, dd, etc.)
+ . $hookdir/cmdline/*parse-livenet.sh
+ # TODO: parse for other stuff ks might set (dd? other stuff?)
case "$repotype" in
http*|ftp|nfs*) do_net=1 ;;
cdrom|hd|bd) do_disk=1 ;;
--
1.8.5.3
10 years, 3 months
[PATCH] provide a more useful error message if user fails to create an ESP
by Adam Williamson
If you do a UEFI native installation, use custom partitioning, and fail to
mount an EFI system partition at /boot/efi, blivet's __init__.py attempt to
set a stage1 device will fail completely and return our old friend, the
completely oblique error message "you have not created a bootloader stage1
target device". With this patch, when that test fails, if the arch is UEFI,
an additional error message is appended: "For a UEFI installation, your layout
must include an EFI system partition mounted at /boot/efi". It's always hard
to consider all possible paths to an error condition, but I don't _think_ it
would ever be incorrect to display this message when the attempt to set a
stage1 device fails during a UEFI installation, and usually it will be a
useful cue for the user.
---
blivet/__init__.py | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/blivet/__init__.py b/blivet/__init__.py
index 95b29a7..b77b728 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -1624,6 +1624,10 @@ class Blivet(object):
if not stage1:
errors.append(_("you have not created a bootloader stage1 "
"target device"))
+ if arch.isEfi():
+ errors.append(_("For a UEFI installation, your layout must "
+ "include an EFI system partition mounted at "
+ "/boot/efi"))
else:
self.bootloader.is_valid_stage1_device(stage1)
errors.extend(self.bootloader.errors)
--
1.8.5.3
10 years, 3 months
[blivet rhel7/master] escrow: make sure the output directory exists (#1026653)
by Will Woods
writeEscrowPackets() gets called from turnOnFilesystems() immediately
after it mounts all the filesystems. So under normal circumstances, when
we run writeEscrowPackets() the ROOT_PATH is completely empty.
So when we do device.format.escrow(ROOT_PATH + "/root",...) that path
doesn't exist yet, and so it ends up raising IOError when it tries to
open a file there.
The simple solution is to ensure the path exists before we pass it to
device.format.escrow().
(This won't interfere with the installer; when RPM tries to create
/root in the course of installing the "filesystem" package it should
happily just chmod the existing directory to the proper mode and leave
the contents as-is.)
---
blivet/__init__.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/blivet/__init__.py b/blivet/__init__.py
index 95b29a7..b05e73d 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -201,11 +201,15 @@ def writeEscrowPackets(storage):
nss.nss.nss_init_nodb() # Does nothing if NSS is already initialized
backupPassphrase = generateBackupPassphrase()
+
try:
+ escrowDir = ROOT_PATH + "/root"
+ log.debug("escrow: writing escrow packets to %s", escrowDir)
+ util.makedirs(escrowDir)
for device in escrowDevices:
log.debug("escrow: device %s: %s" %
(repr(device.path), repr(device.format.type)))
- device.format.escrow(ROOT_PATH + "/root",
+ device.format.escrow(escrowDir,
backupPassphrase)
except (IOError, RuntimeError) as e:
--
1.8.5.3
10 years, 3 months
[master] Fix thread errors reporting
by Vratislav Podzimek
With the PATCH 1/2 applied, the PATCH 2/2 shouldn't be necessary, but still it
doesn't hurt to do the check.
Vratislav Podzimek (2):
Do not add errors item for thread in advance
Fix listing threads that caused an error
pyanaconda/threads.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--
1.8.5.3
10 years, 3 months
[master/rhel7-branch] Show hidden disk images (#1034996)
by Brian C. Lane
When doing image installs we need to be able to un-hide the image.
Otherwise it goes away and you have to restart anaconda.
Resolves: rhbz#1034996
---
pyanaconda/ui/lib/disks.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/ui/lib/disks.py b/pyanaconda/ui/lib/disks.py
index ddeaa41..faecd8e 100644
--- a/pyanaconda/ui/lib/disks.py
+++ b/pyanaconda/ui/lib/disks.py
@@ -49,7 +49,11 @@ class FakeDisk(object):
def getDisks(devicetree, fake=False):
if not fake:
devices = devicetree.devices
- if not flags.imageInstall:
+ if flags.imageInstall:
+ hidden_images = [d for d in devicetree._hidden \
+ if d.name in devicetree.diskImages]
+ devices += hidden_images
+ else:
devices += devicetree._hidden
disks = [d for d in devices if d.isDisk and
--
1.8.4.2
10 years, 3 months