mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
Added deprication warning, changelog and test
This commit is contained in:
parent
7d35c4600b
commit
f1bdd57db6
5 changed files with 41 additions and 1 deletions
1
changelog/62053.fixed
Normal file
1
changelog/62053.fixed
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Fixed the humanname being ignored in pkgrepo.managed on openSUSE Leap
|
|
@ -1249,7 +1249,7 @@ def mod_repo(repo, **kwargs):
|
||||||
but do not remove if disabled.
|
but do not remove if disabled.
|
||||||
|
|
||||||
name
|
name
|
||||||
This is used as the name value in the repo file.
|
This is used as the descriptive name value in the repo file.
|
||||||
|
|
||||||
refresh
|
refresh
|
||||||
Enable or disable (True or False) auto-refresh of the repository.
|
Enable or disable (True or False) auto-refresh of the repository.
|
||||||
|
@ -1365,6 +1365,14 @@ def mod_repo(repo, **kwargs):
|
||||||
if "priority" in kwargs:
|
if "priority" in kwargs:
|
||||||
cmd_opt.append("--priority={}".format(kwargs.get("priority", DEFAULT_PRIORITY)))
|
cmd_opt.append("--priority={}".format(kwargs.get("priority", DEFAULT_PRIORITY)))
|
||||||
|
|
||||||
|
if "humanname" in kwargs:
|
||||||
|
salt.utils.versions.warn_until(
|
||||||
|
3009,
|
||||||
|
"Passing 'humanname' to 'mod_repo' is deprecated, slated "
|
||||||
|
"for removal in {version}. Please use 'name' instead."
|
||||||
|
)
|
||||||
|
cmd_opt.append("--name='{}'".format(kwargs.get("humanname")))
|
||||||
|
|
||||||
if "name" in kwargs:
|
if "name" in kwargs:
|
||||||
cmd_opt.append("--name")
|
cmd_opt.append("--name")
|
||||||
cmd_opt.append(kwargs.get("name"))
|
cmd_opt.append(kwargs.get("name"))
|
||||||
|
|
|
@ -71,6 +71,7 @@ class ZypperTestCase(TestCase, LoaderModuleMockMixin):
|
||||||
"enabled": False,
|
"enabled": False,
|
||||||
"baseurl": self.new_repo_config["url"],
|
"baseurl": self.new_repo_config["url"],
|
||||||
"alias": self.new_repo_config["name"],
|
"alias": self.new_repo_config["name"],
|
||||||
|
"name": self.new_repo_config["name"],
|
||||||
"priority": 1,
|
"priority": 1,
|
||||||
"type": "rpm-md",
|
"type": "rpm-md",
|
||||||
}
|
}
|
||||||
|
@ -1377,10 +1378,37 @@ class ZypperTestCase(TestCase, LoaderModuleMockMixin):
|
||||||
self.assertEqual(type(r_info["enabled"]), bool)
|
self.assertEqual(type(r_info["enabled"]), bool)
|
||||||
self.assertEqual(type(r_info["autorefresh"]), bool)
|
self.assertEqual(type(r_info["autorefresh"]), bool)
|
||||||
self.assertEqual(type(r_info["baseurl"]), str)
|
self.assertEqual(type(r_info["baseurl"]), str)
|
||||||
|
self.assertEqual(type(r_info["name"]), str)
|
||||||
self.assertEqual(r_info["type"], None)
|
self.assertEqual(r_info["type"], None)
|
||||||
self.assertEqual(r_info["enabled"], alias == "SLE12-SP1-x86_64-Update")
|
self.assertEqual(r_info["enabled"], alias == "SLE12-SP1-x86_64-Update")
|
||||||
self.assertEqual(r_info["autorefresh"], alias == "SLE12-SP1-x86_64-Update")
|
self.assertEqual(r_info["autorefresh"], alias == "SLE12-SP1-x86_64-Update")
|
||||||
|
|
||||||
|
def test_repo_add_mod_name(self):
|
||||||
|
"""
|
||||||
|
Test mod_repo adds the new repo and call modify to update descriptive
|
||||||
|
name.
|
||||||
|
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
url = self.new_repo_config["url"]
|
||||||
|
name = self.new_repo_config["name"]
|
||||||
|
desc_name = "Update Repository"
|
||||||
|
zypper_patcher = patch.multiple(
|
||||||
|
"salt.modules.zypperpkg", **self.zypper_patcher_config
|
||||||
|
)
|
||||||
|
|
||||||
|
with zypper_patcher:
|
||||||
|
zypper.mod_repo(
|
||||||
|
name, **{"url": url, "name": desc_name}
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
zypper.__zypper__(root=None).xml.call.call_args_list,
|
||||||
|
[call("ar", url, name)],
|
||||||
|
)
|
||||||
|
zypper.__zypper__(root=None).refreshable.xml.call.assert_called_once_with(
|
||||||
|
"mr", "--name", desc_name, name
|
||||||
|
)
|
||||||
|
|
||||||
def test_repo_add_nomod_noref(self):
|
def test_repo_add_nomod_noref(self):
|
||||||
"""
|
"""
|
||||||
Test mod_repo adds the new repo and nothing else
|
Test mod_repo adds the new repo and nothing else
|
||||||
|
@ -1451,6 +1479,7 @@ class ZypperTestCase(TestCase, LoaderModuleMockMixin):
|
||||||
zypper.mod_repo(name, **params)
|
zypper.mod_repo(name, **params)
|
||||||
expected_params = {
|
expected_params = {
|
||||||
"alias": "mock-repo-name",
|
"alias": "mock-repo-name",
|
||||||
|
"name": "mock-repo-name",
|
||||||
"autorefresh": True,
|
"autorefresh": True,
|
||||||
"baseurl": "http://repo.url/some/path-changed",
|
"baseurl": "http://repo.url/some/path-changed",
|
||||||
"enabled": False,
|
"enabled": False,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
[SLE12-SP1-x86_64-Update]
|
[SLE12-SP1-x86_64-Update]
|
||||||
|
name=Update Repository
|
||||||
enabled=1
|
enabled=1
|
||||||
autorefresh=1
|
autorefresh=1
|
||||||
baseurl=http://somehost.com/SUSE/Updates/SLE-SERVER/12-SP1/x86_64/update/
|
baseurl=http://somehost.com/SUSE/Updates/SLE-SERVER/12-SP1/x86_64/update/
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
[SLE12-SP1-x86_64-Update-disabled]
|
[SLE12-SP1-x86_64-Update-disabled]
|
||||||
|
name=Update Repository
|
||||||
enabled=0
|
enabled=0
|
||||||
autorefresh=0
|
autorefresh=0
|
||||||
baseurl=http://somehost.com/SUSE/Updates/SLE-SERVER/12-SP1/x86_64/update/
|
baseurl=http://somehost.com/SUSE/Updates/SLE-SERVER/12-SP1/x86_64/update/
|
||||||
|
|
Loading…
Add table
Reference in a new issue