-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RHELC-1761] Format messages for consistency #1438
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,8 +69,8 @@ def run(self): | |
self.add_message( | ||
level="WARNING", | ||
id="INSTALL_HOST_METERING_FAILURE", | ||
title="Failed to install host metering package.", | ||
description="When installing host metering package an error occurred meaning we can't" | ||
title="Failed to install the host-metering package", | ||
description="When installing the host-metering package an error occurred meaning we can't" | ||
" enable host metering on the system.", | ||
diagnosis="`yum install host-metering` command returned {ret_install} with message {output}".format( | ||
ret_install=ret_install, output=output | ||
|
@@ -89,9 +89,9 @@ def run(self): | |
self.add_message( | ||
level="WARNING", | ||
id="CONFIGURE_HOST_METERING_FAILURE", | ||
title="Failed to enable and start host metering service.", | ||
title="Failed to enable and start the host metering service", | ||
description="The host metering service failed to start" | ||
" successfully and won't be able to keep track.", | ||
" successfully and won't be able to report on the use of the system for the billing purposes.", | ||
diagnosis="Command {command} failed with {error_message}".format( | ||
command=command, error_message=error_message | ||
), | ||
|
@@ -109,7 +109,7 @@ def run(self): | |
self.set_result( | ||
level="ERROR", | ||
id="HOST_METERING_NOT_RUNNING", | ||
title="Host metering service is not running.", | ||
title="Host metering service is not running", | ||
description="host-metering.service is not running.", | ||
remediations="You can try to start the service manually" | ||
" by running following command:\n" | ||
|
@@ -126,7 +126,7 @@ def _check_host_metering_configuration(self): | |
:rtype: bool | ||
""" | ||
if tool_opts.configure_host_metering is None: | ||
logger.debug("You have not enabled configuration of host metering. Skipping it.") | ||
logger.info("You have not enabled configuration of host metering. Skipping it.") | ||
return False | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dots seems to be removed by accident? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what you're referring to exactly here. In the line above I changed the debug log level to info because without the --debug option users wouldn't see this message that is more than just of debugging nature. No dots removed. |
||
|
||
if tool_opts.configure_host_metering not in ("force", "auto"): | ||
|
@@ -152,19 +152,22 @@ def _check_host_metering_configuration(self): | |
if tool_opts.configure_host_metering == "force": | ||
logger.warning( | ||
"You've set the host metering setting to 'force'." | ||
" Please note that this option is mainly used for testing and will configure host-metering unconditionally. " | ||
" For generic usage please use the 'auto' option." | ||
" Note that this option is mainly used for testing and will configure host-metering unconditionally. " | ||
" For generic usage use the 'auto' option." | ||
) | ||
self.add_message( | ||
level="WARNING", | ||
id="FORCED_CONFIGURE_HOST_METERING", | ||
title="Configuration of host metering set to 'force'", | ||
description="Please note that this option is mainly used for testing and" | ||
description="Note that this option is mainly used for testing and" | ||
" will configure host-metering unconditionally." | ||
" For generic usage please use the 'auto' option.", | ||
" For generic usage use the 'auto' option.", | ||
) | ||
elif tool_opts.configure_host_metering == "auto": | ||
logger.debug("Automatic detection of host hyperscaler and configuration.") | ||
logger.debug( | ||
"Configuration of host metering set to 'auto' - host-metering will be enabled based on" | ||
" a detected hyperscaler." | ||
) | ||
|
||
return True | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,7 @@ def run(self): | |
self.add_message( | ||
level="INFO", | ||
id="SKIPPED_MODIFIED_RPM_FILES_DIFF", | ||
title="Skipped comparison of 'rpm -Va' output from before and after the conversion.", | ||
title="Skipped comparison of 'rpm -Va' output from before and after the conversion", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dot removed here as well There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is intentional. It's one of the goals of the PR - to remove full stops from message titles for consistency. Most titles didn't have it, so I opted for removing them from all. The message titles are printed this way:
In Insights they are displayed in this fashion: In both cases (CLI, Insights) it's more suitable to have the titles without full stops. |
||
description="Comparison of 'rpm -Va' output was not performed due to missing output " | ||
"of the 'rpm -Va' run before the conversion.", | ||
diagnosis="This is caused mainly by using '--no-rpm-va' argument for convert2rhel.", | ||
|
@@ -76,8 +76,8 @@ def run(self): | |
self.add_message( | ||
level="INFO", | ||
id="FOUND_MODIFIED_RPM_FILES", | ||
title="Modified rpm files from before and after the conversion were found.", | ||
description="Comparison of modified rpm files from before and after " "the conversion: \n{}".format( | ||
title="Modified rpm files from before and after the conversion were found", | ||
description="Comparison of modified rpm files from before and after the conversion: \n{}".format( | ||
modified_rpm_files_diff | ||
), | ||
) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,8 +51,8 @@ class BackupRedhatRelease(actions.Action): | |
id = "BACKUP_REDHAT_RELEASE" | ||
|
||
def run(self): | ||
"""Backup redhat release file before starting conversion process""" | ||
logger.task("Backup Redhat Release Files") | ||
"""Back up redhat release file before starting conversion process""" | ||
logger.task("Back up redhat-release files") | ||
|
||
Comment on lines
+54
to
56
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would say Backup instead of back up. What is the Red Hat preferred word? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Backup is a noun, back up is a verb. |
||
super(BackupRedhatRelease, self).run() | ||
|
||
|
@@ -79,7 +79,7 @@ class BackupRepository(actions.Action): | |
|
||
def run(self): | ||
"""Backup .repo files in /etc/yum.repos.d/ so the repositories can be restored on rollback.""" | ||
logger.task("Backup Repository Files") | ||
logger.task("Back up repository files") | ||
|
||
super(BackupRepository, self).run() | ||
|
||
|
@@ -105,7 +105,7 @@ class BackupYumVariables(actions.Action): | |
|
||
def run(self): | ||
"""Backup varsdir folder in /etc/{yum,dnf}/vars so the variables can be restored on rollback.""" | ||
logger.task("Backup variables") | ||
logger.task("Back up variables") | ||
|
||
super(BackupYumVariables, self).run() | ||
|
||
|
@@ -146,7 +146,7 @@ def run(self): | |
"""Backup changed package files""" | ||
super(BackupPackageFiles, self).run() | ||
|
||
logger.task("Backup package files") | ||
logger.task("Back up package files") | ||
|
||
package_files_changes = self._get_changed_package_files() | ||
|
||
|
@@ -178,7 +178,6 @@ def _get_changed_package_files(self): | |
"""Get the output from rpm -Va command from during resolving system info | ||
to get changes made to package files. | ||
|
||
|
||
:return dict: Return them as a list of dict, for example: | ||
[{"status":"S5T", "file_type":"c", "path":"/etc/yum.repos.d/CentOS-Linux-AppStream.repo"}] | ||
""" | ||
|
@@ -199,10 +198,9 @@ def _get_changed_package_files(self): | |
# Return empty list results in no backup of the files | ||
return data | ||
else: | ||
# The file should be there | ||
# If missing conversion is in unknown state | ||
# The file should be there. If missing, the conversion is in an unknown state. | ||
logger.warning("Error({}): {}".format(err.errno, err.strerror)) | ||
logger.critical("Missing file {rpm_va_output} in it's location".format(rpm_va_output=path)) | ||
logger.critical("The file {rpm_va_output} is missing.".format(rpm_va_output=path)) | ||
|
||
lines = output.strip().split("\n") | ||
for line in lines: | ||
|
@@ -220,7 +218,7 @@ def _parse_line(self, line): | |
if not match: # line not matching the regex | ||
if line.strip() != "": | ||
# Line is not empty string | ||
logger.debug("Skipping invalid output {}".format(line)) | ||
logger.debug("Skipping invalid output: {}".format(line)) | ||
return {"status": None, "file_type": None, "path": None} | ||
|
||
line = line.split() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will be unique as most don't have a dot in them, but definitely more valid with a dot than without. Just an FYI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most info messages had a full stop. For consistency I've added the full stop to all of them (and to other levels such as debug or critical as well).