[rhel7-branch 1/1] NTP should have better behavior (#1309396)
by dashea
From: Jiri Konecny <jkonecny(a)redhat.com>
Fix when the ntp servers were in KS then chrony package was
installed only with GUI but not in TUI.
Change a behavior of NTP package chrony installation and
config file creation:
1) When --nontp is in KS file then don't install ntp package and don't
create config file.
2) When "-chrony" is in packages section of KS then don't
install package but create the config files based on the config file
from the installation environment.
3) If nothing used and there are ntp servers then create config file and
install chrony package.
The "--nontp" option beats the "-chrony" packages rule.
Based on commit db800dc1bcb62cb8f811adae09a5b07c4f71ea5f but in RHEL
there is ntpd too. Which is handled as before this patch so we creating
the configuration files for ntp if ntp package is installed and --nontp
is not used.
Resolves: rhbz#1309396
Resolves: rhbz#1260725
---
pyanaconda/install.py | 3 ++
pyanaconda/kickstart.py | 47 +++++++++++++++++++-----------
pyanaconda/ui/gui/spokes/datetime_spoke.py | 1 -
3 files changed, 33 insertions(+), 18 deletions(-)
diff --git a/pyanaconda/install.py b/pyanaconda/install.py
index 4bab410..388a2a2 100644
--- a/pyanaconda/install.py
+++ b/pyanaconda/install.py
@@ -204,6 +204,9 @@ def doInstall(storage, payload, ksdata, instClass):
# Check for additional packages
ksdata.authconfig.setup()
ksdata.firewall.setup()
+ # Setup timezone and add chrony as package if timezone was set in KS
+ # and "-chrony" wasn't in packages section and/or --nontp wasn't set.
+ ksdata.timezone.setup(ksdata)
# anaconda requires storage packages in order to make sure the target
# system is bootable and configurable, and some other packages in order
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index e3f956a..f9d2e97 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -1610,7 +1610,8 @@ def __init__(self, *args):
self._disabled_chrony = False
def setup(self, ksdata):
- if self.nontp:
+ # do not install and use NTP package
+ if self.nontp or NTP_PACKAGE in ksdata.packages.excludedList:
if iutil.service_running(NTP_SERVICE) and \
can_touch_runtime_system("stop NTP service"):
ret = iutil.stop_service(NTP_SERVICE)
@@ -1630,7 +1631,7 @@ def setup(self, ksdata):
if NTP_SERVICE not in ksdata.services.disabled:
ksdata.services.disabled.append(NTP_SERVICE)
self._disabled_chrony = True
-
+ # install and use NTP package
else:
if not iutil.service_running(NTP_SERVICE) and \
can_touch_runtime_system("start NTP service"):
@@ -1662,23 +1663,35 @@ def execute(self, *args):
timezone.write_timezone_config(self, iutil.getSysroot())
# write out NTP configuration (if set)
- if self.ntpservers:
+ if not self.nontp and self.ntpservers:
chronyd_out_path = os.path.normpath(iutil.getSysroot() + ntp.CHRONY_CONFIG_FILE)
ntpd_out_path = os.path.normpath(iutil.getSysroot() + ntp.NTP_CONFIG_FILE)
- try:
- ntp.save_servers_to_config(self.ntpservers,
- conf_file_path=ntp.CHRONY_CONFIG_FILE,
- out_file_path=chronyd_out_path)
- except ntp.NTPconfigError as ntperr:
- log.warning("Failed to save NTP configuration for chrony: %s", ntperr)
-
- try:
- ntp.save_servers_to_config(self.ntpservers,
- conf_file_path=ntp.NTP_CONFIG_FILE,
- out_file_path=ntpd_out_path)
- except ntp.NTPconfigError as ntperr:
- log.warning("Failed to save NTP configuration for ntpd: %s", ntperr)
-
+ if os.path.exists(chronyd_out_path):
+ log.debug("Modifying installed chrony configuration")
+ try:
+ ntp.save_servers_to_config(self.ntpservers, conf_file_path=chronyd_out_path)
+ except ntp.NTPconfigError as ntperr:
+ log.warning("Failed to save NTP configuration for chrony: %s", ntperr)
+ else:
+ log.debug("Creating chrony configuration based on the "
+ "configuration from installation environment")
+ try:
+ ntp.save_servers_to_config(self.ntpservers,
+ conf_file_path=ntp.CHRONY_CONFIG_FILE,
+ out_file_path=chronyd_out_path)
+ except ntp.NTPconfigError as ntperr:
+ log.warning("Failed to save NTP configuration without chrony package: %s", ntperr)
+
+ if os.path.exists(ntpd_out_path):
+ log.debug("Modifying installed ntpd configuration")
+ try:
+ ntp.save_servers_to_config(self.ntpservers, conf_file_path=ntpd_out_path)
+ except ntp.NTPconfigError as ntperr:
+ log.warning("Failed to save NTP configuration for ntpd: %s", ntperr)
+ # This is special customer request when the ntp is installed so there is no point
+ # in creating conf file from NTP from installation environment.
+ else:
+ log.debug("ntpd configuration isn't created because the package wasn't installed")
class User(commands.user.F19_User):
def execute(self, storage, ksdata, instClass, users):
diff --git a/pyanaconda/ui/gui/spokes/datetime_spoke.py b/pyanaconda/ui/gui/spokes/datetime_spoke.py
index fd5c8d1..521b809 100644
--- a/pyanaconda/ui/gui/spokes/datetime_spoke.py
+++ b/pyanaconda/ui/gui/spokes/datetime_spoke.py
@@ -554,7 +554,6 @@ def execute(self):
if self._update_datetime_timer_id is not None:
GLib.source_remove(self._update_datetime_timer_id)
self._update_datetime_timer_id = None
- self.data.timezone.setup(self.data)
@property
def ready(self):
--
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/976a4a843b5005011516cf8bde...
8 years, 3 months
New: [rhinstaller/anaconda/pulls/526 rhel7-branch] NTP should have
better behavior (#1309396)
by dashea
Fix when the ntp servers were in KS then chrony package was
installed only with GUI but not in TUI.
Change a behavior of NTP package chrony installation and
config file creation:
1) When --nontp is in KS file then don't install ntp package and don't
create config file.
2) When "-chrony" is in packages section of KS then don't
install package but create the config files based on the config file
from the installation environment.
3) If nothing used and there are ntp servers then create config file and
install chrony package.
The "--nontp" option beats the "-chrony" packages rule.
Based on commit db800dc1bcb62cb8f811adae09a5b07c4f71ea5f but in RHEL
there is ntpd too. Which is handled as before this patch so we creating
the configuration files for ntp if ntp package is installed and --nontp
is not used.
Resolves: rhbz#1309396
Resolves: rhbz#1260725
*Based on PR https://github.com/rhinstaller/anaconda/pull/517 which is already in master now*
--
To view this pull request on github, visit https://github.com/rhinstaller/anaconda/pull/526
8 years, 3 months
[master/f24/rhel7-branch] Show some confirmation to users if adding a DASD was successful. (#1259016)
by Samantha N. Bueno
Since DASDs show up under local storage, it wasn't immediately obvious if
they were successfully added via the manual add dialog, since it just closed
out to the storage spoke. Now update the dialog with a message that the disk
was successfully added and that it'll show up under local storage, so there
can be no confusion.
Resolves: rhbz#1259016
---
pyanaconda/ui/gui/spokes/advstorage/dasd.glade | 67 ++++++++++++++++++++++++++
pyanaconda/ui/gui/spokes/advstorage/dasd.py | 8 +--
pyanaconda/ui/gui/spokes/filter.py | 6 ++-
3 files changed, 76 insertions(+), 5 deletions(-)
diff --git a/pyanaconda/ui/gui/spokes/advstorage/dasd.glade b/pyanaconda/ui/gui/spokes/advstorage/dasd.glade
index 048c59f..8038dba 100644
--- a/pyanaconda/ui/gui/spokes/advstorage/dasd.glade
+++ b/pyanaconda/ui/gui/spokes/advstorage/dasd.glade
@@ -298,6 +298,73 @@
<child type="tab">
<placeholder/>
</child>
+ <child>
+ <object class="GtkGrid" id="successBox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="halign">center</property>
+ <property name="row_spacing">5</property>
+ <property name="column_spacing">6</property>
+ <child>
+ <object class="GtkImage" id="successImage">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">1</property>
+ <property name="icon_name">dialog-ok</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="successLabel">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Device discovery succeeded.</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="successInfo">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">The added DASD can be found under "Local Standard Disks".</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="left_attach">0</property>
diff --git a/pyanaconda/ui/gui/spokes/advstorage/dasd.py b/pyanaconda/ui/gui/spokes/advstorage/dasd.py
index ec2d476..3cabc59 100644
--- a/pyanaconda/ui/gui/spokes/advstorage/dasd.py
+++ b/pyanaconda/ui/gui/spokes/advstorage/dasd.py
@@ -113,10 +113,10 @@ class DASDDialog(GUIObject):
self._discoveryError = None
self._conditionNotebook.set_current_page(2)
else:
- # Great success. Just return to the advanced storage window and let the
- # UI update with the newly-added device
- self.window.response(1)
- return True
+ # Great success. Since DASDs go under local disks, update dialog to
+ # show users that's where they'll be
+ self._conditionNotebook.set_current_page(3)
+ self._okButton.set_sensitive(True)
self._cancelButton.set_sensitive(True)
return False
diff --git a/pyanaconda/ui/gui/spokes/filter.py b/pyanaconda/ui/gui/spokes/filter.py
index 76b0601..53e4556 100644
--- a/pyanaconda/ui/gui/spokes/filter.py
+++ b/pyanaconda/ui/gui/spokes/filter.py
@@ -683,7 +683,11 @@ class FilterSpoke(NormalSpoke):
with self.main_window.enlightbox(dialog.window):
dialog.refresh()
- dialog.run()
+ rc = dialog.run()
+
+ if rc == 1:
+ self.skipTo = "StorageSpoke"
+ self.on_back_clicked(rc)
# We now need to refresh so any new disks picked up by adding advanced
# storage are displayed in the UI.
--
2.4.3
8 years, 3 months