Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1670228

Summary: [RFE] foreman-maintain should have a switch for plain text output
Product: Red Hat Satellite Reporter: Gary Scarborough <gscarbor>
Component: Satellite MaintainAssignee: Ian Ballou <iballou>
Status: CLOSED ERRATA QA Contact: Vladimír Sedmík <vsedmik>
Severity: low Docs Contact:
Priority: medium    
Version: 6.4CC: apatel, aupadhye, bkearney, iballou, inecas, jbreitwe, jesper.schmidt, jpathan, jsherril, kgaikwad, mbacovsk, msunil, mvanderw, ofalk, osousa, patalber, pcfe, peter.vreman, riehecky
Target Milestone: 6.10.0Keywords: FutureFeature, Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: rubygem-foreman_maintain-0.8.6 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-16 13:48:05 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1122832    

Description Gary Scarborough 2019-01-29 00:09:33 UTC
Description of problem:

Foreman-Maintain backup should have a flag to set the output to plain text so that it can be redirected to a log.  Currently the output is formatted with non text characters.  Redirecting it to a file results in a lot of garbage in the file.


Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. foreman-maintain backup offline -y -s backupfile >> log.txt

2. Check log.txt, see non text characters
3.

Actual results:

Lots of non text characters in the log file


Expected results:

An option for plain text output.
Additional info:

Comment 4 Martin Bacovsky 2019-01-30 12:06:29 UTC
Created redmine issue https://projects.theforeman.org/issues/25943 from this bug

Comment 5 Peter Vreman 2019-07-25 11:53:35 UTC
The normal use case for backup is to run from cron and redirect the output to a log file.

Why did Sat6 Engineering has chosen for a script that runs 4+ hours to make output adhoc human users only?

Comment 6 Bryan Kearney 2020-05-17 20:01:28 UTC
Upstream bug assigned to apatel

Comment 7 Bryan Kearney 2020-05-28 08:01:31 UTC
Upstream bug assigned to apatel

Comment 8 Bryan Kearney 2020-05-28 08:01:34 UTC
Upstream bug assigned to apatel

Comment 9 Suraj Patil 2020-06-10 08:50:09 UTC
*** Bug 1705936 has been marked as a duplicate of this bug. ***

Comment 10 Peter Vreman 2020-08-04 13:17:01 UTC
I had a hard time to analyze using the standard linux text file tools the sat6 backups logs because they are huge, unreadable, slow to browse (e.g. scroll up in less)

Based on the existing PR https://github.com/theforeman/foreman_maintain/pull/346 made the quick hack below to disable the spinner and writing duplicate lines to the log.
Tested on Sat6.7.1&6.7.2

--------------
--- /usr/share/gems/gems/foreman_maintain-0.5.4/lib/foreman_maintain/reporter/cli_reporter.rb
+++ /usr/share/gems/gems/foreman_maintain-0.5.4/lib/foreman_maintain/reporter/cli_reporter.rb
@@ -56,14 +56,15 @@
         def spin
           @mutex.synchronize do
             return unless @active
-            print_current_line
-            @spinner_index = (@spinner_index + 1) % @spinner_chars.size
+#            print_current_line
+#            @spinner_index = (@spinner_index + 1) % @spinner_chars.size
           end
         end

         def print_current_line
           @reporter.clear_line
-          line = "#{@spinner_chars[@spinner_index]} #{@current_line}"
+#          line = "#{@spinner_chars[@spinner_index]} #{@current_line}"
+          line = @current_line
           @reporter.print(line)
         end
       end
@@ -160,7 +161,7 @@
       end

       def clear_line
-        print "\r" + ' ' * @max_length + "\r"
+        @new_line_next_time = true
       end

       def assumeyes?
-------------------

Hope this helps to improve the PR.

Peter

Comment 14 Justin Sherrill 2021-06-21 12:54:05 UTC
Yes, we are going to work on this for a 6.9.z release

Comment 16 Bryan Kearney 2021-07-08 20:05:26 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/25943 has been resolved.

Comment 17 Peter Vreman 2021-07-13 12:35:26 UTC
Confirming that the PR with --plaintext works and gives a log file friendly output

Comment 18 Amit Upadhye 2021-07-29 10:45:30 UTC
*** Bug 1932435 has been marked as a duplicate of this bug. ***

Comment 19 Vladimír Sedmík 2021-07-29 16:57:16 UTC
Verified on 6.10.0 snap 10 with rubygem-foreman_maintain-0.8.7-1.el7sat.noarch:
foreman-maintain now provides the `--plaintext` option for the backup, restore, health and upgrade subcommands, which omits the spinner and colors from the command output.

Comment 22 errata-xmlrpc 2021-11-16 13:48:05 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Satellite 6.10 Satellite Maintenance Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:4697