Skip to content

Commit

Permalink
Add missing aarch64 to rpm package architectures (#405)
Browse files Browse the repository at this point in the history
Required to prevent false negative results on using pkg.installed
with architecture specification in package name (ex. `bash.aarch64`)
  • Loading branch information
vzhestkov authored and meaksh committed Sep 21, 2021
1 parent 50026ab commit e5abf2e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion salt/utils/pkg/rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"alphaev68",
"alphaev7",
)
ARCHES_ARM = ("armv5tel", "armv5tejl", "armv6l", "armv7l")
ARCHES_ARM = ("armv5tel", "armv5tejl", "armv6l", "armv7l", "aarch64")
ARCHES_SH = ("sh3", "sh4", "sh4a")

ARCHES = (
Expand Down
34 changes: 34 additions & 0 deletions tests/unit/modules/test_zypperpkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -2475,3 +2475,37 @@ def test_del_repo_key(self):
with patch.dict(zypper.__salt__, salt_mock):
self.assertTrue(zypper.del_repo_key(keyid="keyid", root="/mnt"))
salt_mock["lowpkg.remove_gpg_key"].assert_called_once_with("keyid", "/mnt")

def test_services_need_restart(self):
"""
Test that zypper ps is used correctly to list services that need to
be restarted.
"""
expected = ["salt-minion", "firewalld"]
zypper_output = "salt-minion\nfirewalld"
zypper_mock = Mock()
zypper_mock(root=None).nolock.call = Mock(return_value=zypper_output)

with patch("salt.modules.zypperpkg.__zypper__", zypper_mock):
assert zypper.services_need_restart() == expected
zypper_mock(root=None).nolock.call.assert_called_with("ps", "-sss")

def test_normalize_name(self):
"""
Test that package is normalized only when it should be
"""
with patch.dict(zypper.__grains__, {"osarch": "x86_64"}):
result = zypper.normalize_name("foo")
assert result == "foo", result
result = zypper.normalize_name("foo.x86_64")
assert result == "foo", result
result = zypper.normalize_name("foo.noarch")
assert result == "foo", result

with patch.dict(zypper.__grains__, {"osarch": "aarch64"}):
result = zypper.normalize_name("foo")
assert result == "foo", result
result = zypper.normalize_name("foo.aarch64")
assert result == "foo", result
result = zypper.normalize_name("foo.noarch")
assert result == "foo", result

0 comments on commit e5abf2e

Please sign in to comment.