Skip to content

Commit

Permalink
Merge pull request #5322 from KKoukiou/fix-rpms-keys-arch
Browse files Browse the repository at this point in the history
 Use 'os.uname().machine' to get machine architecture instead of 'uname -i'
  • Loading branch information
KKoukiou authored Nov 20, 2023
2 parents 71b76dd + 26a6ecd commit 97983a6
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.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

0 comments on commit 97983a6

Please sign in to comment.