Bug 1972771

Summary: foreman-rake rh_cloud_inventory:report:generate fails with Permission denied
Product: Red Hat Satellite Reporter: James Jeffers <jjeffers>
Component: RH Cloud - InventoryAssignee: Shimon Shtein <sshtein>
Status: CLOSED ERRATA QA Contact: Jameer Pathan <jpathan>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.9.0CC: ahumbe, aruzicka, egolov, jjeffers, ktordeur
Target Milestone: 6.10.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-foreman_rh_cloud-4.0.22 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1957129 Environment:
Last Closed: 2021-11-16 14:11:58 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Comment 1 Jameer Pathan 2021-07-02 12:34:31 UTC
Verified:

Verified with:
- Satellite 6.10.0 snap 7
- tfm-rubygem-foreman_rh_cloud-4.0.22-1.el7sat.noarch

Test steps:
- Run "foreman-rake rh_cloud_inventory:report:generate organization_id=1 --trace"

Observation:
- archive/report generated successfully.
- rh_cloud_inventory:report:generate foreman-rake command uses /tmp directory for writing reports to.

[root@dhcp-2-51 ~]# foreman-rake rh_cloud_inventory:report:generate organization_id=1 --trace
`/usr/share/foreman` is not writable.
Bundler will use `/tmp/bundler20210702-27882-16kiszk27882' as your home directory temporarily.
'ErbParser' is ignored.
'RubyParser' is ignored.
** Invoke rh_cloud_inventory:report:generate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute rh_cloud_inventory:report:generate
/usr/share/foreman is not writable by the current process
Using /tmp/d20210702-27882-l0z9kq for the output
Must specify either portal_user or organization_id
I, [2021-07-02T07:33:32.522777 #27882]  INFO -- : Started generating hosts report in /tmp/d20210702-27882-1s6c7vd
I, [2021-07-02T07:33:32.584718 #27882]  INFO -- : Adding slice 40be92c8-8edc-4292-af41-742482ebb461
I, [2021-07-02T07:33:34.430796 #27882]  INFO -- : slice 40be92c8-8edc-4292-af41-742482ebb461 was created with 2 hosts
I, [2021-07-02T07:33:34.430964 #27882]  INFO -- : Report generation finished
I, [2021-07-02T07:33:34.431017 #27882]  INFO -- : Archiving generated report
I, [2021-07-02T07:33:34.457596 #27882]  INFO -- : tar: ./
./metadata.json
./40be92c8-8edc-4292-af41-742482ebb461.json

I, [2021-07-02T07:33:34.457919 #27882]  INFO -- : Report archived successfully
Successfully generated /tmp/d20210702-27882-l0z9kq/report_for_1.tar.xz for organization id 1
[root@dhcp-2-51 ~]# ll /tmp/d20210702-27882-l0z9kq/report_for_1.tar.xz
-rw-r--r--. 1 foreman foreman 5808 Jul  2 07:33 /tmp/d20210702-27882-l0z9kq/report_for_1.tar.xz

Comment 4 errata-xmlrpc 2021-11-16 14:11:58 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 (Moderate: Satellite 6.10 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/RHSA-2021:4702