Bug 1395890

Summary: rhncfg-manager diff output uses "---" to prefix both files in diff, one should be "+++"
Product: Red Hat Satellite 5 Reporter: Jan Hutař <jhutar>
Component: ClientAssignee: Tomáš Kašpárek <tkasparek>
Status: CLOSED CURRENTRELEASE QA Contact: Lukáš Hellebrandt <lhellebr>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 580CC: eherget, galtukho, jhutar, lhellebr, tlestach
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1358484 Environment:
Last Closed: 2017-06-21 12:15:46 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: 1358484    
Bug Blocks: 1397178    

Description Jan Hutař 2016-11-16 21:19:39 UTC
We have tested (or attempted to test) bug like this when Spacewalk 2.6 was to be released. This is a clone of that bug to get it re-tested on Satellite 5.8.0. In some cases bug can be completely irrelevant (in such cases I suggest to close the bug as NOTABUG), in some cases it might be wise to take the bug as a note that something changed in a given area and we might want to sanity-test that area (and mark the bug as VERIFIED with "SanityOnly" keyword) and in some cases bug might be totally relevant to Satellite.



+++ This bug was initially created as a clone of Bug #1358484 +++

Description of problem:
While working on providing sane output when diff'ing binary configuration files, I notice that the diff output for rhncfg-manager uses "---" to prefix both the source and destination files.  It should be prefixing the second file with "+++".

Version-Release number of selected component (if applicable):
rhncfg-management-5.10.93-1.fc23.noarch

How reproducible:
easily

Steps to Reproduce:
1. Have a client system subscribed to a configuration channel
2. Have one text configuration file being managed that differs on the client
3. Run the command `rhncfg-manager diff <configfile> -c <configchannel>`

Actual results:
diff output looks like this...
--- /tmp/hosts  2016-07-19 14:57:20     attributes: -rw-r--r-- [line truncated]
--- /tmp/hosts  2016-07-20 15:16:48     attributes: -rw-r--r-- [line truncated]
[rest of output truncated]

Expected results:
--- /tmp/hosts  2016-07-19 14:57:20     attributes: -rw-r--r-- [line truncated]
+++ /tmp/hosts  2016-07-20 15:16:48     attributes: -rw-r--r-- [line truncated]
[rest of output truncated]


Additional info:

--- Additional comment from Eric Herget on 2016-07-29 09:14:48 EDT ---

spacewalk.github:
aaecc727439e8077baf08294d6ce744b09e0b6e1

--- Additional comment from Jan Hutař on 2016-11-10 16:45:14 EST ---

Note that during testing this I have filed bug 1394045.

I have tested on both SWnightly@OracleXE10@RHEL6 and SWnightly@PostgreSQL@RHEL7 (rhncfg-management-5.10.98-1.el7.noarch).

1. Create config channel and file in it with something in it
2. Subscribe system to it and enable deploy actions on it:
   # rhn-actions-control --enable-all
3. Schedule deploy of all files on the system in webUI and make sure it happens:
   # rhn_check -vv
4. Alter deployed file:
   # date > /tmp/bz1358484
5. Run diff:
   # rhncfg-manager diff /tmp/bz1358484 -c bz1358484

Output is now correctly showing "+++" for second file:

# rhncfg-manager diff /tmp/bz1358484 -c bz1358484
Using server name <fqdn>
--- /tmp/bz1358484	2016-11-10 22:29:50.843000+01:00	attributes: -rw-r--r-- root root 	config channel: bz1358484	revision: 1
+++ /tmp/bz1358484	2016-11-10 22:33:09	attributes: -rw-r--r-- root root unconfined_u:object_r:user_tmp_t:s0	config channel: local file	revision: None
[...]

=> VERIFIED

Comment 1 Lukáš Hellebrandt 2017-05-23 12:49:45 UTC
Verified with rhncfg-5.10.87-10.

Used reproducer from OP.

The second (older, currently on the client) file is now prefixed with +s.