Bug 1194638

Summary: no patched log created when user does not have permission to apply patch
Product: [JBoss] JBoss Operations Network Reporter: Armine Hovsepyan <ahovsepy>
Component: InstallerAssignee: Michael Burman <miburman>
Status: CLOSED ERRATA QA Contact: Armine Hovsepyan <ahovsepy>
Severity: medium Docs Contact:
Priority: unspecified    
Version: JON 3.3.1CC: fbrychta, mfoley, miburman
Target Milestone: ER01Keywords: Triaged
Target Release: JON 3.3.3   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-30 16:41:32 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:
Attachments:
Description Flags
3.3.0_3.3.1_apply_patch_no_permission
none
apply_patch_no_permissions.log none

Description Armine Hovsepyan 2015-02-20 12:41:22 UTC
Created attachment 993890 [details]
3.3.0_3.3.1_apply_patch_no_permission

Description of problem:
no patched log created when user does not have permission to apply patch

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

How reproducible:
always

Steps to Reproduce:
1. install jon 3.3.0 as root
2. apply patch as non-root 
3.

Actual results:

The following log is visible >100 lines:

./jon-server-3.3.0.GA-update-01/apply-updates.sh: line 140: /home/hudson/jon-server-3.3.0.GA/.patched/3.3.0.GA-update-$date/update.log: No such file or directory

The following log is printed:
Missing write permissions for existing JON installation files, see '/home/hudson/jon-server-3.3.0.GA/.patched/3.3.0.GA-update-$date/update.log' for more details.

No update log is created

Expected results:
no misleading log is create

Additional info:
result log attached

Comment 1 Michael Burman 2015-06-29 10:52:53 UTC
The new output without permissions:

[miburman@miranda jon-server-3.3.0.GA-update-02]$ cp ~/projects/git/jon/patches/apply-updates.sh . | sed -i -e 's/UPDATE_VERSION=\"03\"/UPDATE_VERSION=\"02\"/' apply-updates.sh && ./apply-updates.sh ../jon-server-3.3.0.GA

Testing for INSTALL_PATCH_DEST[JON Server|JON agent] directory.
	Successfully detected server [../jon-server-3.3.0.GA] to be upgraded. Proceeding...
	Proceeding with application of patch '02' to ../jon-server-3.3.0.GA
	Checking [Server] file permissions...
mkdir: cannot create directory ‘../jon-server-3.3.0.GA/.patched’: Permission denied
	Missing write permissions for existing JON installation files.
	Unable to apply update. Exiting...
[miburman@miranda jon-server-3.3.0.GA-update-02]$

Or do we want to remove the mkdir error also?

Comment 2 Michael Burman 2015-06-29 11:24:06 UTC
Pushed to release/jon3.3.x:

commit d91ba5ed4f1f909835fa8ed792100dc7531afb81
Author: Michael Burman <yak>
Date:   Mon Jun 29 14:22:40 2015 +0300

    [BZ 1194638] Do not try to perform log appending if log file is not writeable

Comment 3 Simeon Pinder 2015-07-10 18:55:25 UTC
Available for test with 3.3.3 ER01 build: 
https://brewweb.devel.redhat.com/buildinfo?buildID=446732
 *Note: jon-server-patch-3.3.0.GA.zip maps to ER01 build of
 jon-server-3.3.0.GA-update-03.zip.

Comment 4 Armine Hovsepyan 2015-07-15 17:00:59 UTC
Created attachment 1052396 [details]
apply_patch_no_permissions.log

Comment 5 Armine Hovsepyan 2015-07-15 17:03:25 UTC
when user does not have permission to directory - apply patch log does not show no permissions - expected 
when user has permission to directory but does not have permission to update/write into jon server dir - permission log is visible - expected

see log attached

Comment 7 errata-xmlrpc 2015-07-30 16:41:32 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, 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://rhn.redhat.com/errata/RHSA-2015-1525.html