Skip to content

Commit

Permalink
Use 'os.uname().machine' to get machine architecture instead of 'unam…
Browse files Browse the repository at this point in the history
…e -i'

uname -i returns unknown.

Resolves: rhbz#2248930
  • Loading branch information
KKoukiou committed Nov 17, 2023
1 parent bed2e8b commit 4141fb3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
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")
@patch("pyanaconda.modules.payloads.payload.dnf.installation.util")
def test_import_substitution(self, mock_util):
def test_import_substitution(self, mock_util, mock_os):
"""Import GPG keys with variables."""
mock_util.execWithRedirect.return_value = 0
mock_util.execWithCapture.return_value = "s390x"
mock_os.uname().machine.return_value = "s390x"
mock_util.get_os_release_value.return_value = "34"

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

0 comments on commit 4141fb3

Please sign in to comment.