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

Use 'os.uname().machine' to get machine architecture instead of 'uname -i' #5322

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyanaconda/modules/payloads/payload/dnf/installation.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def run(self):

# Get substitutions for variables.
# TODO: replace the interpolation with DNF once possible
basearch = util.execWithCapture("uname", ["-i"]).strip().replace("'", "")
basearch = os.uname().machine
releasever = util.get_os_release_value("VERSION_ID", sysroot=self._sysroot) or ""

# Import GPG keys to RPM database.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,11 +196,12 @@ def test_import_keys(self, mock_exec):
call("rpm", ["--import", key_2], root=sysroot),
])

@patch("pyanaconda.modules.payloads.payload.dnf.installation.os.uname")
@patch("pyanaconda.modules.payloads.payload.dnf.installation.util")
def test_import_substitution(self, mock_util):
def test_import_substitution(self, mock_util, mock_uname):
"""Import GPG keys with variables."""
mock_util.execWithRedirect.return_value = 0
mock_util.execWithCapture.return_value = "s390x"
mock_uname.return_value = Mock(machine='s390x')
mock_util.get_os_release_value.return_value = "34"

key = "/etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch"
Expand Down
Loading