add app-admin/salt with python-3.11 compat

This commit is contained in:
Alexander Miroshnichenko 2023-06-08 08:27:35 +03:00
parent 7397049453
commit 60d7412b0b
Signed by: alex
GPG Key ID: E93720C6C73A77F4
24 changed files with 776 additions and 0 deletions

24
app-admin/salt/Manifest Normal file
View File

@ -0,0 +1,24 @@
AUX api-confd-1 179 BLAKE2B d014cadfb5dd99c85b1dee0e743f413fc5d6eb05629045bad5df108e6e96104b3b4f5e3736518baff5473c68d94906bb90cb7fe8167e136dd6603eb1087cc01c SHA512 de1d70050c2f911abb306c1b2253f2fdaac505a5ddd34937d7bef9dc9b876e9c6ed06e330a816fcafa38feaf67837235e78f2d97d149fef9fe20a29d945f8f22
AUX api-initd-5 540 BLAKE2B 11a4d14aaff3040484e9e704f68cc7562fe52694f7dc5eb6df0ab6cbac0cc4c4958c1f9cf13402a5f4f1c4361c93c44e71228a2f8f7f69b1c400a280c8934659 SHA512 81a0e3b01d95af5475f6fd12614134ca84c9d53b68648aba9b328947d6e92fae1889276d58cb3749e3e542f42dbda507d28531102549b4fc6c109e2f14146f8b
AUX master-confd-1 188 BLAKE2B 8ac416a7ff64c73556f07a08268ea7d91547e242becd345ac35da7b64f6b2e4aba276e8920e7353bd2caeaffa3034349496b00622191793994bbd4d25faa3c3c SHA512 c58fc025a3654b59f79c6e23fe135d75ebad8b166bc5214f4842c3dd92192e3598480f9fd6960ad2dc36d3ee45ff971650c5e0156353c1c045650f86c9a68db9
AUX master-initd-5 558 BLAKE2B 09a1485449b239b4f0d7e0514572084769c73b28053fc6ff9b4cbeb239358e7311784c15e883ddf5ca8310794e3d2bb851f2a765bb3aa17f8081ee008bfd130a SHA512 36b2d601d4dd3bd7b1758e77029b70916adbf8919c3ef04fd867ca25b143666d0c2f5834adddf05e7c2b013f04939f57e3396c888514e08f1679e6459a6ce7bb
AUX minion-confd-1 188 BLAKE2B ad20094c30f9aa573397d347f9fb11acafba2f724b6c836d7ec57f10d4182c300a4b0ec572b5f3301174febdfc69c30752c3b0eabdfdf9f4963b03531db23523 SHA512 0051e13351cef8db81dc075a194bb384723f07d5591b5b4d3f3adf4180afaf7beced470ab79ceca9d1ec0dae62dbd72084eb76af009fc78411a011050a94a2ed
AUX minion-initd-5 564 BLAKE2B 19f2d909b1a91b5cf22c932b04b794ef536c3a84fbd36676d4bf136c6af66ae4ea94abcf9657919cb4cf85ee88cc6e93df0e7373e0410823550cc45ebc8f5673 SHA512 c92165fe73157c9c3898f7c8c90e3b1626f704d4a8432237bd264463c66ba00e89a1d66e44b049703fd32ce48f771248b902e7183c4e31ee6611f938704b2583
AUX salt-3002-tests.patch 1125 BLAKE2B 345c094c38a1b62190587062a86da4e0a516988fb2bbf98c295da87f0abd456cfc8f25c11fe10a1c4571d4eb25390c6d89b0e300bd2ae6d82212d1685af8ed30 SHA512 7f9d6f8c4a5d34381c516c72d77de6613ed646fb88f89b7c4180afebb0bf0ee34a99ed02a7e8d7a6836a61c01653fe97a13c8caa18898a507a03091cff8e9d30
AUX salt-3003-gentoolkit-revdep.patch 514 BLAKE2B aff27558a2043970feeb3eda70cf8e9112b5545af40ba215c7859520ef95a9824001274e837929ef6c25f8e1c35a8ac73f1033e63336bcbaf48dbd4b54c2d42c SHA512 c8a4649ac241f219cf576b0896f48dffc0d5a273118713829c0ad34594f77cffceaa4f06a4d0f47a17b13d6e71b5787fc27f8ee97c774e53a6d15d1b282f99b3
AUX salt-3003-skip-tests-that-oom-machine.patch 732 BLAKE2B b9e10cf8d9ce7f36371fd30fcf592dce4933a05ca2d85c41b2159233272f2e7c90315fbd998c4064f3733b5b1944f9f96816418ed7eb434f3b9df324de2e859b SHA512 e7bc9c63d95a9af4e85372ca973c5023660c332b67486382ce898e7d60c3f50e2aca59e2634a2e87ab7fa8b34e45bfd3a781e04b8003108efbfcc67cd921aff4
AUX salt-3003.1-tests.patch 1151 BLAKE2B b2f0d99bf4bd90a7ea85ae5cc6abb91dd078ad8a95b062863a21573067f3df6045fe23ffd1b3f397e28b90b25126798253e8a9001509ad786cee3f318a900321 SHA512 9340a1dd343af45467be63b1f6991cd06fa57ffc187bcff4a96c75a9666a1429b98ce5b497354bc4cb975c0f6bcd9a64dbfb819b6bfdba02bb5917446d0a36fc
AUX salt-3005-relax-pyzmq-dep.patch 332 BLAKE2B d22d94b7680fb81e642b83cb7d823137e7e208b43a1720b131401fb957bcb3deb6a0fe5ca87da528cdf60ac219820d259d0b03a905e17142c9cd4d939b4bacf1 SHA512 7c5b963436c3066bf8e8f528acf04ea8ddfa2a5a19adb9486f9888346d55e56fdfcd97a4a04db18d85476cb8ecc8a350343855d765387744706e43e868464f5e
AUX salt-3005-tests.patch 4101 BLAKE2B 6a7d7dee4e631a7619bf1b7fa6bd08b93c0bf31342ce72f734bb645206604ffed9ae2ddae9cebe01401cbe100c224e97f18a69ede5f40a041158d1cd8878dc0f SHA512 cbc3b3d625ab8e20aa7b166dd6ddca1728c4bf562cc14d28fa684573c6ee1d42a270b0f029e5d978803a30103e7ad281d516afff66d18bf31308528fae79c00c
AUX salt-3005.1-importlib-metadata-5-r1.patch 1162 BLAKE2B cbc8df0043881725eb00a6e45ccc03e25f95a6260b4a4b42343c69a6bd8edcf0bb45312644a8e6a66b50a0c4ce0aad7be454b1b8d54a786851b33c7d4b143e10 SHA512 7d2f8c86f22b238dabda0727c338e2e8d33e06a36fcccf5b3b508ac610899f2d6416d7c9e285e992f0d76fc9d04c126640b2b84a227f9a82f4973cb472a4a14a
AUX salt-3005.1-modules-file-python-3.11-host.patch 4206 BLAKE2B 9cd3cb68b5c1a95475834ae917a2f6fbdbe3424c9f1e837a0e797b84e291e3530f86a2f7d2286e0070f433817ec06b2fd4d0a069b47acb1b0646653862337ece SHA512 4bc03979e1a4202d5ccb2b3159e178bc72c2a4be4297d7b9306479a5c7fe8cc81fc7d25474d80c2627e638db25e73cd4e8f7e1b25c8e15317e22986d63307823
AUX salt-3005.1-no-entry-points.patch 428 BLAKE2B 1bcf3b070afd01c56985290051a3cb031d5ca83b42631eba5f05d7648eabf13bca44573811b767d739dc9bc6d0a5da6f99de87b57c678df79cc172fa6dd5495f SHA512 ed5712689a6d39da9c6a67f28a48d35bbd271a6a3b898cbb0e0493e1813cc99e64388fb60707e6fee95691e339336c2656278780115b39d285c380ded92fe3cb
AUX salt-3005.1-tests.patch 2367 BLAKE2B 467af423de22b4ddeb80fef3d4682976283116698b7c2551c4710e049d8ad7749a4eb07c541a427ed540fdea6a0e4f4e63d96988bafd92974cc3b1026e27fd03 SHA512 4ba3c36be9de377848880819fc4bacf72978a12e483bea90a4e5e7524d7212b5d554302000f6c628156ec5aafbf48d662dec2764d96253be74fa202c73e7fc67
AUX salt-api.service 166 BLAKE2B 32d28ef4ef3c60942bed3fa3a01d70a9af387705844326cdf9339d7c887238a1e6817d78ffd1cb205a6397a2138c2389ea00bf53be84a17b23bea140279bf42c SHA512 bab6b8380c965bf16e23078ebe6f38d942300829d4c89ddf23b630bd57b4d371f80687d85dd9e0cc1b669f2ca882aecde1bc8d7d82382a02ed20e493d3f04702
AUX salt-master.service 169 BLAKE2B 15e7a4f64cfa75eb8d8576a7d0b61ea0c9937c94fd2130fd6c123a82187f08b5ed533c168a7310fd94d9bd2cecf9d0ba94665c653a971ef61e5e18ffdf087a15 SHA512 87fe27fc0748f4191bd1c6883bb362c95cce8fe1f409e2679b229ddfd9de6c99438859dfa0a47b042977d659029ef56e406f1e8aa01761bff21af4784f9dd5f8
AUX salt-minion.service 162 BLAKE2B 6f7b6b72e26d1651dbcb324b1e0cfef9f4b5a794f40566297c5bc469b351587db4d9805bed124774107efb64e6ed3e25fefa899b42a38064ee6fe26fd990ae58 SHA512 99f0a5c696e38b42b283416736a23e535ccc53095928b205914cf4b69c0df931a6752205985726527f7889b01dfece78466be28448458b15064edd04aca3e5ed
AUX salt-syndic.service 169 BLAKE2B 0d00f20b4663804eaa4b6a1a1b32ed87b04d1f4df6a8e8e0b2a0e3d17f71e1bb53f71f6168446aaf3765692cd540217c4cdf5ab8dd9cb7032801aa798d8a9bc3 SHA512 b45509a22a18f573726a868fda1591eaf42ef44220960dda698274ba8ff1db8cdc302605133ab61b188e15017ba15c5f409f3ee64e026b635ac359eea7aad7d0
AUX syndic-confd-1 188 BLAKE2B 98f13eb627963d65df26140f348c04eb8c253d444d36ecd1f5ef344ad89901b0a5ed62c64364e90595c2d2ee2766f30802a4a86a2555bbea343ab410292359af SHA512 35fe9bf4732c8a53b47099ffe5f9468d884ec3e2671451a6d52821dde6c70c63176b29ade0d700b99aaf47557f58179f780422843346bd3aa6513d9465ec9f58
AUX syndic-initd-5 558 BLAKE2B 5e1ea25b57f56ad7bfb8be0c845e7da9f99af03c50c31ca2031e604267c680555d0d8a3ef6299ec588770f26dad19d262c8b9403391b60fb17c6811d7946107a SHA512 6e927925cf1e4d0f901bec10499a8ecf1193b99742cfda5f94f70d0ec743902b1b89728cb2e447b8b4879a9417d0d482b813161968dc9c2b2c7944b3af14df14
DIST salt-3005.1.tar.gz 17914349 BLAKE2B 697c2068bf119e4a19f92a86ce880fec9375c10ba549cdcdd2182cfeaacce31c7bc4c4c91e1a609906b4c5373bb5e3120e0db47ede5b45ee20942d7b2d201e64 SHA512 391f995f0129f3d7104a0eea4fd83b18aa6ecae0fd7a2c77c1154e24b0bcd52cef4b63db12597c85737bb33ddf605e0c23370cef3bf47f9ea85af5b77d74dc50
EBUILD salt-3005.1-r1.ebuild 7226 BLAKE2B 46a302e03d89dd596ed4e617b8ff37b934669f4569c5bd431c7b8cbbf6cf7defd1839ebcbbb6376e3542899b93e87350427cd2336ab88ca70a6af60bf415fdb6 SHA512 762b081b18ff10c44bb7a6f0aec52e121da322838ef485204e3b7f09a24fc68ffe9e9b7effa0b4b8298f289c99a1a5f8adcac1b85840bb561e3e1d52ac29c466

View File

@ -0,0 +1,5 @@
# /etc/conf.d/salt-api: config file for /etc/init.d/salt-api
# see man pages for salt-minion or run `salt-api --help`
# for valid cmdline options
SALT_OPTS="--log-level=warning"

View File

@ -0,0 +1,19 @@
#!/sbin/openrc-run
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
command="/usr/bin/salt-api"
command_args="${SALT_OPTS}"
pidfile="/var/run/supervisor-salt-api.pid"
daemon_pidfile="/var/run/salt-api.pid"
command_args_background="--daemon --pid-file=\"${daemon_pidfile}\""
name="SALT API daemon"
retry="20"
supervisor=supervise-daemon
output_logger="logger -p daemon.info -t salt-api.stdout --"
error_logger="logger -p daemon.err -t salt-api.error --"
depend() {
use net logger
}

View File

@ -0,0 +1,5 @@
# /etc/conf.d/salt-master: config file for /etc/init.d/salt-master
# see man pages for salt-minion or run `salt-master --help`
# for valid cmdline options
SALT_OPTS="--log-level=warning"

View File

@ -0,0 +1,19 @@
#!/sbin/openrc-run
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
command="/usr/bin/salt-master"
command_args="${SALT_OPTS}"
pidfile="/var/run/supervisor-salt-master.pid"
daemon_pidfile="/var/run/salt-master.pid"
command_args_background="--daemon --pid-file=\"${daemon_pidfile}\""
name="SALT master daemon"
retry="20"
supervisor=supervise-daemon
output_logger="logger -p daemon.info -t salt-master.stdout --"
error_logger="logger -p daemon.err -t salt-master.error --"
depend() {
use net logger
}

View File

@ -0,0 +1,5 @@
# /etc/conf.d/salt-minion: config file for /etc/init.d/salt-minion
# see man pages for salt-minion or run `salt-minion --help`
# for valid cmdline options
SALT_OPTS="--log-level=warning"

View File

@ -0,0 +1,20 @@
#!/sbin/openrc-run
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
command="/usr/bin/salt-minion"
command_args="${SALT_OPTS}"
pidfile="/var/run/supervisor-salt-minion.pid"
daemon_pidfile="/var/run/salt-minion.pid"
command_args_background="--daemon --pid-file=\"${daemon_pidfile}\""
name="SALT minion daemon"
retry="20"
supervisor=supervise-daemon
output_logger="logger -p daemon.info -t salt-minion.stdout --"
error_logger="logger -p daemon.err -t salt-minion.error --"
depend() {
need net
use logger
}

View File

@ -0,0 +1,27 @@
diff --git a/tests/unit/utils/test_verify.py b/tests/unit/utils/test_verify.py
index 5662cf621b..16aa6d08da 100644
--- a/tests/unit/utils/test_verify.py
+++ b/tests/unit/utils/test_verify.py
@@ -329,6 +329,7 @@ class TestVerifyLog(TestCase):
self.assertTrue(os.path.exists(path))
+@skipIf(True, "skipping since temp dir is a symlink")
class TestCleanPath(TestCase):
"""
salt.utils.clean_path works as expected
@@ -394,12 +395,14 @@ class TestCleanPathLink(TestCase):
def tearDown(self):
shutil.rmtree(self.tmpdir)
+ @skipIf(True, "skipping since temp dir is a symlink")
def test_clean_path_symlinked_src(self):
test_path = os.path.join(self.from_path, "test")
expect_path = os.path.join(self.to_path, "test")
ret = clean_path(self.from_path, test_path)
assert ret == expect_path, "{} is not {}".format(ret, expect_path)
+ @skipIf(True, "skipping since temp dir is a symlink")
def test_clean_path_symlinked_tgt(self):
test_path = os.path.join(self.to_path, "test")
expect_path = os.path.join(self.to_path, "test")

View File

@ -0,0 +1,13 @@
diff --git a/salt/modules/gentoolkitmod.py b/salt/modules/gentoolkitmod.py
index cc78c37114..f0949d19a8 100644
--- a/salt/modules/gentoolkitmod.py
+++ b/salt/modules/gentoolkitmod.py
@@ -49,7 +49,7 @@ def revdep_rebuild(lib=None):
salt '*' gentoolkit.revdep_rebuild
"""
- cmd = "revdep-rebuild -i --quiet --no-progress"
+ cmd = "revdep-rebuild -i --quiet"
if lib is not None:
cmd += " --library={0}".format(lib)
return __salt__["cmd.retcode"](cmd, python_shell=False) == 0

View File

@ -0,0 +1,20 @@
diff --git a/tests/unit/modules/test_boto_apigateway.py b/tests/unit/modules/test_boto_apigateway.py
index 6ee6aeb002..db9aeaee95 100644
--- a/tests/unit/modules/test_boto_apigateway.py
+++ b/tests/unit/modules/test_boto_apigateway.py
@@ -154,6 +154,7 @@ def _has_required_botocore():
return True
+@skipIf(True, "Causes machines to OOM")
class BotoApiGatewayTestCaseBase(TestCase, LoaderModuleMockMixin):
conn = None
@@ -190,6 +191,7 @@ class BotoApiGatewayTestCaseBase(TestCase, LoaderModuleMockMixin):
self.addCleanup(delattr, self, "utils")
+@skipIf(True, "Causes machines to OOM")
class BotoApiGatewayTestCaseMixin:
def _diff_list_dicts(self, listdict1, listdict2, sortkey):
"""

View File

@ -0,0 +1,25 @@
diff --git a/tests/integration/files/file/base/_modules/runtests_helpers.py b/tests/integration/files/file/base/_modules/runtests_helpers.py
index 3ee0e2da5f..abf9b71431 100644
--- a/tests/integration/files/file/base/_modules/runtests_helpers.py
+++ b/tests/integration/files/file/base/_modules/runtests_helpers.py
@@ -27,7 +27,7 @@ except ImportError:
else "/tmp"
)
# This tempdir path is defined on tests.integration.__init__
- TMP = os.path.join(SYS_TMP_DIR, "salt-tests-tmpdir")
+ TMP = os.path.join(SYS_TMP_DIR, "salt-t")
class RUNTIME_VARS:
TMP = TMP
diff --git a/tests/unit/ext/test_ipaddress.py b/tests/unit/ext/test_ipaddress.py
index 4fd87d1c3f..43306ba8f4 100644
--- a/tests/unit/ext/test_ipaddress.py
+++ b/tests/unit/ext/test_ipaddress.py
@@ -137,6 +137,7 @@ class CommonTestMixin:
class CommonTestMixin_v4(CommonTestMixin):
+ @pytest.mark.skipif(sys.hexversion >= 0x03090000, reason="leading zeros disallowed in 3.9+")
def test_leading_zeros(self):
self.assertInstancesEqual("000.000.000.000", "0.0.0.0")
self.assertInstancesEqual("192.168.000.001", "192.168.0.1")

View File

@ -0,0 +1,12 @@
diff --git a/requirements/zeromq.txt b/requirements/zeromq.txt
index eb4d796418..ffa1589043 100644
--- a/requirements/zeromq.txt
+++ b/requirements/zeromq.txt
@@ -1,6 +1,4 @@
-r base.txt
-r crypto.txt
-pyzmq<=20.0.0 ; python_version < "3.6"
-pyzmq>=17.0.0 ; python_version < "3.9"
-pyzmq>19.0.2 ; python_version >= "3.9"
+pyzmq

View File

@ -0,0 +1,94 @@
diff --git a/tests/conftest.py b/tests/conftest.py
index 24ecf57e04..babc7ced90 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -684,8 +684,6 @@ def salt_factories_config():
"""
return {
"code_dir": str(CODE_DIR),
- "inject_coverage": MAYBE_RUN_COVERAGE,
- "inject_sitecustomize": MAYBE_RUN_COVERAGE,
"start_timeout": 120
if (os.environ.get("JENKINS_URL") or os.environ.get("CI"))
else 60,
diff --git a/tests/pytests/unit/_logging/handlers/test_deferred_stream_handler.py b/tests/pytests/unit/_logging/handlers/test_deferred_stream_handler.py
index 230da8abc8..f6f1a70ce4 100644
--- a/tests/pytests/unit/_logging/handlers/test_deferred_stream_handler.py
+++ b/tests/pytests/unit/_logging/handlers/test_deferred_stream_handler.py
@@ -62,6 +62,7 @@ def _deferred_write_on_flush_proc_target():
assert stds.stderr == "Foo\nBar\n"
+@pytest.mark.skip("doesn't work with sandbox")
def test_sync_with_handlers():
proc = multiprocessing.Process(target=_sync_with_handlers_proc_target)
proc.start()
@@ -69,6 +70,7 @@ def test_sync_with_handlers():
assert proc.exitcode == 0
+@pytest.mark.skip("doesn't work with sandbox")
def test_deferred_write_on_flush():
proc = multiprocessing.Process(target=_deferred_write_on_flush_proc_target)
proc.start()
diff --git a/tests/pytests/unit/modules/test_portage_config.py b/tests/pytests/unit/modules/test_portage_config.py
index 5cc6b90596..f344526909 100644
--- a/tests/pytests/unit/modules/test_portage_config.py
+++ b/tests/pytests/unit/modules/test_portage_config.py
@@ -53,7 +53,7 @@ def test_enforce_nice_config(tmp_path):
("use", ["apple", "-banana", "ananas", "orange"]),
]
- base_path = str(tmp_path / "/package.{0}")
+ base_path = str(f"{tmp_path}/package.{{0}}")
def make_line(atom, addition):
return atom + (" " + addition if addition != "" else "") + "\n"
@@ -72,14 +72,3 @@ def test_enforce_nice_config(tmp_path):
portage_config, "_merge_flags", lambda l1, l2, _: list(set(l1 + l2))
):
portage_config.enforce_nice_config()
-
- for typ, additions in supported:
- for atom, file_name in atoms:
- with salt.utils.files.fopen(
- base_path.format(typ) + "/" + file_name, "r"
- ) as fh:
- for line in fh:
- for atom in line:
- assert atom not in line
- for addition in additions:
- assert addition not in line
diff --git a/tests/support/cli_scripts.py b/tests/support/cli_scripts.py
index 270af75d4b..50c08f4ed2 100644
--- a/tests/support/cli_scripts.py
+++ b/tests/support/cli_scripts.py
@@ -32,8 +32,6 @@ def get_script_path(bin_dir, script_name):
bin_dir=bin_dir,
script_name=script_name,
code_dir=RUNTIME_VARS.CODE_DIR,
- inject_coverage="COVERAGE_PROCESS_START" in os.environ,
- inject_sitecustomize="COVERAGE_PROCESS_START" in os.environ,
)
log.info("Returning script path %r", script_path)
return script_path
diff --git a/tests/unit/utils/test_schema.py b/tests/unit/utils/test_schema.py
index 8c648f5288..ce5715a562 100644
--- a/tests/unit/utils/test_schema.py
+++ b/tests/unit/utils/test_schema.py
@@ -873,6 +873,7 @@ class ConfigTestCase(TestCase):
)
@skipIf(HAS_JSONSCHEMA is False, "The 'jsonschema' library is missing")
+ @skipIf(True, "Does not work with sandbox")
def test_hostname_config_validation(self):
class TestConf(schema.Schema):
item = schema.HostnameItem(title="Item", description="Item description")
@@ -2099,6 +2100,7 @@ class ConfigTestCase(TestCase):
self.assertEqual(item.serialize(), {"not": item.item.serialize()})
@skipIf(HAS_JSONSCHEMA is False, "The 'jsonschema' library is missing")
+ @skipIf(True, "Does not work with sandbox")
def test_not_config_validation(self):
class TestConf(schema.Schema):
item = schema.ArrayItem(

View File

@ -0,0 +1,29 @@
diff --git a/salt/utils/entrypoints.py b/salt/utils/entrypoints.py
index 3effa0b494..9452878ade 100644
--- a/salt/utils/entrypoints.py
+++ b/salt/utils/entrypoints.py
@@ -38,13 +38,20 @@ def iter_entry_points(group, name=None):
entry_points_listing = []
entry_points = importlib_metadata.entry_points()
- for entry_point_group, entry_points_list in entry_points.items():
- if entry_point_group != group:
- continue
- for entry_point in entry_points_list:
+ try:
+ for entry_point in entry_points.select(group=group):
if name is not None and entry_point.name != name:
continue
entry_points_listing.append(entry_point)
+ except AttributeError:
+ # importlib-metadata<5.0.0
+ for entry_point_group, entry_points_list in entry_points.items():
+ if entry_point_group != group:
+ continue
+ for entry_point in entry_points_list:
+ if name is not None and entry_point.name != name:
+ continue
+ entry_points_listing.append(entry_point)
return entry_points_listing

View File

@ -0,0 +1,123 @@
diff --git a/salt/modules/file.py b/salt/modules/file.py
index f39d618203..93eeaf312e 100644
--- a/salt/modules/file.py
+++ b/salt/modules/file.py
@@ -16,7 +16,6 @@ import hashlib
import itertools
import logging
import mmap
-import operator
import os
import re
import shutil
@@ -28,7 +27,6 @@ import time
import urllib.parse
from collections import namedtuple
from collections.abc import Iterable, Mapping
-from functools import reduce
import salt.utils.args
import salt.utils.atomicfile
@@ -1622,38 +1620,38 @@ def comment_line(path, regex, char="#", cmnt=True, backup=".bak"):
def _get_flags(flags):
"""
- Return an integer appropriate for use as a flag for the re module from a
- list of human-readable strings
+ Return the names of the Regex flags that correspond to flags
.. code-block:: python
- >>> _get_flags(['MULTILINE', 'IGNORECASE'])
- 10
+ >>> _get_flags(['IGNORECASE', 'MULTILINE'])
+ re.IGNORECASE|re.MULTILINE
>>> _get_flags('MULTILINE')
- 8
- >>> _get_flags(2)
- 2
+ re.MULTILINE
+ >>> _get_flags(8)
+ re.MULTILINE
+ >>> _get_flags(re.IGNORECASE)
+ re.IGNORECASE
"""
- if isinstance(flags, str):
+ if isinstance(flags, re.RegexFlag):
+ return flags
+ elif isinstance(flags, int):
+ return re.RegexFlag(flags)
+ elif isinstance(flags, str):
flags = [flags]
if isinstance(flags, Iterable) and not isinstance(flags, Mapping):
- _flags_acc = [0] # An initial 0 avoids resucing on empty list, an error
+ _flags = re.RegexFlag(0)
for flag in flags:
- _flag = getattr(re, str(flag).upper())
-
- if not isinstance(_flag, int):
- raise SaltInvocationError("Invalid re flag given: {}".format(flag))
-
- _flags_acc.append(_flag)
-
- return reduce(operator.__or__, _flags_acc)
- elif isinstance(flags, int):
- return flags
+ _flag = getattr(re.RegexFlag, str(flag).upper(), None)
+ if not _flag:
+ raise CommandExecutionError(f"Invalid re flag given: {flag}")
+ _flags |= _flag
+ return _flags
else:
- raise SaltInvocationError(
- 'Invalid re flags: "{}", must be given either as a single flag '
- "string, a list of strings, or as an integer".format(flags)
+ raise CommandExecutionError(
+ f'Invalid re flags: "{flags}", must be given either as a single flag '
+ "string, a list of strings, as an integer, or as an re flag"
)
@@ -2513,8 +2511,8 @@ def replace(
"Only one of append and prepend_if_not_found is permitted"
)
- flags_num = _get_flags(flags)
- cpattern = re.compile(salt.utils.stringutils.to_bytes(pattern), flags_num)
+ re_flags = _get_flags(flags)
+ cpattern = re.compile(salt.utils.stringutils.to_bytes(pattern), re_flags)
filesize = os.path.getsize(path)
if bufsize == "file":
bufsize = filesize
@@ -2582,7 +2580,7 @@ def replace(
"^{}($|(?=\r\n))".format(re.escape(content))
),
r_data,
- flags=flags_num,
+ flags=re_flags,
):
# Content was found, so set found.
found = True
@@ -3132,7 +3130,11 @@ def search(path, pattern, flags=8, bufsize=1, ignore_if_missing=False, multiline
salt '*' file.search /etc/crontab 'mymaintenance.sh'
"""
if multiline:
- flags = _add_flags(flags, "MULTILINE")
+ re_flags = _add_flags(flags, "MULTILINE")
+ else:
+ re_flags = _get_flags(flags)
+
+ if re.RegexFlag.MULTILINE in re_flags:
bufsize = "file"
# This function wraps file.replace on purpose in order to enforce
@@ -3142,7 +3144,7 @@ def search(path, pattern, flags=8, bufsize=1, ignore_if_missing=False, multiline
path,
pattern,
"",
- flags=flags,
+ flags=re_flags,
bufsize=bufsize,
dry_run=True,
search_only=True,

View File

@ -0,0 +1,13 @@
diff --git a/setup.py b/setup.py
index bd11ff95f7..3b83f7b6ff 100755
--- a/setup.py
+++ b/setup.py
@@ -1173,7 +1173,7 @@ class SaltDistribution(distutils.dist.Distribution):
return scripts
@property
- def _property_entry_points(self):
+ def _property_entry_points_disabled(self):
entrypoints = {
"pyinstaller40": [
"hook-dirs = salt.utils.pyinstaller:get_hook_dirs",

View File

@ -0,0 +1,40 @@
diff --git a/tests/unit/utils/test_schema.py b/tests/unit/utils/test_schema.py
index 8c648f5288..5886813e28 100644
--- a/tests/unit/utils/test_schema.py
+++ b/tests/unit/utils/test_schema.py
@@ -528,7 +528,7 @@ class ConfigTestCase(TestCase):
jsonschema.validate(
{"personal_access_token": "foo"}, Requirements.serialize()
)
- if JSONSCHEMA_VERSION >= _LooseVersion("3.0.0"):
+ if JSONSCHEMA_VERSION >= _LooseVersion("3.0.0") and JSONSCHEMA_VERSION < _LooseVersion("4.17.0"):
self.assertIn(
"'ssh_key_file' is a required property", excinfo.exception.message
)
@@ -1851,7 +1851,7 @@ class ConfigTestCase(TestCase):
jsonschema.validate(
{"item": {"sides": "4", "color": "blue"}}, TestConf.serialize()
)
- if JSONSCHEMA_VERSION >= _LooseVersion("3.0.0"):
+ if JSONSCHEMA_VERSION >= _LooseVersion("3.0.0") and JSONSCHEMA_VERSION < _LooseVersion("4.17.0"):
self.assertIn("'4'", excinfo.exception.message)
self.assertIn("is not of type", excinfo.exception.message)
self.assertIn("'boolean'", excinfo.exception.message)
@@ -1974,7 +1974,7 @@ class ConfigTestCase(TestCase):
with self.assertRaises(jsonschema.exceptions.ValidationError) as excinfo:
jsonschema.validate({"item": ["maybe"]}, TestConf.serialize())
- if JSONSCHEMA_VERSION >= _LooseVersion("3.0.0"):
+ if JSONSCHEMA_VERSION >= _LooseVersion("3.0.0") and JSONSCHEMA_VERSION < _LooseVersion("4.17.0"):
self.assertIn("'maybe'", excinfo.exception.message)
self.assertIn("is not one of", excinfo.exception.message)
self.assertIn("'yes'", excinfo.exception.message)
@@ -2036,7 +2036,7 @@ class ConfigTestCase(TestCase):
with self.assertRaises(jsonschema.exceptions.ValidationError) as excinfo:
jsonschema.validate({"item": ["maybe"]}, TestConf.serialize())
- if JSONSCHEMA_VERSION >= _LooseVersion("3.0.0"):
+ if JSONSCHEMA_VERSION >= _LooseVersion("3.0.0") and JSONSCHEMA_VERSION < _LooseVersion("4.17.0"):
self.assertIn("'maybe'", excinfo.exception.message)
self.assertIn("is not one of", excinfo.exception.message)
self.assertIn("'yes'", excinfo.exception.message)

View File

@ -0,0 +1,10 @@
[Unit]
Description=The Salt Master Server
After=syslog.target network.target
[Service]
Type=simple
ExecStart=/usr/bin/salt-api
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,10 @@
[Unit]
Description=The Salt Master Server
After=syslog.target network.target
[Service]
Type=simple
ExecStart=/usr/bin/salt-master
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,10 @@
[Unit]
Description=The Salt Minion
After=syslog.target network.target
[Service]
Type=simple
ExecStart=/usr/bin/salt-minion
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,10 @@
[Unit]
Description=The Salt Master Server
After=syslog.target network.target
[Service]
Type=simple
ExecStart=/usr/bin/salt-syndic
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,5 @@
# /etc/conf.d/salt-syndic: config file for /etc/init.d/salt-syndic
# see man pages for salt-minion or run `salt-syndic --help`
# for valid cmdline options
SALT_OPTS="--log-level=warning"

View File

@ -0,0 +1,19 @@
#!/sbin/openrc-run
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
command="/usr/bin/salt-syndic"
command_args="${SALT_OPTS}"
pidfile="/var/run/supervisor-salt-syndic.pid"
daemon_pidfile="/var/run/salt-syndic.pid"
command_args_background="--daemon --pid-file=\"${daemon_pidfile}\""
name="SALT syndic daemon"
retry="20"
supervisor=supervise-daemon
output_logger="logger -p daemon.info -t salt-syndic.stdout --"
error_logger="logger -p daemon.err -t salt-syndic.error --"
depend() {
use net logger
}

View File

@ -0,0 +1,219 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{10..11} )
DISTUTILS_USE_PEP517=setuptools
inherit systemd distutils-r1
DESCRIPTION="Salt is a remote execution and configuration manager"
HOMEPAGE="https://www.saltstack.com/resources/community/
https://github.com/saltstack"
if [[ ${PV} == 9999* ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/${PN}stack/${PN}.git"
EGIT_BRANCH="develop"
else
inherit pypi
KEYWORDS="amd64 ~arm ~arm64 ~riscv x86"
fi
LICENSE="Apache-2.0"
SLOT="0"
IUSE="
cheetah cherrypy ldap libcloud libvirt genshi gnupg keyring mako
mongodb neutron nova openssl portage profile redis selinux test raet
+zeromq vim-syntax
"
RDEPEND="
sys-apps/pciutils
>=dev-python/distro-1.5[${PYTHON_USEDEP}]
>=dev-python/jinja-3.0.3[${PYTHON_USEDEP}]
dev-python/jmespath[${PYTHON_USEDEP}]
dev-python/libnacl[${PYTHON_USEDEP}]
>=dev-python/msgpack-1.0.0[${PYTHON_USEDEP}]
>=dev-python/psutil-5.0.0[${PYTHON_USEDEP}]
>=dev-python/pycryptodome-3.9.8[${PYTHON_USEDEP}]
dev-python/pyyaml[${PYTHON_USEDEP}]
>=dev-python/markupsafe-2.0.1[${PYTHON_USEDEP}]
>=dev-python/requests-1.0.0[${PYTHON_USEDEP}]
dev-python/setuptools[${PYTHON_USEDEP}]
dev-python/tomli[${PYTHON_USEDEP}]
dev-python/watchdog[${PYTHON_USEDEP}]
libcloud? (
dev-python/aiohttp[${PYTHON_USEDEP}]
dev-python/aiosignal[${PYTHON_USEDEP}]
dev-python/async-timeout[${PYTHON_USEDEP}]
>=dev-python/libcloud-2.5.0[${PYTHON_USEDEP}]
)
mako? ( dev-python/mako[${PYTHON_USEDEP}] )
ldap? ( dev-python/python-ldap[${PYTHON_USEDEP}] )
libvirt? (
dev-python/libvirt-python[${PYTHON_USEDEP}]
)
openssl? (
dev-libs/openssl:0=[-bindist(-)]
dev-python/pyopenssl[${PYTHON_USEDEP}]
)
raet? (
>=dev-python/libnacl-1.0.0[${PYTHON_USEDEP}]
>=dev-python/ioflo-1.1.7[${PYTHON_USEDEP}]
>=dev-python/raet-0.6.0[${PYTHON_USEDEP}]
)
cherrypy? ( >=dev-python/cherrypy-3.2.2[${PYTHON_USEDEP}] )
cheetah? ( >=dev-python/cheetah3-3.2.2[${PYTHON_USEDEP}] )
genshi? ( dev-python/genshi[${PYTHON_USEDEP}] )
mongodb? ( dev-python/pymongo[${PYTHON_USEDEP}] )
portage? ( sys-apps/portage[${PYTHON_USEDEP}] )
keyring? ( dev-python/keyring[${PYTHON_USEDEP}] )
redis? ( dev-python/redis[${PYTHON_USEDEP}] )
selinux? ( sec-policy/selinux-salt )
nova? (
>=dev-python/python-novaclient-2.17.0[${PYTHON_USEDEP}]
)
neutron? (
>=dev-python/python-neutronclient-2.3.6[${PYTHON_USEDEP}]
)
gnupg? ( dev-python/python-gnupg[${PYTHON_USEDEP}] )
profile? ( dev-python/yappi[${PYTHON_USEDEP}] )
vim-syntax? ( app-vim/salt-vim )
zeromq? ( >=dev-python/pyzmq-19.0.0[${PYTHON_USEDEP}] )
"
BDEPEND="
test? (
${RDEPEND}
>=dev-python/boto-2.32.1[${PYTHON_USEDEP}]
dev-python/certifi[${PYTHON_USEDEP}]
dev-python/cherrypy[${PYTHON_USEDEP}]
>=dev-python/jsonschema-3.0[${PYTHON_USEDEP}]
dev-python/mako[${PYTHON_USEDEP}]
>=dev-python/mock-2.0.0[${PYTHON_USEDEP}]
>=dev-python/moto-2.0.0[${PYTHON_USEDEP}]
dev-python/passlib
dev-python/pip[${PYTHON_USEDEP}]
dev-python/pyopenssl[${PYTHON_USEDEP}]
>=dev-python/pytest-7.0.1[${PYTHON_USEDEP}]
>=dev-python/pytest-salt-factories-1.0.0_rc17[${PYTHON_USEDEP}]
dev-python/pytest-tempdir[${PYTHON_USEDEP}]
dev-python/pytest-helpers-namespace[${PYTHON_USEDEP}]
dev-python/pytest-subtests[${PYTHON_USEDEP}]
dev-python/pytest-shell-utilities[${PYTHON_USEDEP}]
dev-python/pytest-skip-markers[${PYTHON_USEDEP}]
dev-python/pytest-system-statistics[${PYTHON_USEDEP}]
dev-python/flaky[${PYTHON_USEDEP}]
dev-python/libcloud[${PYTHON_USEDEP}]
net-dns/bind-tools
>=dev-python/virtualenv-20.3.0[${PYTHON_USEDEP}]
dev-util/yamllint[${PYTHON_USEDEP}]
!x86? ( >=dev-python/boto3-1.17.67[${PYTHON_USEDEP}] )
)
"
DOCS=( README.rst AUTHORS )
REQUIRED_USE="|| ( raet zeromq )
test? ( cheetah genshi )"
RESTRICT="!test? ( test ) x86? ( test )"
PATCHES=(
"${FILESDIR}/salt-3003-skip-tests-that-oom-machine.patch"
"${FILESDIR}/salt-3003-gentoolkit-revdep.patch"
"${FILESDIR}/salt-3002-tests.patch"
"${FILESDIR}/salt-3003.1-tests.patch"
"${FILESDIR}/salt-3005-relax-pyzmq-dep.patch"
"${FILESDIR}/salt-3005-tests.patch"
"${FILESDIR}/salt-3005.1-no-entry-points.patch"
"${FILESDIR}/salt-3005.1-importlib-metadata-5-r1.patch"
"${FILESDIR}/salt-3005.1-tests.patch"
"${FILESDIR}/salt-3005.1-modules-file-python-3.11-host.patch"
)
python_prepare_all() {
# remove tests with external dependencies that may not be available, and
# tests that don't work in sandbox
rm tests/unit/{test_{zypp_plugins,module_names},utils/test_extend}.py || die
rm tests/unit/modules/test_boto_{vpc,secgroup,elb}.py || die
rm tests/unit/states/test_boto_vpc.py || die
rm tests/support/gitfs.py tests/unit/runners/test_git_pillar.py || die
rm tests/pytests/functional/transport/server/test_req_channel.py || die
rm tests/pytests/functional/utils/test_async_event_publisher.py || die
rm tests/pytests/functional/runners/test_winrepo.py || die
# tests that require network access
rm tests/unit/{states,modules}/test_zcbuildout.py || die
rm -r tests/integration/cloud || die
rm -r tests/kitchen/tests/wordpress/tests || die
rm tests/kitchen/test_kitchen.py || die
rm tests/unit/modules/test_network.py || die
rm tests/pytests/functional/modules/test_pip.py || die
rm tests/pytests/unit/client/ssh/test_ssh.py || die
rm -r tests/pytests/{integration,functional}/netapi tests/integration/netapi || die
# tests require root access
rm tests/integration/pillar/test_git_pillar.py || die
rm tests/integration/states/test_supervisord.py || die
# removes contextvars, see bug: https://bugs.gentoo.org/799431
sed -i '/^contextvars/d' requirements/base.txt || die
# make sure pkg_resources doesn't bomb because pycrypto isn't installed
find "${S}" -name '*.txt' -print0 | xargs -0 sed -e '/pycrypto>/ d ; /pycryptodomex/ d' -i || die
# pycryptodome rather than pycryptodomex
find "${S}" -name '*.py' -print0 | xargs -0 -- sed -i -e 's:Cryptodome:Crypto:g' -- || die
distutils-r1_python_prepare_all
}
python_install_all() {
local svc
USE_SETUPTOOLS=1 distutils-r1_python_install_all
for svc in minion master syndic api; do
newinitd "${FILESDIR}"/${svc}-initd-5 salt-${svc}
newconfd "${FILESDIR}"/${svc}-confd-1 salt-${svc}
systemd_dounit "${FILESDIR}"/salt-${svc}.service
done
insinto /etc/${PN}
doins -r conf/*
}
python_test() {
# testsuite likes lots of files
ulimit -n 4096 || die
local -a disable_tests=(
# doesn't like the distutils warning
batch_retcode
multiple_modules_in_batch
# hangs indefinitely
master_type_disable
# needs root
runas_env_sudo_group
# don't like sandbox
split_multibyte_characters_{shiftjis,unicode}
# doesn't like sandbox env
log_sanitize
)
local textexpr
testexpr=$(printf 'not %s and ' "${disable_tests[@]}")
# ${T} is too long a path for the tests to work
local TMPDIR
TMPDIR="$(mktemp --directory --tmpdir=/tmp ${PN}-XXXX)" || die
(
export TMPDIR
cleanup() { rm -rf "${TMPDIR}" || die; }
trap cleanup EXIT
addwrite "${TMPDIR}"
USE_SETUPTOOLS=1 NO_INTERNET=1 SHELL="/bin/bash" \
"${EPYTHON}" -m pytest -vv -k "${testexpr%and }" \
|| die "testing failed with ${EPYTHON}"
)
}