Bug 1491253

Summary: [RFE] - /usr/share/ovirt-log-collector/analyzer/inventory-profile has hardcoded /tmp
Product: [oVirt] ovirt-log-collector Reporter: Jiri Belka <jbelka>
Component: GeneralAssignee: Douglas Schilling Landgraf <dougsland>
Status: CLOSED CURRENTRELEASE QA Contact: David Necpal <dnecpal>
Severity: medium Docs Contact:
Priority: low    
Version: 4.1.4CC: bugs, lsvaty, lveyde, ylavi
Target Milestone: ovirt-4.2.2Keywords: FutureFeature
Target Release: 4.2.3Flags: rule-engine: ovirt-4.2?
dnecpal: testing_plan_complete-
rule-engine: planning_ack?
sbonazzo: devel_ack+
lsvaty: testing_ack+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: ovirt-log-collector-4.2.3 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-03-29 11:00:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: Integration RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1456888    

Description Jiri Belka 2017-09-13 11:58:42 UTC
Description of problem:

analyzer should fully accept TMPDIR env var.

# grep mktemp /usr/bin/ovirt-log-collector-analyzer 
WORK_DIR="$(mktemp -d)"

this works fine and mktemp accepts TMPDIR env var.

but...

# grep -IR /tmp /usr/share/ovirt-log-collector/analyzer
/usr/share/ovirt-log-collector/analyzer/inventory-profile:HOSTS_SOSREPORT_EXTRACTED_DIR="/tmp/ovirt-log-collector-analyzer-hosts"

proposition:

# grep WORK_DIR /usr/share/ovirt-log-collector/analyzer/inventory-profile
HOSTS_SOSREPORT_EXTRACTED_DIR="${WORK_DIR}/ovirt-log-collector-analyzer-hosts"

# grep -n ^export /usr/bin/ovirt-log-collector-analyzer 
17:export WORK_DIR

Version-Release number of selected component (if applicable):
ovirt-log-collector-analyzer-4.1.5-1.el7ev.noarch

How reproducible:
100%

Steps to Reproduce:
1. run analyzer with TMP=foo env var
2.
3.

Actual results:
analyzer does not use only temporary dir defined but tries to use /tmp as it
is hardcoded

Expected results:
be smarter

Additional info:

Comment 1 Sandro Bonazzola 2018-01-31 10:23:30 UTC
Missed 4.2.1, moving to 4.2.2

Comment 2 David Necpal 2018-02-27 18:01:56 UTC
Verified on version ovirt-log-collector-analyzer-4.2.4-3.el7ev.noarch

-bash-4.2$ export TMPDIR="/tmp/test" && ovirt-log-collector-analyzer sosreport-LogCollector-20180227171353.tar.xz
Preparing environment:
======================
Temporary working directory is /tmp/test/tmp.boG91Qizvt
Unpacking postgres data. This can take up to several minutes.
sos-report extracted into: /tmp/test/tmp.boG91Qizvt/unpacked_sosreport
pgdump extracted into: /tmp/test/tmp.boG91Qizvt/pg_dump_dir
Welcome to unpackHostsSosReports script!
Extracting sosreport from hypervisor ...........

Creating a temporary database in /tmp/test/tmp.boG91Qizvt/postgresDb/pgdata. Log of initdb is in /tmp/test/tmp.boG91Qizvt/initdb.log

........

Importing the dump into a temporary database. Log of the restore process is in /tmp/test/tmp.boG91Qizvt/db-restore.log

Generating reports:
===================
Generated analyzer_report.html

Cleaning up:
============
Stopping temporary database
Removing temporary directory /tmp/test/tmp.boG91Qizvt

Comment 3 Sandro Bonazzola 2018-03-29 11:00:30 UTC
This bugzilla is included in oVirt 4.2.2 release, published on March 28th 2018.

Since the problem described in this bug report should be
resolved in oVirt 4.2.2 release, it has been closed with a resolution of CURRENT RELEASE.

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