Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix umask setting fixture #15478

Merged
merged 1 commit into from
Jun 21, 2024
Merged

Fix umask setting fixture #15478

merged 1 commit into from
Jun 21, 2024

Conversation

vsedmik
Copy link
Contributor

@vsedmik vsedmik commented Jun 21, 2024

Problem Statement

Default umask settings defined in /etc/bashrc (used for non-login shell, which is what robottelo use for target_sat.execute(...)) is different in RHEL8 and RHEL9.

In RHEL8 we can find:

    if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then
       umask 002
    else
       umask 022
    fi

while in RHEL9:

    # Set default umask for non-login shell only if it is set to 0
    [ `umask` -eq 0 ] && umask 022

That [ ] test is important there, since it prevents umask setting if it's non-zero already (yes it is) and thus blocks the fixture to set it more restrictively with sed (as used before) when running against RHEL9 based Satellite.

Solution

Override it no matter what previous code is and return it back on tear-down.

PRT test Cases example

trigger: test-robottelo
pytest: tests/foreman/cli/test_satellitesync.py -k with_permissions

@vsedmik vsedmik added CherryPick PR needs CherryPick to previous branches 6.15.z Introduced in or relating directly to Satellite 6.15 labels Jun 21, 2024
@vsedmik vsedmik self-assigned this Jun 21, 2024
@vsedmik vsedmik requested a review from a team as a code owner June 21, 2024 15:55
@vsedmik
Copy link
Contributor Author

vsedmik commented Jun 21, 2024

trigger: test-robottelo
pytest: tests/foreman/cli/test_satellitesync.py -k with_permissions

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 7471
Build Status: SUCCESS
PRT Comment: pytest tests/foreman/cli/test_satellitesync.py -k with_permissions --external-logging
Test Result : ========== 1 passed, 33 deselected, 42 warnings in 787.93s (0:13:07) ===========

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Jun 21, 2024
Copy link
Contributor

@damoore044 damoore044 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice fix!

@damoore044 damoore044 merged commit fba99dc into SatelliteQE:master Jun 21, 2024
11 checks passed
github-actions bot pushed a commit that referenced this pull request Jun 21, 2024
(cherry picked from commit fba99dc)
vsedmik added a commit that referenced this pull request Jun 21, 2024
Fix umask setting fixture (#15478)

(cherry picked from commit fba99dc)

Co-authored-by: vsedmik <[email protected]>
jyejare pushed a commit to jyejare/robottelo that referenced this pull request Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.15.z Introduced in or relating directly to Satellite 6.15 CherryPick PR needs CherryPick to previous branches PRT-Passed Indicates that latest PRT run is passed for the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants