Skip to content

Commit

Permalink
Provide distro specific url for help with system-upgrade (RhBug:1747408)
Browse files Browse the repository at this point in the history
Os-release will provide the new key with url with help for
system-upgrade.

https://bugzilla.redhat.com/show_bug.cgi?id=1747408
  • Loading branch information
j-mracek committed Oct 7, 2019
1 parent fc17dc4 commit 4a24c2b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions plugins/system_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,20 @@ def reboot():
Popen(["systemctl", "reboot"])


def get_url_from_os_release():
key = "UPGRADE_GUIDE_URL="
for path in ["/etc/os-release", "/usr/lib/os-release"]:
try:
with open(path) as release_file:
for line in release_file:
line = line.strip()
if line.startswith(key):
return line[len(key):].strip('"')
except IOError:
continue
return None


# DNF-FIXME: dnf.util.clear_dir() doesn't delete regular files :/
def clear_dir(path):
if not os.path.isdir(path):
Expand Down Expand Up @@ -381,6 +395,10 @@ def pre_configure_clean(self):
# == configure_*: set up action-specific demands ==========================

def configure_download(self):
help_url = get_url_from_os_release()
if help_url:
msg = _('Additional information for System Upgrade: {}')
logger.info(msg.format(help_url))
if self.base._promptWanted():
msg = _('Before you continue ensure that your system is fully upgraded by running '
'"dnf --refresh upgrade". Do you want to continue')
Expand Down

0 comments on commit 4a24c2b

Please sign in to comment.