mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 09:40:20 +00:00
Merge branch 'master' into add-keyvalue-create_if_missing
This commit is contained in:
commit
756af0299b
152 changed files with 4953 additions and 3405 deletions
|
@ -107,6 +107,7 @@ repos:
|
|||
- --platform=linux
|
||||
- --include=requirements/base.txt
|
||||
- --include=requirements/zeromq.txt
|
||||
- --no-emit-index-url
|
||||
- requirements/static/pkg/linux.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -122,6 +123,7 @@ repos:
|
|||
- --platform=linux
|
||||
- --include=requirements/base.txt
|
||||
- --include=requirements/zeromq.txt
|
||||
- --no-emit-index-url
|
||||
- requirements/static/pkg/linux.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -137,6 +139,7 @@ repos:
|
|||
- --platform=linux
|
||||
- --include=requirements/base.txt
|
||||
- --include=requirements/zeromq.txt
|
||||
- --no-emit-index-url
|
||||
- requirements/static/pkg/linux.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -150,6 +153,7 @@ repos:
|
|||
- --platform=linux
|
||||
- --include=requirements/base.txt
|
||||
- --include=requirements/zeromq.txt
|
||||
- --no-emit-index-url
|
||||
- requirements/static/pkg/linux.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -165,6 +169,7 @@ repos:
|
|||
- --platform=freebsd
|
||||
- --include=requirements/base.txt
|
||||
- --include=requirements/zeromq.txt
|
||||
- --no-emit-index-url
|
||||
- requirements/static/pkg/freebsd.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -180,6 +185,7 @@ repos:
|
|||
- --platform=freebsd
|
||||
- --include=requirements/base.txt
|
||||
- --include=requirements/zeromq.txt
|
||||
- --no-emit-index-url
|
||||
- requirements/static/pkg/freebsd.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -195,6 +201,7 @@ repos:
|
|||
- --platform=freebsd
|
||||
- --include=requirements/base.txt
|
||||
- --include=requirements/zeromq.txt
|
||||
- --no-emit-index-url
|
||||
- requirements/static/pkg/freebsd.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -222,6 +229,7 @@ repos:
|
|||
- --py-version=3.9
|
||||
- --platform=darwin
|
||||
- --include=requirements/darwin.txt
|
||||
- --no-emit-index-url
|
||||
- requirements/static/pkg/darwin.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -236,6 +244,7 @@ repos:
|
|||
- --py-version=3.10
|
||||
- --platform=darwin
|
||||
- --include=requirements/darwin.txt
|
||||
- --no-emit-index-url
|
||||
- requirements/static/pkg/darwin.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -248,6 +257,7 @@ repos:
|
|||
- --py-version=3.11
|
||||
- --platform=darwin
|
||||
- --include=requirements/darwin.txt
|
||||
- --no-emit-index-url
|
||||
- requirements/static/pkg/darwin.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -262,6 +272,7 @@ repos:
|
|||
- --py-version=3.8
|
||||
- --platform=windows
|
||||
- --include=requirements/windows.txt
|
||||
- --no-emit-index-url
|
||||
- requirements/static/pkg/windows.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -276,6 +287,7 @@ repos:
|
|||
- --py-version=3.9
|
||||
- --platform=windows
|
||||
- --include=requirements/windows.txt
|
||||
- --no-emit-index-url
|
||||
- requirements/static/pkg/windows.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -290,6 +302,7 @@ repos:
|
|||
- --py-version=3.10
|
||||
- --platform=windows
|
||||
- --include=requirements/windows.txt
|
||||
- --no-emit-index-url
|
||||
- requirements/static/pkg/windows.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -323,6 +336,7 @@ repos:
|
|||
- --include=requirements/pytest.txt
|
||||
- --include=requirements/static/pkg/linux.in
|
||||
- --include=requirements/static/ci/common.in
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/linux.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -341,6 +355,7 @@ repos:
|
|||
- --include=requirements/pytest.txt
|
||||
- --include=requirements/static/pkg/linux.in
|
||||
- --include=requirements/static/ci/common.in
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/linux.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -359,6 +374,7 @@ repos:
|
|||
- --include=requirements/pytest.txt
|
||||
- --include=requirements/static/pkg/linux.in
|
||||
- --include=requirements/static/ci/common.in
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/linux.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -377,6 +393,7 @@ repos:
|
|||
- --include=requirements/pytest.txt
|
||||
- --include=requirements/static/pkg/linux.in
|
||||
- --include=requirements/static/ci/common.in
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/linux.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -391,6 +408,7 @@ repos:
|
|||
- --py-version=3.8
|
||||
- --platform=linux
|
||||
- --out-prefix=linux
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/crypto.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -405,6 +423,7 @@ repos:
|
|||
- --py-version=3.9
|
||||
- --platform=linux
|
||||
- --out-prefix=linux
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/crypto.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -420,6 +439,7 @@ repos:
|
|||
- --py-version=3.10
|
||||
- --platform=linux
|
||||
- --out-prefix=linux
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/crypto.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -435,6 +455,7 @@ repos:
|
|||
- --py-version=3.11
|
||||
- --platform=linux
|
||||
- --out-prefix=linux
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/crypto.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -453,6 +474,7 @@ repos:
|
|||
- --include=requirements/pytest.txt
|
||||
- --include=requirements/static/pkg/freebsd.in
|
||||
- --include=requirements/static/ci/common.in
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/freebsd.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -471,6 +493,7 @@ repos:
|
|||
- --include=requirements/pytest.txt
|
||||
- --include=requirements/static/pkg/freebsd.in
|
||||
- --include=requirements/static/ci/common.in
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/freebsd.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -489,6 +512,7 @@ repos:
|
|||
- --include=requirements/pytest.txt
|
||||
- --include=requirements/static/pkg/freebsd.in
|
||||
- --include=requirements/static/ci/common.in
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/freebsd.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -507,6 +531,7 @@ repos:
|
|||
- --include=requirements/pytest.txt
|
||||
- --include=requirements/static/pkg/freebsd.in
|
||||
- --include=requirements/static/ci/common.in
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/freebsd.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -521,6 +546,7 @@ repos:
|
|||
- --py-version=3.8
|
||||
- --platform=freebsd
|
||||
- --out-prefix=freebsd
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/crypto.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -535,6 +561,7 @@ repos:
|
|||
- --py-version=3.9
|
||||
- --platform=freebsd
|
||||
- --out-prefix=freebsd
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/crypto.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -550,6 +577,7 @@ repos:
|
|||
- --py-version=3.10
|
||||
- --platform=freebsd
|
||||
- --out-prefix=freebsd
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/crypto.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -582,6 +610,7 @@ repos:
|
|||
- --include=requirements/pytest.txt
|
||||
- --include=requirements/static/pkg/darwin.in
|
||||
- --include=requirements/static/ci/common.in
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/darwin.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -599,6 +628,7 @@ repos:
|
|||
- --include=requirements/pytest.txt
|
||||
- --include=requirements/static/pkg/darwin.in
|
||||
- --include=requirements/static/ci/common.in
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/darwin.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -630,6 +660,7 @@ repos:
|
|||
- --py-version=3.9
|
||||
- --platform=darwin
|
||||
- --out-prefix=darwin
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/crypto.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -644,6 +675,7 @@ repos:
|
|||
- --py-version=3.10
|
||||
- --platform=darwin
|
||||
- --out-prefix=darwin
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/crypto.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -658,6 +690,7 @@ repos:
|
|||
- --py-version=3.11
|
||||
- --platform=darwin
|
||||
- --out-prefix=darwin
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/crypto.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -675,6 +708,7 @@ repos:
|
|||
- --include=requirements/pytest.txt
|
||||
- --include=requirements/static/pkg/windows.in
|
||||
- --include=requirements/static/ci/common.in
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/windows.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -692,6 +726,7 @@ repos:
|
|||
- --include=requirements/pytest.txt
|
||||
- --include=requirements/static/pkg/windows.in
|
||||
- --include=requirements/static/ci/common.in
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/windows.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -709,6 +744,7 @@ repos:
|
|||
- --include=requirements/pytest.txt
|
||||
- --include=requirements/static/pkg/windows.in
|
||||
- --include=requirements/static/ci/common.in
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/windows.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -726,6 +762,7 @@ repos:
|
|||
- --include=requirements/pytest.txt
|
||||
- --include=requirements/static/pkg/windows.in
|
||||
- --include=requirements/static/ci/common.in
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/windows.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -740,6 +777,7 @@ repos:
|
|||
- --py-version=3.8
|
||||
- --platform=windows
|
||||
- --out-prefix=windows
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/crypto.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -754,6 +792,7 @@ repos:
|
|||
- --py-version=3.9
|
||||
- --platform=windows
|
||||
- --out-prefix=windows
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/crypto.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -768,6 +807,7 @@ repos:
|
|||
- --py-version=3.10
|
||||
- --platform=windows
|
||||
- --out-prefix=windows
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/crypto.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -798,6 +838,7 @@ repos:
|
|||
- --build-isolation
|
||||
# - --resolver=backtracking
|
||||
- --py-version=3.8
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/cloud.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -810,6 +851,7 @@ repos:
|
|||
- --build-isolation
|
||||
# - --resolver=backtracking
|
||||
- --py-version=3.9
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/cloud.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -822,6 +864,7 @@ repos:
|
|||
- --build-isolation
|
||||
# - --resolver=backtracking
|
||||
- --py-version=3.10
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/cloud.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -834,6 +877,7 @@ repos:
|
|||
- --build-isolation
|
||||
# - --resolver=backtracking
|
||||
- --py-version=3.11
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/cloud.in
|
||||
# <---- Cloud CI Requirements --------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -849,6 +893,7 @@ repos:
|
|||
# - --resolver=backtracking
|
||||
- --py-version=3.8
|
||||
- --platform=linux
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/docs.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -862,6 +907,7 @@ repos:
|
|||
# - --resolver=backtracking
|
||||
- --py-version=3.9
|
||||
- --platform=linux
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/docs.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -875,6 +921,7 @@ repos:
|
|||
# - --resolver=backtracking
|
||||
- --py-version=3.10
|
||||
- --platform=linux
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/docs.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -903,6 +950,7 @@ repos:
|
|||
# - --resolver=backtracking
|
||||
- --py-version=3.8
|
||||
- --platform=linux
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/lint.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -916,6 +964,7 @@ repos:
|
|||
# - --resolver=backtracking
|
||||
- --py-version=3.9
|
||||
- --platform=linux
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/lint.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -929,6 +978,7 @@ repos:
|
|||
# - --resolver=backtracking
|
||||
- --py-version=3.10
|
||||
- --platform=linux
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/lint.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -942,6 +992,7 @@ repos:
|
|||
# - --resolver=backtracking
|
||||
- --py-version=3.11
|
||||
- --platform=linux
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/lint.in
|
||||
|
||||
# <---- Lint CI Requirements ---------------------------------------------------------------------------------------
|
||||
|
@ -958,6 +1009,7 @@ repos:
|
|||
# - --resolver=backtracking
|
||||
- --py-version=3.8
|
||||
- --platform=linux
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/changelog.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -971,6 +1023,7 @@ repos:
|
|||
# - --resolver=backtracking
|
||||
- --py-version=3.9
|
||||
- --platform=linux
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/changelog.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -984,6 +1037,7 @@ repos:
|
|||
# - --resolver=backtracking
|
||||
- --py-version=3.10
|
||||
- --platform=linux
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/changelog.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -997,6 +1051,7 @@ repos:
|
|||
# - --resolver=backtracking
|
||||
- --py-version=3.11
|
||||
- --platform=linux
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/changelog.in
|
||||
# <---- Changelog --------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -1011,6 +1066,7 @@ repos:
|
|||
- --build-isolation
|
||||
# - --resolver=backtracking
|
||||
- --py-version=3.8
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/invoke.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -1023,6 +1079,7 @@ repos:
|
|||
- --build-isolation
|
||||
# - --resolver=backtracking
|
||||
- --py-version=3.9
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/invoke.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -1035,6 +1092,7 @@ repos:
|
|||
- --build-isolation
|
||||
# - --resolver=backtracking
|
||||
- --py-version=3.10
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/invoke.in
|
||||
# <---- Invoke -----------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -1079,6 +1137,7 @@ repos:
|
|||
- --build-isolation
|
||||
# - --resolver=backtracking
|
||||
- --py-version=3.9
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/tools.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -1091,6 +1150,7 @@ repos:
|
|||
- --build-isolation
|
||||
# - --resolver=backtracking
|
||||
- --py-version=3.10
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/tools.in
|
||||
|
||||
- id: pip-tools-compile
|
||||
|
@ -1103,6 +1163,7 @@ repos:
|
|||
- --build-isolation
|
||||
# - --resolver=backtracking
|
||||
- --py-version=3.11
|
||||
- --no-emit-index-url
|
||||
- requirements/static/ci/tools.in
|
||||
# <---- Tools -----------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -1129,7 +1190,7 @@ repos:
|
|||
|
||||
- repo: https://github.com/s0undt3ch/salt-rewrite
|
||||
# Automatically rewrite code with known rules
|
||||
rev: 2.0.0
|
||||
rev: 2.4.3
|
||||
hooks:
|
||||
- id: salt-rewrite
|
||||
alias: rewrite-docstrings
|
||||
|
@ -1141,10 +1202,6 @@ repos:
|
|||
salt/ext/.*
|
||||
)$
|
||||
|
||||
- repo: https://github.com/s0undt3ch/salt-rewrite
|
||||
# Automatically rewrite code with known rules
|
||||
rev: 2.0.0
|
||||
hooks:
|
||||
- id: salt-rewrite
|
||||
alias: rewrite-tests
|
||||
name: Rewrite Salt's Test Suite
|
||||
|
|
1
changelog/57541.added.md
Normal file
1
changelog/57541.added.md
Normal file
|
@ -0,0 +1 @@
|
|||
Revised use of deprecated net-tools and added support for ip neighbour with IPv4 ip_neighs, IPv6 ip_neighs6
|
1
changelog/61049.fixed.md
Normal file
1
changelog/61049.fixed.md
Normal file
|
@ -0,0 +1 @@
|
|||
Do not update the credentials dictionary in `utils/aws.py` while iterating over it, and use the correct delete functionality
|
2
changelog/63296.fixed.md
Normal file
2
changelog/63296.fixed.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
Fixes an issue with failing subsequent state runs with the lgpo state module.
|
||||
The ``lgpo.get_polcy`` function now returns all boolean settings.
|
1
changelog/63463.added.md
Normal file
1
changelog/63463.added.md
Normal file
|
@ -0,0 +1 @@
|
|||
add JUnit output for saltcheck
|
2
changelog/63473.fixed.md
Normal file
2
changelog/63473.fixed.md
Normal file
|
@ -0,0 +1,2 @@
|
|||
Fixes an issue with boolean settings not being reported after being set. The
|
||||
``lgpo.get_polcy`` function now returns all boolean settings.
|
1
changelog/63991.fixed.md
Normal file
1
changelog/63991.fixed.md
Normal file
|
@ -0,0 +1 @@
|
|||
Added option to use a fresh connection for mysql cache
|
1
changelog/64237.fixed.md
Normal file
1
changelog/64237.fixed.md
Normal file
|
@ -0,0 +1 @@
|
|||
remove the hard coded python version in error.
|
1
changelog/64260.fixed.md
Normal file
1
changelog/64260.fixed.md
Normal file
|
@ -0,0 +1 @@
|
|||
Skipped the `isfile` check to greatly increase speed of reading minion keys for systems with a large number of minions on slow file storage
|
1
changelog/64280.fixed.md
Normal file
1
changelog/64280.fixed.md
Normal file
|
@ -0,0 +1 @@
|
|||
Fixed file client private attribute reference on `SaltMakoTemplateLookup`
|
1
changelog/64318.fixed.md
Normal file
1
changelog/64318.fixed.md
Normal file
|
@ -0,0 +1 @@
|
|||
Ensure selinux values are handled lowercase
|
5
changelog/64401.fixed.md
Normal file
5
changelog/64401.fixed.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
Fixed an issue with ``lgpo_reg`` where existing entries for the same key in
|
||||
``Registry.pol`` were being overwritten in subsequent runs if the value name in
|
||||
the subesequent run was contained in the existing value name. For example, a
|
||||
key named ``SetUpdateNotificationLevel`` would be overwritten by a subsequent
|
||||
run attempting to set ``UpdateNotificationLevel``
|
1
changelog/64430.fixed.md
Normal file
1
changelog/64430.fixed.md
Normal file
|
@ -0,0 +1 @@
|
|||
Fix regression for user.present on handling groups with dupe GIDs
|
|
@ -20,6 +20,7 @@ gitpython>=3.1.30
|
|||
jmespath
|
||||
jsonschema
|
||||
junos-eznc; sys_platform != 'win32'
|
||||
junit-xml>=1.9
|
||||
jxmlease; sys_platform != 'win32'
|
||||
kazoo; sys_platform != 'win32' and sys_platform != 'darwin'
|
||||
keyring==5.7.1
|
||||
|
@ -40,7 +41,9 @@ toml
|
|||
vcert; sys_platform != 'win32'
|
||||
virtualenv>=20.3.0
|
||||
watchdog>=0.9.0
|
||||
xmldiff>=2.4
|
||||
# Available template libraries that can be used
|
||||
genshi>=0.7.3
|
||||
cheetah3>=3.2.2
|
||||
mako
|
||||
wempy
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.10/changelog.txt requirements/static/ci/changelog.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.10/changelog.txt requirements/static/ci/changelog.in
|
||||
#
|
||||
click-default-group==1.2.2
|
||||
# via towncrier
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.10/cloud.txt requirements/static/ci/cloud.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.10/cloud.txt requirements/static/ci/cloud.in
|
||||
#
|
||||
apache-libcloud==3.7.0 ; sys_platform != "win32"
|
||||
# via
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.10/darwin-crypto.txt requirements/static/ci/crypto.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.10/darwin-crypto.txt requirements/static/ci/crypto.in
|
||||
#
|
||||
m2crypto==0.38.0
|
||||
# via -r requirements/static/ci/crypto.in
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.10/darwin.txt requirements/darwin.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/darwin.in requirements/static/pkg/darwin.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.10/darwin.txt requirements/darwin.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/darwin.in requirements/static/pkg/darwin.in
|
||||
#
|
||||
aiohttp==3.8.1
|
||||
# via etcd3-py
|
||||
|
@ -205,6 +205,8 @@ jmespath==1.0.1
|
|||
# botocore
|
||||
jsonschema==3.2.0
|
||||
# via -r requirements/static/ci/common.in
|
||||
junit-xml==1.9
|
||||
# via -r requirements/static/ci/common.in
|
||||
junos-eznc==2.6.7 ; sys_platform != "win32"
|
||||
# via
|
||||
# -r requirements/static/ci/common.in
|
||||
|
@ -228,6 +230,7 @@ lxml==4.9.2
|
|||
# junos-eznc
|
||||
# napalm
|
||||
# ncclient
|
||||
# xmldiff
|
||||
mako==1.2.4
|
||||
# via -r requirements/static/ci/common.in
|
||||
markupsafe==2.1.2
|
||||
|
@ -469,6 +472,7 @@ six==1.16.0
|
|||
# geomet
|
||||
# google-auth
|
||||
# jsonschema
|
||||
# junit-xml
|
||||
# junos-eznc
|
||||
# kubernetes
|
||||
# mock
|
||||
|
@ -551,10 +555,14 @@ websocket-client==0.40.0
|
|||
# via
|
||||
# docker
|
||||
# kubernetes
|
||||
wempy==0.2.1
|
||||
# via -r requirements/static/ci/common.in
|
||||
werkzeug==2.2.3
|
||||
# via
|
||||
# moto
|
||||
# pytest-httpserver
|
||||
xmldiff==2.6.3
|
||||
# via -r requirements/static/ci/common.in
|
||||
xmltodict==0.12.0
|
||||
# via moto
|
||||
yamllint==1.32.0
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.10/docs.txt requirements/static/ci/docs.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.10/docs.txt requirements/static/ci/docs.in
|
||||
#
|
||||
alabaster==0.7.12
|
||||
# via sphinx
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.10/freebsd-crypto.txt requirements/static/ci/crypto.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.10/freebsd-crypto.txt requirements/static/ci/crypto.in
|
||||
#
|
||||
m2crypto==0.38.0
|
||||
# via -r requirements/static/ci/crypto.in
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.10/freebsd.txt requirements/base.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/freebsd.in requirements/static/pkg/freebsd.in requirements/zeromq.txt
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.10/freebsd.txt requirements/base.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/freebsd.in requirements/static/pkg/freebsd.in requirements/zeromq.txt
|
||||
#
|
||||
aiohttp==3.8.1
|
||||
# via etcd3-py
|
||||
|
@ -200,6 +200,8 @@ jmespath==1.0.1
|
|||
# botocore
|
||||
jsonschema==3.2.0
|
||||
# via -r requirements/static/ci/common.in
|
||||
junit-xml==1.9
|
||||
# via -r requirements/static/ci/common.in
|
||||
junos-eznc==2.6.7 ; sys_platform != "win32"
|
||||
# via
|
||||
# -r requirements/static/ci/common.in
|
||||
|
@ -223,6 +225,7 @@ lxml==4.9.2
|
|||
# junos-eznc
|
||||
# napalm
|
||||
# ncclient
|
||||
# xmldiff
|
||||
mako==1.2.4
|
||||
# via -r requirements/static/ci/common.in
|
||||
markupsafe==2.1.2
|
||||
|
@ -463,6 +466,7 @@ six==1.16.0
|
|||
# geomet
|
||||
# google-auth
|
||||
# jsonschema
|
||||
# junit-xml
|
||||
# junos-eznc
|
||||
# kazoo
|
||||
# kubernetes
|
||||
|
@ -540,10 +544,14 @@ websocket-client==0.40.0
|
|||
# via
|
||||
# docker
|
||||
# kubernetes
|
||||
wempy==0.2.1
|
||||
# via -r requirements/static/ci/common.in
|
||||
werkzeug==2.2.3
|
||||
# via
|
||||
# moto
|
||||
# pytest-httpserver
|
||||
xmldiff==2.6.3
|
||||
# via -r requirements/static/ci/common.in
|
||||
xmltodict==0.12.0
|
||||
# via moto
|
||||
yamllint==1.32.0
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.10/invoke.txt requirements/static/ci/invoke.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.10/invoke.txt requirements/static/ci/invoke.in
|
||||
#
|
||||
blessings==1.7
|
||||
# via -r requirements/static/ci/invoke.in
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.10/lint.txt requirements/static/ci/lint.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.10/lint.txt requirements/static/ci/lint.in
|
||||
#
|
||||
astroid==2.3.3
|
||||
# via pylint
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.10/linux-crypto.txt requirements/static/ci/crypto.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.10/linux-crypto.txt requirements/static/ci/crypto.in
|
||||
#
|
||||
m2crypto==0.38.0
|
||||
# via -r requirements/static/ci/crypto.in
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.10/linux.txt requirements/base.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/linux.in requirements/static/pkg/linux.in requirements/zeromq.txt
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.10/linux.txt requirements/base.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/linux.in requirements/static/pkg/linux.in requirements/zeromq.txt
|
||||
#
|
||||
aiohttp-retry==2.8.3
|
||||
# via twilio
|
||||
|
@ -225,6 +225,8 @@ jmespath==1.0.1
|
|||
# botocore
|
||||
jsonschema==3.2.0
|
||||
# via -r requirements/static/ci/common.in
|
||||
junit-xml==1.9
|
||||
# via -r requirements/static/ci/common.in
|
||||
junos-eznc==2.6.7 ; sys_platform != "win32"
|
||||
# via
|
||||
# -r requirements/static/ci/common.in
|
||||
|
@ -248,6 +250,7 @@ lxml==4.9.2
|
|||
# junos-eznc
|
||||
# napalm
|
||||
# ncclient
|
||||
# xmldiff
|
||||
mako==1.2.4
|
||||
# via -r requirements/static/ci/common.in
|
||||
markupsafe==2.1.2
|
||||
|
@ -514,6 +517,7 @@ six==1.16.0
|
|||
# geomet
|
||||
# google-auth
|
||||
# jsonschema
|
||||
# junit-xml
|
||||
# junos-eznc
|
||||
# kazoo
|
||||
# kubernetes
|
||||
|
@ -603,10 +607,14 @@ websocket-client==0.40.0
|
|||
# via
|
||||
# docker
|
||||
# kubernetes
|
||||
wempy==0.2.1
|
||||
# via -r requirements/static/ci/common.in
|
||||
werkzeug==2.2.3
|
||||
# via
|
||||
# moto
|
||||
# pytest-httpserver
|
||||
xmldiff==2.6.3
|
||||
# via -r requirements/static/ci/common.in
|
||||
xmltodict==0.12.0
|
||||
# via moto
|
||||
yamllint==1.32.0
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.10/tools.txt requirements/static/ci/tools.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.10/tools.txt requirements/static/ci/tools.in
|
||||
#
|
||||
attrs==22.1.0
|
||||
# via
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.10/windows-crypto.txt requirements/static/ci/crypto.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.10/windows-crypto.txt requirements/static/ci/crypto.in
|
||||
#
|
||||
m2crypto==0.37.1
|
||||
# via -r requirements/static/ci/crypto.in
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.10/windows.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/windows.in requirements/static/pkg/windows.in requirements/windows.txt
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.10/windows.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/windows.in requirements/static/pkg/windows.in requirements/windows.txt
|
||||
#
|
||||
aiohttp==3.8.3
|
||||
# via etcd3-py
|
||||
|
@ -189,6 +189,8 @@ jmespath==1.0.1
|
|||
# botocore
|
||||
jsonschema==3.2.0
|
||||
# via -r requirements/static/ci/common.in
|
||||
junit-xml==1.9
|
||||
# via -r requirements/static/ci/common.in
|
||||
keyring==5.7.1
|
||||
# via -r requirements/static/ci/common.in
|
||||
kubernetes==3.0.0
|
||||
|
@ -201,6 +203,7 @@ lxml==4.9.2
|
|||
# via
|
||||
# -c requirements/static/ci/../pkg/py3.10/windows.txt
|
||||
# -r requirements/windows.txt
|
||||
# xmldiff
|
||||
mako==1.2.4
|
||||
# via -r requirements/static/ci/common.in
|
||||
markupsafe==2.1.2
|
||||
|
@ -421,6 +424,7 @@ six==1.15.0
|
|||
# geomet
|
||||
# google-auth
|
||||
# jsonschema
|
||||
# junit-xml
|
||||
# kubernetes
|
||||
# mock
|
||||
# python-dateutil
|
||||
|
@ -479,6 +483,8 @@ websocket-client==0.40.0
|
|||
# via
|
||||
# docker
|
||||
# kubernetes
|
||||
wempy==0.2.1
|
||||
# via -r requirements/static/ci/common.in
|
||||
werkzeug==2.2.3
|
||||
# via
|
||||
# moto
|
||||
|
@ -491,6 +497,8 @@ wmi==1.5.1
|
|||
# via
|
||||
# -c requirements/static/ci/../pkg/py3.10/windows.txt
|
||||
# -r requirements/windows.txt
|
||||
xmldiff==2.6.3
|
||||
# via -r requirements/static/ci/common.in
|
||||
xmltodict==0.12.0
|
||||
# via
|
||||
# moto
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.11/changelog.txt requirements/static/ci/changelog.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.11/changelog.txt requirements/static/ci/changelog.in
|
||||
#
|
||||
click-default-group==1.2.2
|
||||
# via towncrier
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.11/cloud.txt requirements/static/ci/cloud.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.11/cloud.txt requirements/static/ci/cloud.in
|
||||
#
|
||||
apache-libcloud==3.7.0 ; sys_platform != "win32"
|
||||
# via
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.11/darwin-crypto.txt requirements/static/ci/crypto.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.11/darwin-crypto.txt requirements/static/ci/crypto.in
|
||||
#
|
||||
m2crypto==0.38.0
|
||||
# via -r requirements/static/ci/crypto.in
|
||||
|
|
|
@ -203,6 +203,8 @@ jmespath==1.0.1
|
|||
# botocore
|
||||
jsonschema==3.2.0
|
||||
# via -r requirements/static/ci/common.in
|
||||
junit-xml==1.9
|
||||
# via -r requirements/static/ci/common.in
|
||||
junos-eznc==2.6.7 ; sys_platform != "win32"
|
||||
# via
|
||||
# -r requirements/static/ci/common.in
|
||||
|
@ -226,6 +228,7 @@ lxml==4.9.2
|
|||
# junos-eznc
|
||||
# napalm
|
||||
# ncclient
|
||||
# xmldiff
|
||||
mako==1.2.4
|
||||
# via -r requirements/static/ci/common.in
|
||||
markupsafe==2.1.2
|
||||
|
@ -467,6 +470,7 @@ six==1.16.0
|
|||
# geomet
|
||||
# google-auth
|
||||
# jsonschema
|
||||
# junit-xml
|
||||
# junos-eznc
|
||||
# kubernetes
|
||||
# mock
|
||||
|
@ -547,10 +551,14 @@ websocket-client==0.40.0
|
|||
# via
|
||||
# docker
|
||||
# kubernetes
|
||||
wempy==0.2.1
|
||||
# via -r requirements/static/ci/common.in
|
||||
werkzeug==2.2.3
|
||||
# via
|
||||
# moto
|
||||
# pytest-httpserver
|
||||
xmldiff==2.6.3
|
||||
# via -r requirements/static/ci/common.in
|
||||
xmltodict==0.12.0
|
||||
# via moto
|
||||
yamllint==1.32.0
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.11/freebsd.txt requirements/base.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/freebsd.in requirements/static/pkg/freebsd.in requirements/zeromq.txt
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.11/freebsd.txt requirements/base.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/freebsd.in requirements/static/pkg/freebsd.in requirements/zeromq.txt
|
||||
#
|
||||
aiohttp==3.8.1
|
||||
# via etcd3-py
|
||||
|
@ -198,6 +198,8 @@ jmespath==1.0.1
|
|||
# botocore
|
||||
jsonschema==3.2.0
|
||||
# via -r requirements/static/ci/common.in
|
||||
junit-xml==1.9
|
||||
# via -r requirements/static/ci/common.in
|
||||
junos-eznc==2.6.7 ; sys_platform != "win32"
|
||||
# via
|
||||
# -r requirements/static/ci/common.in
|
||||
|
@ -221,6 +223,7 @@ lxml==4.9.2
|
|||
# junos-eznc
|
||||
# napalm
|
||||
# ncclient
|
||||
# xmldiff
|
||||
mako==1.2.4
|
||||
# via -r requirements/static/ci/common.in
|
||||
markupsafe==2.1.2
|
||||
|
@ -461,6 +464,7 @@ six==1.16.0
|
|||
# geomet
|
||||
# google-auth
|
||||
# jsonschema
|
||||
# junit-xml
|
||||
# junos-eznc
|
||||
# kazoo
|
||||
# kubernetes
|
||||
|
@ -536,10 +540,14 @@ websocket-client==0.40.0
|
|||
# via
|
||||
# docker
|
||||
# kubernetes
|
||||
wempy==0.2.1
|
||||
# via -r requirements/static/ci/common.in
|
||||
werkzeug==2.2.3
|
||||
# via
|
||||
# moto
|
||||
# pytest-httpserver
|
||||
xmldiff==2.6.3
|
||||
# via -r requirements/static/ci/common.in
|
||||
xmltodict==0.12.0
|
||||
# via moto
|
||||
yamllint==1.32.0
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.11/lint.txt requirements/static/ci/lint.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.11/lint.txt requirements/static/ci/lint.in
|
||||
#
|
||||
astroid==2.3.3
|
||||
# via pylint
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.11/linux-crypto.txt requirements/static/ci/crypto.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.11/linux-crypto.txt requirements/static/ci/crypto.in
|
||||
#
|
||||
m2crypto==0.38.0
|
||||
# via -r requirements/static/ci/crypto.in
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.11/linux.txt requirements/base.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/linux.in requirements/static/pkg/linux.in requirements/zeromq.txt
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.11/linux.txt requirements/base.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/linux.in requirements/static/pkg/linux.in requirements/zeromq.txt
|
||||
#
|
||||
aiohttp-retry==2.8.3
|
||||
# via twilio
|
||||
|
@ -221,6 +221,8 @@ jmespath==1.0.1
|
|||
# botocore
|
||||
jsonschema==3.2.0
|
||||
# via -r requirements/static/ci/common.in
|
||||
junit-xml==1.9
|
||||
# via -r requirements/static/ci/common.in
|
||||
junos-eznc==2.6.7 ; sys_platform != "win32"
|
||||
# via
|
||||
# -r requirements/static/ci/common.in
|
||||
|
@ -244,6 +246,7 @@ lxml==4.9.2
|
|||
# junos-eznc
|
||||
# napalm
|
||||
# ncclient
|
||||
# xmldiff
|
||||
mako==1.2.4
|
||||
# via -r requirements/static/ci/common.in
|
||||
markupsafe==2.1.2
|
||||
|
@ -510,6 +513,7 @@ six==1.16.0
|
|||
# geomet
|
||||
# google-auth
|
||||
# jsonschema
|
||||
# junit-xml
|
||||
# junos-eznc
|
||||
# kazoo
|
||||
# kubernetes
|
||||
|
@ -597,10 +601,14 @@ websocket-client==0.40.0
|
|||
# via
|
||||
# docker
|
||||
# kubernetes
|
||||
wempy==0.2.1
|
||||
# via -r requirements/static/ci/common.in
|
||||
werkzeug==2.2.3
|
||||
# via
|
||||
# moto
|
||||
# pytest-httpserver
|
||||
xmldiff==2.6.3
|
||||
# via -r requirements/static/ci/common.in
|
||||
xmltodict==0.12.0
|
||||
# via moto
|
||||
yamllint==1.32.0
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.11/tools.txt requirements/static/ci/tools.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.11/tools.txt requirements/static/ci/tools.in
|
||||
#
|
||||
attrs==23.1.0
|
||||
# via
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.11/windows.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/windows.in requirements/static/pkg/windows.in requirements/windows.txt
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.11/windows.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/windows.in requirements/static/pkg/windows.in requirements/windows.txt
|
||||
#
|
||||
aiohttp==3.8.3
|
||||
# via etcd3-py
|
||||
|
@ -187,6 +187,8 @@ jmespath==1.0.1
|
|||
# botocore
|
||||
jsonschema==3.2.0
|
||||
# via -r requirements/static/ci/common.in
|
||||
junit-xml==1.9
|
||||
# via -r requirements/static/ci/common.in
|
||||
keyring==5.7.1
|
||||
# via -r requirements/static/ci/common.in
|
||||
kubernetes==3.0.0
|
||||
|
@ -199,6 +201,7 @@ lxml==4.9.2
|
|||
# via
|
||||
# -c requirements/static/ci/../pkg/py3.11/windows.txt
|
||||
# -r requirements/windows.txt
|
||||
# xmldiff
|
||||
mako==1.2.4
|
||||
# via -r requirements/static/ci/common.in
|
||||
markupsafe==2.1.2
|
||||
|
@ -419,6 +422,7 @@ six==1.15.0
|
|||
# geomet
|
||||
# google-auth
|
||||
# jsonschema
|
||||
# junit-xml
|
||||
# kubernetes
|
||||
# mock
|
||||
# python-dateutil
|
||||
|
@ -475,6 +479,8 @@ websocket-client==0.40.0
|
|||
# via
|
||||
# docker
|
||||
# kubernetes
|
||||
wempy==0.2.1
|
||||
# via -r requirements/static/ci/common.in
|
||||
werkzeug==2.2.3
|
||||
# via
|
||||
# moto
|
||||
|
@ -487,6 +493,8 @@ wmi==1.5.1
|
|||
# via
|
||||
# -c requirements/static/ci/../pkg/py3.11/windows.txt
|
||||
# -r requirements/windows.txt
|
||||
xmldiff==2.6.3
|
||||
# via -r requirements/static/ci/common.in
|
||||
xmltodict==0.12.0
|
||||
# via
|
||||
# moto
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.8/changelog.txt requirements/static/ci/changelog.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.8/changelog.txt requirements/static/ci/changelog.in
|
||||
#
|
||||
click-default-group==1.2.2
|
||||
# via towncrier
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.8/cloud.txt requirements/static/ci/cloud.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.8/cloud.txt requirements/static/ci/cloud.in
|
||||
#
|
||||
apache-libcloud==3.7.0 ; sys_platform != "win32"
|
||||
# via
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.8/docs.txt requirements/static/ci/docs.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.8/docs.txt requirements/static/ci/docs.in
|
||||
#
|
||||
alabaster==0.7.12
|
||||
# via sphinx
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.8/freebsd-crypto.txt requirements/static/ci/crypto.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.8/freebsd-crypto.txt requirements/static/ci/crypto.in
|
||||
#
|
||||
m2crypto==0.38.0
|
||||
# via -r requirements/static/ci/crypto.in
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.8/freebsd.txt requirements/base.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/freebsd.in requirements/static/pkg/freebsd.in requirements/zeromq.txt
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.8/freebsd.txt requirements/base.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/freebsd.in requirements/static/pkg/freebsd.in requirements/zeromq.txt
|
||||
#
|
||||
aiohttp==3.8.1
|
||||
# via etcd3-py
|
||||
|
@ -204,6 +204,8 @@ jmespath==1.0.1
|
|||
# botocore
|
||||
jsonschema==3.2.0
|
||||
# via -r requirements/static/ci/common.in
|
||||
junit-xml==1.9
|
||||
# via -r requirements/static/ci/common.in
|
||||
junos-eznc==2.6.7 ; sys_platform != "win32"
|
||||
# via
|
||||
# -r requirements/static/ci/common.in
|
||||
|
@ -227,6 +229,7 @@ lxml==4.9.2
|
|||
# junos-eznc
|
||||
# napalm
|
||||
# ncclient
|
||||
# xmldiff
|
||||
mako==1.2.4
|
||||
# via -r requirements/static/ci/common.in
|
||||
markupsafe==2.1.2
|
||||
|
@ -466,6 +469,7 @@ six==1.16.0
|
|||
# geomet
|
||||
# google-auth
|
||||
# jsonschema
|
||||
# junit-xml
|
||||
# junos-eznc
|
||||
# kazoo
|
||||
# kubernetes
|
||||
|
@ -543,10 +547,14 @@ websocket-client==0.40.0
|
|||
# via
|
||||
# docker
|
||||
# kubernetes
|
||||
wempy==0.2.1
|
||||
# via -r requirements/static/ci/common.in
|
||||
werkzeug==2.2.3
|
||||
# via
|
||||
# moto
|
||||
# pytest-httpserver
|
||||
xmldiff==2.6.3
|
||||
# via -r requirements/static/ci/common.in
|
||||
xmltodict==0.12.0
|
||||
# via moto
|
||||
yamllint==1.32.0
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.8/invoke.txt requirements/static/ci/invoke.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.8/invoke.txt requirements/static/ci/invoke.in
|
||||
#
|
||||
blessings==1.7
|
||||
# via -r requirements/static/ci/invoke.in
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.8/lint.txt requirements/static/ci/lint.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.8/lint.txt requirements/static/ci/lint.in
|
||||
#
|
||||
astroid==2.3.3
|
||||
# via pylint
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.8/linux-crypto.txt requirements/static/ci/crypto.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.8/linux-crypto.txt requirements/static/ci/crypto.in
|
||||
#
|
||||
m2crypto==0.38.0
|
||||
# via -r requirements/static/ci/crypto.in
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.8/linux.txt requirements/base.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/linux.in requirements/static/pkg/linux.in requirements/zeromq.txt
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.8/linux.txt requirements/base.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/linux.in requirements/static/pkg/linux.in requirements/zeromq.txt
|
||||
#
|
||||
aiohttp-retry==2.8.3
|
||||
# via twilio
|
||||
|
@ -229,6 +229,8 @@ jmespath==1.0.1
|
|||
# botocore
|
||||
jsonschema==3.2.0
|
||||
# via -r requirements/static/ci/common.in
|
||||
junit-xml==1.9
|
||||
# via -r requirements/static/ci/common.in
|
||||
junos-eznc==2.6.7 ; sys_platform != "win32"
|
||||
# via
|
||||
# -r requirements/static/ci/common.in
|
||||
|
@ -252,6 +254,7 @@ lxml==4.9.2
|
|||
# junos-eznc
|
||||
# napalm
|
||||
# ncclient
|
||||
# xmldiff
|
||||
mako==1.2.4
|
||||
# via -r requirements/static/ci/common.in
|
||||
markupsafe==2.1.2
|
||||
|
@ -518,6 +521,7 @@ six==1.16.0
|
|||
# geomet
|
||||
# google-auth
|
||||
# jsonschema
|
||||
# junit-xml
|
||||
# junos-eznc
|
||||
# kazoo
|
||||
# kubernetes
|
||||
|
@ -607,10 +611,14 @@ websocket-client==0.40.0
|
|||
# via
|
||||
# docker
|
||||
# kubernetes
|
||||
wempy==0.2.1
|
||||
# via -r requirements/static/ci/common.in
|
||||
werkzeug==2.2.3
|
||||
# via
|
||||
# moto
|
||||
# pytest-httpserver
|
||||
xmldiff==2.6.3
|
||||
# via -r requirements/static/ci/common.in
|
||||
xmltodict==0.12.0
|
||||
# via moto
|
||||
yamllint==1.32.0
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.8/windows-crypto.txt requirements/static/ci/crypto.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.8/windows-crypto.txt requirements/static/ci/crypto.in
|
||||
#
|
||||
m2crypto==0.38.0
|
||||
# via -r requirements/static/ci/crypto.in
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.8/windows.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/windows.in requirements/static/pkg/windows.in requirements/windows.txt
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.8/windows.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/windows.in requirements/static/pkg/windows.in requirements/windows.txt
|
||||
#
|
||||
aiohttp==3.8.1
|
||||
# via etcd3-py
|
||||
|
@ -195,6 +195,8 @@ jmespath==1.0.1
|
|||
# botocore
|
||||
jsonschema==3.2.0
|
||||
# via -r requirements/static/ci/common.in
|
||||
junit-xml==1.9
|
||||
# via -r requirements/static/ci/common.in
|
||||
keyring==5.7.1
|
||||
# via -r requirements/static/ci/common.in
|
||||
kubernetes==3.0.0
|
||||
|
@ -207,6 +209,7 @@ lxml==4.9.2
|
|||
# via
|
||||
# -c requirements/static/ci/../pkg/py3.8/windows.txt
|
||||
# -r requirements/windows.txt
|
||||
# xmldiff
|
||||
mako==1.2.4
|
||||
# via -r requirements/static/ci/common.in
|
||||
markupsafe==2.1.2
|
||||
|
@ -428,6 +431,7 @@ six==1.15.0
|
|||
# geomet
|
||||
# google-auth
|
||||
# jsonschema
|
||||
# junit-xml
|
||||
# kubernetes
|
||||
# mock
|
||||
# python-dateutil
|
||||
|
@ -487,6 +491,8 @@ websocket-client==0.40.0
|
|||
# via
|
||||
# docker
|
||||
# kubernetes
|
||||
wempy==0.2.1
|
||||
# via -r requirements/static/ci/common.in
|
||||
werkzeug==2.2.3
|
||||
# via
|
||||
# moto
|
||||
|
@ -499,6 +505,8 @@ wmi==1.5.1
|
|||
# via
|
||||
# -c requirements/static/ci/../pkg/py3.8/windows.txt
|
||||
# -r requirements/windows.txt
|
||||
xmldiff==2.6.3
|
||||
# via -r requirements/static/ci/common.in
|
||||
xmltodict==0.12.0
|
||||
# via
|
||||
# moto
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.9/changelog.txt requirements/static/ci/changelog.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.9/changelog.txt requirements/static/ci/changelog.in
|
||||
#
|
||||
click-default-group==1.2.2
|
||||
# via towncrier
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.9/cloud.txt requirements/static/ci/cloud.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.9/cloud.txt requirements/static/ci/cloud.in
|
||||
#
|
||||
apache-libcloud==3.7.0 ; sys_platform != "win32"
|
||||
# via
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.9/darwin-crypto.txt requirements/static/ci/crypto.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.9/darwin-crypto.txt requirements/static/ci/crypto.in
|
||||
#
|
||||
m2crypto==0.38.0
|
||||
# via -r requirements/static/ci/crypto.in
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.9/darwin.txt requirements/darwin.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/darwin.in requirements/static/pkg/darwin.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.9/darwin.txt requirements/darwin.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/darwin.in requirements/static/pkg/darwin.in
|
||||
#
|
||||
aiohttp==3.8.1
|
||||
# via etcd3-py
|
||||
|
@ -205,6 +205,8 @@ jmespath==1.0.1
|
|||
# botocore
|
||||
jsonschema==3.2.0
|
||||
# via -r requirements/static/ci/common.in
|
||||
junit-xml==1.9
|
||||
# via -r requirements/static/ci/common.in
|
||||
junos-eznc==2.6.7 ; sys_platform != "win32"
|
||||
# via
|
||||
# -r requirements/static/ci/common.in
|
||||
|
@ -228,6 +230,7 @@ lxml==4.9.2
|
|||
# junos-eznc
|
||||
# napalm
|
||||
# ncclient
|
||||
# xmldiff
|
||||
mako==1.2.4
|
||||
# via -r requirements/static/ci/common.in
|
||||
markupsafe==2.1.2
|
||||
|
@ -469,6 +472,7 @@ six==1.16.0
|
|||
# geomet
|
||||
# google-auth
|
||||
# jsonschema
|
||||
# junit-xml
|
||||
# junos-eznc
|
||||
# kubernetes
|
||||
# mock
|
||||
|
@ -551,10 +555,14 @@ websocket-client==0.40.0
|
|||
# via
|
||||
# docker
|
||||
# kubernetes
|
||||
wempy==0.2.1
|
||||
# via -r requirements/static/ci/common.in
|
||||
werkzeug==2.2.3
|
||||
# via
|
||||
# moto
|
||||
# pytest-httpserver
|
||||
xmldiff==2.6.3
|
||||
# via -r requirements/static/ci/common.in
|
||||
xmltodict==0.12.0
|
||||
# via moto
|
||||
yamllint==1.32.0
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.9/docs.txt requirements/static/ci/docs.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.9/docs.txt requirements/static/ci/docs.in
|
||||
#
|
||||
alabaster==0.7.12
|
||||
# via sphinx
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.9/freebsd-crypto.txt requirements/static/ci/crypto.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.9/freebsd-crypto.txt requirements/static/ci/crypto.in
|
||||
#
|
||||
m2crypto==0.38.0
|
||||
# via -r requirements/static/ci/crypto.in
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.9/freebsd.txt requirements/base.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/freebsd.in requirements/static/pkg/freebsd.in requirements/zeromq.txt
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.9/freebsd.txt requirements/base.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/freebsd.in requirements/static/pkg/freebsd.in requirements/zeromq.txt
|
||||
#
|
||||
aiohttp==3.8.1
|
||||
# via etcd3-py
|
||||
|
@ -200,6 +200,8 @@ jmespath==1.0.1
|
|||
# botocore
|
||||
jsonschema==3.2.0
|
||||
# via -r requirements/static/ci/common.in
|
||||
junit-xml==1.9
|
||||
# via -r requirements/static/ci/common.in
|
||||
junos-eznc==2.6.7 ; sys_platform != "win32"
|
||||
# via
|
||||
# -r requirements/static/ci/common.in
|
||||
|
@ -223,6 +225,7 @@ lxml==4.9.2
|
|||
# junos-eznc
|
||||
# napalm
|
||||
# ncclient
|
||||
# xmldiff
|
||||
mako==1.2.4
|
||||
# via -r requirements/static/ci/common.in
|
||||
markupsafe==2.1.2
|
||||
|
@ -463,6 +466,7 @@ six==1.16.0
|
|||
# geomet
|
||||
# google-auth
|
||||
# jsonschema
|
||||
# junit-xml
|
||||
# junos-eznc
|
||||
# kazoo
|
||||
# kubernetes
|
||||
|
@ -540,10 +544,14 @@ websocket-client==0.40.0
|
|||
# via
|
||||
# docker
|
||||
# kubernetes
|
||||
wempy==0.2.1
|
||||
# via -r requirements/static/ci/common.in
|
||||
werkzeug==2.2.3
|
||||
# via
|
||||
# moto
|
||||
# pytest-httpserver
|
||||
xmldiff==2.6.3
|
||||
# via -r requirements/static/ci/common.in
|
||||
xmltodict==0.12.0
|
||||
# via moto
|
||||
yamllint==1.32.0
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.9/invoke.txt requirements/static/ci/invoke.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.9/invoke.txt requirements/static/ci/invoke.in
|
||||
#
|
||||
blessings==1.7
|
||||
# via -r requirements/static/ci/invoke.in
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.9/lint.txt requirements/static/ci/lint.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.9/lint.txt requirements/static/ci/lint.in
|
||||
#
|
||||
astroid==2.3.3
|
||||
# via pylint
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.9/linux-crypto.txt requirements/static/ci/crypto.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.9/linux-crypto.txt requirements/static/ci/crypto.in
|
||||
#
|
||||
m2crypto==0.38.0
|
||||
# via -r requirements/static/ci/crypto.in
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.9/linux.txt requirements/base.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/linux.in requirements/static/pkg/linux.in requirements/zeromq.txt
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.9/linux.txt requirements/base.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/linux.in requirements/static/pkg/linux.in requirements/zeromq.txt
|
||||
#
|
||||
aiohttp-retry==2.8.3
|
||||
# via twilio
|
||||
|
@ -227,6 +227,8 @@ jmespath==1.0.1
|
|||
# botocore
|
||||
jsonschema==3.2.0
|
||||
# via -r requirements/static/ci/common.in
|
||||
junit-xml==1.9
|
||||
# via -r requirements/static/ci/common.in
|
||||
junos-eznc==2.6.7 ; sys_platform != "win32"
|
||||
# via
|
||||
# -r requirements/static/ci/common.in
|
||||
|
@ -250,6 +252,7 @@ lxml==4.9.2
|
|||
# junos-eznc
|
||||
# napalm
|
||||
# ncclient
|
||||
# xmldiff
|
||||
mako==1.2.4
|
||||
# via -r requirements/static/ci/common.in
|
||||
markupsafe==2.1.2
|
||||
|
@ -516,6 +519,7 @@ six==1.16.0
|
|||
# geomet
|
||||
# google-auth
|
||||
# jsonschema
|
||||
# junit-xml
|
||||
# junos-eznc
|
||||
# kazoo
|
||||
# kubernetes
|
||||
|
@ -605,10 +609,14 @@ websocket-client==0.40.0
|
|||
# via
|
||||
# docker
|
||||
# kubernetes
|
||||
wempy==0.2.1
|
||||
# via -r requirements/static/ci/common.in
|
||||
werkzeug==2.2.3
|
||||
# via
|
||||
# moto
|
||||
# pytest-httpserver
|
||||
xmldiff==2.6.3
|
||||
# via -r requirements/static/ci/common.in
|
||||
xmltodict==0.12.0
|
||||
# via moto
|
||||
yamllint==1.32.0
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.9/tools.txt requirements/static/ci/tools.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.9/tools.txt requirements/static/ci/tools.in
|
||||
#
|
||||
attrs==22.1.0
|
||||
# via
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.9/windows-crypto.txt requirements/static/ci/crypto.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.9/windows-crypto.txt requirements/static/ci/crypto.in
|
||||
#
|
||||
m2crypto==0.38.0
|
||||
# via -r requirements/static/ci/crypto.in
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/ci/py3.9/windows.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/windows.in requirements/static/pkg/windows.in requirements/windows.txt
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/ci/py3.9/windows.txt requirements/pytest.txt requirements/static/ci/common.in requirements/static/ci/windows.in requirements/static/pkg/windows.in requirements/windows.txt
|
||||
#
|
||||
aiohttp==3.8.1
|
||||
# via etcd3-py
|
||||
|
@ -191,6 +191,8 @@ jmespath==1.0.1
|
|||
# botocore
|
||||
jsonschema==3.2.0
|
||||
# via -r requirements/static/ci/common.in
|
||||
junit-xml==1.9
|
||||
# via -r requirements/static/ci/common.in
|
||||
keyring==5.7.1
|
||||
# via -r requirements/static/ci/common.in
|
||||
kubernetes==3.0.0
|
||||
|
@ -203,6 +205,7 @@ lxml==4.9.2
|
|||
# via
|
||||
# -c requirements/static/ci/../pkg/py3.9/windows.txt
|
||||
# -r requirements/windows.txt
|
||||
# xmldiff
|
||||
mako==1.2.4
|
||||
# via -r requirements/static/ci/common.in
|
||||
markupsafe==2.1.2
|
||||
|
@ -424,6 +427,7 @@ six==1.15.0
|
|||
# geomet
|
||||
# google-auth
|
||||
# jsonschema
|
||||
# junit-xml
|
||||
# kubernetes
|
||||
# mock
|
||||
# python-dateutil
|
||||
|
@ -483,6 +487,8 @@ websocket-client==0.40.0
|
|||
# via
|
||||
# docker
|
||||
# kubernetes
|
||||
wempy==0.2.1
|
||||
# via -r requirements/static/ci/common.in
|
||||
werkzeug==2.2.3
|
||||
# via
|
||||
# moto
|
||||
|
@ -495,6 +501,8 @@ wmi==1.5.1
|
|||
# via
|
||||
# -c requirements/static/ci/../pkg/py3.9/windows.txt
|
||||
# -r requirements/windows.txt
|
||||
xmldiff==2.6.3
|
||||
# via -r requirements/static/ci/common.in
|
||||
xmltodict==0.12.0
|
||||
# via
|
||||
# moto
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/pkg/py3.10/darwin.txt requirements/darwin.txt requirements/static/pkg/darwin.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.10/darwin.txt requirements/darwin.txt requirements/static/pkg/darwin.in
|
||||
#
|
||||
apache-libcloud==3.7.0
|
||||
# via -r requirements/darwin.txt
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/pkg/py3.10/freebsd.txt requirements/base.txt requirements/static/pkg/freebsd.in requirements/zeromq.txt
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.10/freebsd.txt requirements/base.txt requirements/static/pkg/freebsd.in requirements/zeromq.txt
|
||||
#
|
||||
autocommand==2.2.2
|
||||
# via jaraco.text
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/pkg/py3.10/linux.txt requirements/base.txt requirements/static/pkg/linux.in requirements/zeromq.txt
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.10/linux.txt requirements/base.txt requirements/static/pkg/linux.in requirements/zeromq.txt
|
||||
#
|
||||
autocommand==2.2.2
|
||||
# via jaraco.text
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/pkg/py3.10/windows.txt requirements/static/pkg/windows.in requirements/windows.txt
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.10/windows.txt requirements/static/pkg/windows.in requirements/windows.txt
|
||||
#
|
||||
autocommand==2.2.2
|
||||
# via jaraco.text
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/pkg/py3.11/darwin.txt requirements/darwin.txt requirements/static/pkg/darwin.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.11/darwin.txt requirements/darwin.txt requirements/static/pkg/darwin.in
|
||||
#
|
||||
apache-libcloud==3.7.0
|
||||
# via -r requirements/darwin.txt
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/pkg/py3.11/linux.txt requirements/base.txt requirements/static/pkg/linux.in requirements/zeromq.txt
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.11/linux.txt requirements/base.txt requirements/static/pkg/linux.in requirements/zeromq.txt
|
||||
#
|
||||
autocommand==2.2.2
|
||||
# via jaraco.text
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/pkg/py3.8/freebsd.txt requirements/base.txt requirements/static/pkg/freebsd.in requirements/zeromq.txt
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.8/freebsd.txt requirements/base.txt requirements/static/pkg/freebsd.in requirements/zeromq.txt
|
||||
#
|
||||
autocommand==2.2.2
|
||||
# via jaraco.text
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/pkg/py3.8/linux.txt requirements/base.txt requirements/static/pkg/linux.in requirements/zeromq.txt
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.8/linux.txt requirements/base.txt requirements/static/pkg/linux.in requirements/zeromq.txt
|
||||
#
|
||||
autocommand==2.2.2
|
||||
# via jaraco.text
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/pkg/py3.8/windows.txt requirements/static/pkg/windows.in requirements/windows.txt
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.8/windows.txt requirements/static/pkg/windows.in requirements/windows.txt
|
||||
#
|
||||
autocommand==2.2.2
|
||||
# via jaraco.text
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/pkg/py3.9/darwin.txt requirements/darwin.txt requirements/static/pkg/darwin.in
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.9/darwin.txt requirements/darwin.txt requirements/static/pkg/darwin.in
|
||||
#
|
||||
apache-libcloud==3.7.0
|
||||
# via -r requirements/darwin.txt
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/pkg/py3.9/freebsd.txt requirements/base.txt requirements/static/pkg/freebsd.in requirements/zeromq.txt
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.9/freebsd.txt requirements/base.txt requirements/static/pkg/freebsd.in requirements/zeromq.txt
|
||||
#
|
||||
autocommand==2.2.2
|
||||
# via jaraco.text
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/pkg/py3.9/linux.txt requirements/base.txt requirements/static/pkg/linux.in requirements/zeromq.txt
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.9/linux.txt requirements/base.txt requirements/static/pkg/linux.in requirements/zeromq.txt
|
||||
#
|
||||
autocommand==2.2.2
|
||||
# via jaraco.text
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# This file is autogenerated by pip-compile
|
||||
# To update, run:
|
||||
#
|
||||
# pip-compile --output-file=requirements/static/pkg/py3.9/windows.txt requirements/static/pkg/windows.in requirements/windows.txt
|
||||
# pip-compile --no-emit-index-url --output-file=requirements/static/pkg/py3.9/windows.txt requirements/static/pkg/windows.in requirements/windows.txt
|
||||
#
|
||||
autocommand==2.2.2
|
||||
# via jaraco.text
|
||||
|
|
|
@ -87,7 +87,7 @@ class DeferredStreamHandler(StreamHandler):
|
|||
If anything goes wrong before logging is properly setup, all stored messages
|
||||
will be flushed to the handler's stream, ie, written to console.
|
||||
|
||||
.. versionadded:: 3005.0
|
||||
.. versionadded:: 3005
|
||||
"""
|
||||
|
||||
def __init__(self, stream, max_queue_size=10000):
|
||||
|
|
38
salt/cache/consul.py
vendored
38
salt/cache/consul.py
vendored
|
@ -3,7 +3,7 @@ Minion data cache plugin for Consul key/value data store.
|
|||
|
||||
.. versionadded:: 2016.11.2
|
||||
|
||||
.. versionchanged:: 3005.0
|
||||
.. versionchanged:: 3005
|
||||
|
||||
Timestamp/cache updated support added.
|
||||
|
||||
|
@ -119,33 +119,29 @@ def store(bank, key, data):
|
|||
"""
|
||||
Store a key value.
|
||||
"""
|
||||
c_key = "{}/{}".format(bank, key)
|
||||
tstamp_key = "{}/{}{}".format(bank, key, _tstamp_suffix)
|
||||
c_key = f"{bank}/{key}"
|
||||
tstamp_key = f"{bank}/{key}{_tstamp_suffix}"
|
||||
|
||||
try:
|
||||
c_data = salt.payload.dumps(data)
|
||||
api.kv.put(c_key, c_data)
|
||||
api.kv.put(tstamp_key, salt.payload.dumps(int(time.time())))
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise SaltCacheError(
|
||||
"There was an error writing the key, {}: {}".format(c_key, exc)
|
||||
)
|
||||
raise SaltCacheError(f"There was an error writing the key, {c_key}: {exc}")
|
||||
|
||||
|
||||
def fetch(bank, key):
|
||||
"""
|
||||
Fetch a key value.
|
||||
"""
|
||||
c_key = "{}/{}".format(bank, key)
|
||||
c_key = f"{bank}/{key}"
|
||||
try:
|
||||
_, value = api.kv.get(c_key)
|
||||
if value is None:
|
||||
return {}
|
||||
return salt.payload.loads(value["Value"])
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise SaltCacheError(
|
||||
"There was an error reading the key, {}: {}".format(c_key, exc)
|
||||
)
|
||||
raise SaltCacheError(f"There was an error reading the key, {c_key}: {exc}")
|
||||
|
||||
|
||||
def flush(bank, key=None):
|
||||
|
@ -156,16 +152,14 @@ def flush(bank, key=None):
|
|||
c_key = bank
|
||||
tstamp_key = None
|
||||
else:
|
||||
c_key = "{}/{}".format(bank, key)
|
||||
tstamp_key = "{}/{}{}".format(bank, key, _tstamp_suffix)
|
||||
c_key = f"{bank}/{key}"
|
||||
tstamp_key = f"{bank}/{key}{_tstamp_suffix}"
|
||||
try:
|
||||
if tstamp_key:
|
||||
api.kv.delete(tstamp_key)
|
||||
return api.kv.delete(c_key, recurse=key is None)
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise SaltCacheError(
|
||||
"There was an error removing the key, {}: {}".format(c_key, exc)
|
||||
)
|
||||
raise SaltCacheError(f"There was an error removing the key, {c_key}: {exc}")
|
||||
|
||||
|
||||
def list_(bank):
|
||||
|
@ -175,9 +169,7 @@ def list_(bank):
|
|||
try:
|
||||
_, keys = api.kv.get(bank + "/", keys=True, separator="/")
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise SaltCacheError(
|
||||
'There was an error getting the key "{}": {}'.format(bank, exc)
|
||||
)
|
||||
raise SaltCacheError(f'There was an error getting the key "{bank}": {exc}')
|
||||
if keys is None:
|
||||
keys = []
|
||||
else:
|
||||
|
@ -198,9 +190,7 @@ def contains(bank, key):
|
|||
c_key = "{}/{}".format(bank, key or "")
|
||||
_, value = api.kv.get(c_key, keys=True)
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise SaltCacheError(
|
||||
"There was an error getting the key, {}: {}".format(c_key, exc)
|
||||
)
|
||||
raise SaltCacheError(f"There was an error getting the key, {c_key}: {exc}")
|
||||
return value is not None
|
||||
|
||||
|
||||
|
@ -209,13 +199,11 @@ def updated(bank, key):
|
|||
Return the Unix Epoch timestamp of when the key was last updated. Return
|
||||
None if key is not found.
|
||||
"""
|
||||
c_key = "{}/{}{}".format(bank, key, _tstamp_suffix)
|
||||
c_key = f"{bank}/{key}{_tstamp_suffix}"
|
||||
try:
|
||||
_, value = api.kv.get(c_key)
|
||||
if value is None:
|
||||
return None
|
||||
return salt.payload.loads(value["Value"])
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise SaltCacheError(
|
||||
"There was an error reading the key, {}: {}".format(c_key, exc)
|
||||
)
|
||||
raise SaltCacheError(f"There was an error reading the key, {c_key}: {exc}")
|
||||
|
|
28
salt/cache/mysql_cache.py
vendored
28
salt/cache/mysql_cache.py
vendored
|
@ -33,6 +33,8 @@ could be set in the master config. These are the defaults:
|
|||
mysql.password: None
|
||||
mysql.database: salt_cache
|
||||
mysql.table_name: cache
|
||||
# This may be enabled to create a fresh connection on every call
|
||||
mysql.fresh_connection: false
|
||||
|
||||
Related docs can be found in the `python-mysql documentation`_.
|
||||
|
||||
|
@ -63,10 +65,17 @@ try:
|
|||
import MySQLdb.converters
|
||||
import MySQLdb.cursors
|
||||
from MySQLdb.connections import OperationalError
|
||||
|
||||
# Define the interface error as a subclass of exception
|
||||
# It will never be thrown/used, it is defined to support the pymysql error below
|
||||
class InterfaceError(Exception):
|
||||
pass
|
||||
|
||||
except ImportError:
|
||||
try:
|
||||
# MySQLdb import failed, try to import PyMySQL
|
||||
import pymysql
|
||||
from pymysql.err import InterfaceError
|
||||
|
||||
pymysql.install_as_MySQLdb()
|
||||
import MySQLdb
|
||||
|
@ -109,8 +118,12 @@ def run_query(conn, query, args=None, retries=3):
|
|||
Get a cursor and run a query. Reconnect up to ``retries`` times if
|
||||
needed.
|
||||
Returns: cursor, affected rows counter
|
||||
Raises: SaltCacheError, AttributeError, OperationalError
|
||||
Raises: SaltCacheError, AttributeError, OperationalError, InterfaceError
|
||||
"""
|
||||
if __context__.get("mysql_fresh_connection"):
|
||||
# Create a new connection if configured
|
||||
conn = MySQLdb.connect(**__context__["mysql_kwargs"])
|
||||
__context__["mysql_client"] = conn
|
||||
if conn is None:
|
||||
conn = __context__.get("mysql_client")
|
||||
try:
|
||||
|
@ -124,7 +137,7 @@ def run_query(conn, query, args=None, retries=3):
|
|||
out = cur.execute(query, args)
|
||||
|
||||
return cur, out
|
||||
except (AttributeError, OperationalError) as e:
|
||||
except (AttributeError, OperationalError, InterfaceError) as e:
|
||||
if retries == 0:
|
||||
raise
|
||||
# reconnect creating new client
|
||||
|
@ -144,9 +157,7 @@ def run_query(conn, query, args=None, retries=3):
|
|||
if len(query) > 150:
|
||||
query = query[:150] + "<...>"
|
||||
raise SaltCacheError(
|
||||
"Error running {}{}: {}".format(
|
||||
query, "- args: {}".format(args) if args else "", e
|
||||
)
|
||||
"Error running {}{}: {}".format(query, f"- args: {args}" if args else "", e)
|
||||
)
|
||||
|
||||
|
||||
|
@ -232,6 +243,7 @@ def _init_client():
|
|||
mysql_kwargs["autocommit"] = True
|
||||
|
||||
__context__["mysql_table_name"] = opts.pop("mysql.table_name", "salt")
|
||||
__context__["mysql_fresh_connection"] = opts.pop("mysql.fresh_connection", False)
|
||||
|
||||
# Gather up any additional MySQL configuration options
|
||||
for k in opts:
|
||||
|
@ -266,7 +278,7 @@ def store(bank, key, data):
|
|||
cur, cnt = run_query(__context__.get("mysql_client"), query, args=args)
|
||||
cur.close()
|
||||
if cnt not in (1, 2):
|
||||
raise SaltCacheError("Error storing {} {} returned {}".format(bank, key, cnt))
|
||||
raise SaltCacheError(f"Error storing {bank} {key} returned {cnt}")
|
||||
|
||||
|
||||
def fetch(bank, key):
|
||||
|
@ -297,7 +309,7 @@ def flush(bank, key=None):
|
|||
data = (bank, key)
|
||||
query += " AND etcd_key=%s"
|
||||
|
||||
cur, _ = run_query(__context__["mysql_client"], query, args=data)
|
||||
cur, _ = run_query(__context__.get("mysql_client"), query, args=data)
|
||||
cur.close()
|
||||
|
||||
|
||||
|
@ -348,7 +360,7 @@ def updated(bank, key):
|
|||
"AND etcd_key=%s".format(__context__["mysql_table_name"])
|
||||
)
|
||||
data = (bank, key)
|
||||
cur, _ = run_query(__context__["mysql_client"], query=query, args=data)
|
||||
cur, _ = run_query(__context__.get("mysql_client"), query=query, args=data)
|
||||
r = cur.fetchone()
|
||||
cur.close()
|
||||
return int(r[0]) if r else r
|
||||
|
|
|
@ -17,7 +17,7 @@ except ImportError:
|
|||
|
||||
def get(key, default="", merge=False, delimiter=DEFAULT_TARGET_DELIM):
|
||||
"""
|
||||
.. versionadded:: 0.14
|
||||
.. versionadded:: 0.14.0
|
||||
|
||||
Attempt to retrieve the named value from pillar, if the named value is not
|
||||
available return the passed default. The default return is an empty string.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
CenturyLink Cloud Module
|
||||
========================
|
||||
|
||||
.. versionadded:: 2018.3
|
||||
.. versionadded:: 2018.3.0
|
||||
|
||||
The CLC cloud module allows you to manage CLC Via the CLC SDK.
|
||||
|
||||
|
@ -421,7 +421,7 @@ def create(vm_):
|
|||
__utils__["cloud.fire_event"](
|
||||
"event",
|
||||
"waiting for ssh",
|
||||
"salt/cloud/{}/waiting_for_ssh".format(name),
|
||||
f"salt/cloud/{name}/waiting_for_ssh",
|
||||
sock_dir=__opts__["sock_dir"],
|
||||
args={"ip_address": vm_["ssh_host"]},
|
||||
transport=__opts__["transport"],
|
||||
|
|
|
@ -111,7 +111,7 @@ the desired command.
|
|||
.. code-block:: text
|
||||
|
||||
engines:
|
||||
- slack:
|
||||
- slack_bolt:
|
||||
app_token: "xapp-x-xxxxxxxxxxx-xxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
bot_token: 'xoxb-xxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx'
|
||||
control: True
|
||||
|
@ -149,7 +149,7 @@ must be quoted, or else PyYAML will fail to load the configuration.
|
|||
.. code-block:: text
|
||||
|
||||
engines:
|
||||
- slack:
|
||||
- slack_bolt:
|
||||
groups_pillar: slack_engine_pillar
|
||||
app_token: "xapp-x-xxxxxxxxxxx-xxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
|
||||
bot_token: 'xoxb-xxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxx'
|
||||
|
@ -234,7 +234,7 @@ class SlackClient:
|
|||
|
||||
self.msg_queue = collections.deque()
|
||||
|
||||
trigger_pattern = "(^{}.*)".format(trigger_string)
|
||||
trigger_pattern = f"(^{trigger_string}.*)"
|
||||
|
||||
# Register message_trigger when we see messages that start
|
||||
# with the trigger string
|
||||
|
@ -843,7 +843,7 @@ class SlackClient:
|
|||
results = {}
|
||||
for jid in outstanding_jids:
|
||||
# results[jid] = runner.cmd('jobs.lookup_jid', [jid])
|
||||
if self.master_minion.returners["{}.get_jid".format(source)](jid):
|
||||
if self.master_minion.returners[f"{source}.get_jid"](jid):
|
||||
job_result = runner.cmd("jobs.list_job", [jid])
|
||||
jid_result = job_result.get("Result", {})
|
||||
jid_function = job_result.get("Function", {})
|
||||
|
@ -954,7 +954,7 @@ class SlackClient:
|
|||
)
|
||||
ts = time.time()
|
||||
st = datetime.datetime.fromtimestamp(ts).strftime("%Y%m%d%H%M%S%f")
|
||||
filename = "salt-results-{}.yaml".format(st)
|
||||
filename = f"salt-results-{st}.yaml"
|
||||
resp = self.app.client.files_upload(
|
||||
channels=channel,
|
||||
filename=filename,
|
||||
|
@ -1075,4 +1075,4 @@ def start(
|
|||
)
|
||||
client.run_commands_from_slack_async(message_generator, fire_all, tag, control)
|
||||
except Exception: # pylint: disable=broad-except
|
||||
raise Exception("{}".format(traceback.format_exc()))
|
||||
raise Exception(f"{traceback.format_exc()}")
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Grains from cloud metadata servers at 169.254.169.254 in
|
||||
google compute engine
|
||||
|
||||
.. versionadded:: 3005.0
|
||||
.. versionadded:: 3005
|
||||
|
||||
:depends: requests
|
||||
|
||||
|
|
38
salt/key.py
38
salt/key.py
|
@ -177,7 +177,7 @@ class KeyCLI:
|
|||
|
||||
if cmd in ("accept", "reject", "delete") and args is None:
|
||||
args = self.opts.get("match_dict", {}).get("minions")
|
||||
fstr = "key.{}".format(cmd)
|
||||
fstr = f"key.{cmd}"
|
||||
fun = self.client.functions[fstr]
|
||||
args, kwargs = self._get_args_kwargs(fun, args)
|
||||
|
||||
|
@ -230,7 +230,7 @@ class KeyCLI:
|
|||
stat_str = statuses[0]
|
||||
else:
|
||||
stat_str = "{} or {}".format(", ".join(statuses[:-1]), statuses[-1])
|
||||
msg = "The key glob '{}' does not match any {} keys.".format(match, stat_str)
|
||||
msg = f"The key glob '{match}' does not match any {stat_str} keys."
|
||||
print(msg)
|
||||
|
||||
def run(self):
|
||||
|
@ -291,7 +291,7 @@ class KeyCLI:
|
|||
else:
|
||||
salt.output.display_output({"return": ret}, "key", opts=self.opts)
|
||||
except salt.exceptions.SaltException as exc:
|
||||
ret = "{}".format(exc)
|
||||
ret = f"{exc}"
|
||||
if not self.opts.get("quiet", False):
|
||||
salt.output.display_output(ret, "nested", self.opts)
|
||||
return ret
|
||||
|
@ -311,7 +311,7 @@ class Key:
|
|||
self.opts = opts
|
||||
kind = self.opts.get("__role", "") # application kind
|
||||
if kind not in salt.utils.kinds.APPL_KINDS:
|
||||
emsg = "Invalid application kind = '{}'.".format(kind)
|
||||
emsg = f"Invalid application kind = '{kind}'."
|
||||
log.error(emsg)
|
||||
raise ValueError(emsg)
|
||||
self.event = salt.utils.event.get_event(
|
||||
|
@ -377,7 +377,7 @@ class Key:
|
|||
# check given pub-key
|
||||
if pub:
|
||||
if not os.path.isfile(pub):
|
||||
return "Public-key {} does not exist".format(pub)
|
||||
return f"Public-key {pub} does not exist"
|
||||
# default to master.pub
|
||||
else:
|
||||
mpub = self.opts["pki_dir"] + "/" + "master.pub"
|
||||
|
@ -387,7 +387,7 @@ class Key:
|
|||
# check given priv-key
|
||||
if priv:
|
||||
if not os.path.isfile(priv):
|
||||
return "Private-key {} does not exist".format(priv)
|
||||
return f"Private-key {priv} does not exist"
|
||||
# default to master_sign.pem
|
||||
else:
|
||||
mpriv = self.opts["pki_dir"] + "/" + "master_sign.pem"
|
||||
|
@ -467,7 +467,7 @@ class Key:
|
|||
if clist:
|
||||
for minion in clist:
|
||||
if minion not in minions and minion not in preserve_minions:
|
||||
cache.flush("{}/{}".format(self.ACC, minion))
|
||||
cache.flush(f"{self.ACC}/{minion}")
|
||||
|
||||
def check_master(self):
|
||||
"""
|
||||
|
@ -528,8 +528,7 @@ class Key:
|
|||
for fn_ in salt.utils.data.sorted_ignorecase(os.listdir(self.opts["pki_dir"])):
|
||||
if fn_.endswith(".pub") or fn_.endswith(".pem"):
|
||||
path = os.path.join(self.opts["pki_dir"], fn_)
|
||||
if os.path.isfile(path):
|
||||
ret["local"].append(fn_)
|
||||
ret["local"].append(fn_)
|
||||
return ret
|
||||
|
||||
def list_keys(self):
|
||||
|
@ -547,10 +546,9 @@ class Key:
|
|||
try:
|
||||
for fn_ in salt.utils.data.sorted_ignorecase(os.listdir(dir_)):
|
||||
if not fn_.startswith("."):
|
||||
if os.path.isfile(os.path.join(dir_, fn_)):
|
||||
ret[os.path.basename(dir_)].append(
|
||||
salt.utils.stringutils.to_unicode(fn_)
|
||||
)
|
||||
ret[os.path.basename(dir_)].append(
|
||||
salt.utils.stringutils.to_unicode(fn_)
|
||||
)
|
||||
except OSError:
|
||||
# key dir kind is not created yet, just skip
|
||||
continue
|
||||
|
@ -574,26 +572,22 @@ class Key:
|
|||
ret[os.path.basename(acc)] = []
|
||||
for fn_ in salt.utils.data.sorted_ignorecase(os.listdir(acc)):
|
||||
if not fn_.startswith("."):
|
||||
if os.path.isfile(os.path.join(acc, fn_)):
|
||||
ret[os.path.basename(acc)].append(fn_)
|
||||
ret[os.path.basename(acc)].append(fn_)
|
||||
elif match.startswith("pre") or match.startswith("un"):
|
||||
ret[os.path.basename(pre)] = []
|
||||
for fn_ in salt.utils.data.sorted_ignorecase(os.listdir(pre)):
|
||||
if not fn_.startswith("."):
|
||||
if os.path.isfile(os.path.join(pre, fn_)):
|
||||
ret[os.path.basename(pre)].append(fn_)
|
||||
ret[os.path.basename(pre)].append(fn_)
|
||||
elif match.startswith("rej"):
|
||||
ret[os.path.basename(rej)] = []
|
||||
for fn_ in salt.utils.data.sorted_ignorecase(os.listdir(rej)):
|
||||
if not fn_.startswith("."):
|
||||
if os.path.isfile(os.path.join(rej, fn_)):
|
||||
ret[os.path.basename(rej)].append(fn_)
|
||||
ret[os.path.basename(rej)].append(fn_)
|
||||
elif match.startswith("den") and den is not None:
|
||||
ret[os.path.basename(den)] = []
|
||||
for fn_ in salt.utils.data.sorted_ignorecase(os.listdir(den)):
|
||||
if not fn_.startswith("."):
|
||||
if os.path.isfile(os.path.join(den, fn_)):
|
||||
ret[os.path.basename(den)].append(fn_)
|
||||
ret[os.path.basename(den)].append(fn_)
|
||||
elif match.startswith("all"):
|
||||
return self.all_keys()
|
||||
return ret
|
||||
|
@ -663,7 +657,7 @@ class Key:
|
|||
pass
|
||||
for keydir, key in invalid_keys:
|
||||
matches[keydir].remove(key)
|
||||
sys.stderr.write("Unable to accept invalid key for {}.\n".format(key))
|
||||
sys.stderr.write(f"Unable to accept invalid key for {key}.\n")
|
||||
return self.name_match(match) if match is not None else self.dict_match(matches)
|
||||
|
||||
def accept_all(self):
|
||||
|
|
|
@ -158,7 +158,7 @@ class SMaster:
|
|||
if "serial" in secret_map:
|
||||
secret_map["serial"].value = 0
|
||||
if event:
|
||||
event.fire_event({"rotate_{}_key".format(secret_key): True}, tag="key")
|
||||
event.fire_event({f"rotate_{secret_key}_key": True}, tag="key")
|
||||
|
||||
if opts.get("ping_on_rotate"):
|
||||
# Ping all minions to get them to pick up the new key
|
||||
|
@ -290,9 +290,7 @@ class Maintenance(salt.utils.process.SignalHandlingProcess):
|
|||
acc = "accepted"
|
||||
|
||||
for fn_ in os.listdir(os.path.join(self.opts["pki_dir"], acc)):
|
||||
if not fn_.startswith(".") and os.path.isfile(
|
||||
os.path.join(self.opts["pki_dir"], acc, fn_)
|
||||
):
|
||||
if not fn_.startswith("."):
|
||||
keys.append(fn_)
|
||||
log.debug("Writing master key cache")
|
||||
# Write a temporary file securely
|
||||
|
@ -399,7 +397,7 @@ class FileserverUpdate(salt.utils.process.SignalHandlingProcess):
|
|||
update_intervals = self.fileserver.update_intervals()
|
||||
self.buckets = {}
|
||||
for backend in self.fileserver.backends():
|
||||
fstr = "{}.update".format(backend)
|
||||
fstr = f"{backend}.update"
|
||||
try:
|
||||
update_func = self.fileserver.servers[fstr]
|
||||
except KeyError:
|
||||
|
@ -429,7 +427,7 @@ class FileserverUpdate(salt.utils.process.SignalHandlingProcess):
|
|||
# nothing to pass to the backend's update func, so we'll just
|
||||
# set the value to None.
|
||||
try:
|
||||
interval_key = "{}_update_interval".format(backend)
|
||||
interval_key = f"{backend}_update_interval"
|
||||
interval = self.opts[interval_key]
|
||||
except KeyError:
|
||||
interval = DEFAULT_INTERVAL
|
||||
|
@ -606,7 +604,7 @@ class Master(SMaster):
|
|||
try:
|
||||
os.chdir("/")
|
||||
except OSError as err:
|
||||
errors.append("Cannot change to root directory ({})".format(err))
|
||||
errors.append(f"Cannot change to root directory ({err})")
|
||||
|
||||
if self.opts.get("fileserver_verify_config", True):
|
||||
# Avoid circular import
|
||||
|
@ -624,7 +622,7 @@ class Master(SMaster):
|
|||
try:
|
||||
fileserver.init()
|
||||
except salt.exceptions.FileserverConfigError as exc:
|
||||
critical_errors.append("{}".format(exc))
|
||||
critical_errors.append(f"{exc}")
|
||||
|
||||
if not self.opts["fileserver_backend"]:
|
||||
errors.append("No fileserver backends are configured")
|
||||
|
@ -769,7 +767,7 @@ class Master(SMaster):
|
|||
cls = proc.split(".")[-1]
|
||||
_tmp = __import__(mod, globals(), locals(), [cls], -1)
|
||||
cls = _tmp.__getattribute__(cls)
|
||||
name = "ExtProcess({})".format(cls.__qualname__)
|
||||
name = f"ExtProcess({cls.__qualname__})"
|
||||
self.process_manager.add_process(cls, args=(self.opts,), name=name)
|
||||
except Exception: # pylint: disable=broad-except
|
||||
log.error("Error creating ext_processes process: %s", proc)
|
||||
|
@ -909,7 +907,7 @@ class ReqServer(salt.utils.process.SignalHandlingProcess):
|
|||
# signal handlers
|
||||
with salt.utils.process.default_signals(signal.SIGINT, signal.SIGTERM):
|
||||
for ind in range(int(self.opts["worker_threads"])):
|
||||
name = "MWorker-{}".format(ind)
|
||||
name = f"MWorker-{ind}"
|
||||
self.process_manager.add_process(
|
||||
MWorker,
|
||||
args=(self.opts, self.master_key, self.key, req_channels),
|
||||
|
@ -2107,7 +2105,7 @@ class ClearFuncs(TransportMethods):
|
|||
fun = clear_load.pop("fun")
|
||||
tag = tagify(jid, prefix="wheel")
|
||||
data = {
|
||||
"fun": "wheel.{}".format(fun),
|
||||
"fun": f"wheel.{fun}",
|
||||
"jid": jid,
|
||||
"tag": tag,
|
||||
"user": username,
|
||||
|
@ -2210,7 +2208,7 @@ class ClearFuncs(TransportMethods):
|
|||
else:
|
||||
auth_list = auth_check.get("auth_list", [])
|
||||
|
||||
err_msg = 'Authentication failure of type "{}" occurred.'.format(auth_type)
|
||||
err_msg = f'Authentication failure of type "{auth_type}" occurred.'
|
||||
|
||||
if auth_check.get("error"):
|
||||
# Authentication error occurred: do not continue.
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
ACME / Let's Encrypt module
|
||||
===========================
|
||||
|
||||
.. versionadded:: 2016.3
|
||||
.. versionadded:: 2016.3.0
|
||||
|
||||
This module currently looks for certbot script in the $PATH as
|
||||
- certbot,
|
||||
|
@ -72,7 +72,7 @@ def _cert_file(name, cert_type):
|
|||
"""
|
||||
Return expected path of a Let's Encrypt live cert
|
||||
"""
|
||||
return os.path.join(LE_LIVE, name, "{}.pem".format(cert_type))
|
||||
return os.path.join(LE_LIVE, name, f"{cert_type}.pem")
|
||||
|
||||
|
||||
def _expires(name):
|
||||
|
@ -88,9 +88,9 @@ def _expires(name):
|
|||
expiry = __salt__["tls.cert_info"](cert_file).get("not_after", 0)
|
||||
# Cobble it together using the openssl binary
|
||||
else:
|
||||
openssl_cmd = "openssl x509 -in {} -noout -enddate".format(cert_file)
|
||||
openssl_cmd = f"openssl x509 -in {cert_file} -noout -enddate"
|
||||
# No %e format on my Linux'es here
|
||||
strptime_sux_cmd = 'date --date="$({} | cut -d= -f2)" +%s'.format(openssl_cmd)
|
||||
strptime_sux_cmd = f'date --date="$({openssl_cmd} | cut -d= -f2)" +%s'
|
||||
expiry = float(__salt__["cmd.shell"](strptime_sux_cmd, output_loglevel="quiet"))
|
||||
# expiry = datetime.datetime.strptime(expiry.split('=', 1)[-1], '%b %e %H:%M:%S %Y %Z')
|
||||
return datetime.datetime.fromtimestamp(expiry)
|
||||
|
@ -195,10 +195,10 @@ def cert(
|
|||
cmd.append("--renew-by-default")
|
||||
renew = True
|
||||
if server:
|
||||
cmd.append("--server {}".format(server))
|
||||
cmd.append(f"--server {server}")
|
||||
|
||||
if certname:
|
||||
cmd.append("--cert-name {}".format(certname))
|
||||
cmd.append(f"--cert-name {certname}")
|
||||
|
||||
if test_cert:
|
||||
if server:
|
||||
|
@ -211,41 +211,41 @@ def cert(
|
|||
if webroot:
|
||||
cmd.append("--authenticator webroot")
|
||||
if webroot is not True:
|
||||
cmd.append("--webroot-path {}".format(webroot))
|
||||
cmd.append(f"--webroot-path {webroot}")
|
||||
elif dns_plugin in supported_dns_plugins:
|
||||
if dns_plugin == "cloudflare":
|
||||
cmd.append("--dns-cloudflare")
|
||||
cmd.append("--dns-cloudflare-credentials {}".format(dns_plugin_credentials))
|
||||
cmd.append(f"--dns-cloudflare-credentials {dns_plugin_credentials}")
|
||||
else:
|
||||
return {
|
||||
"result": False,
|
||||
"comment": "DNS plugin '{}' is not supported".format(dns_plugin),
|
||||
"comment": f"DNS plugin '{dns_plugin}' is not supported",
|
||||
}
|
||||
else:
|
||||
cmd.append("--authenticator standalone")
|
||||
|
||||
if email:
|
||||
cmd.append("--email {}".format(email))
|
||||
cmd.append(f"--email {email}")
|
||||
|
||||
if keysize:
|
||||
cmd.append("--rsa-key-size {}".format(keysize))
|
||||
cmd.append(f"--rsa-key-size {keysize}")
|
||||
|
||||
cmd.append("--domains {}".format(name))
|
||||
cmd.append(f"--domains {name}")
|
||||
if aliases is not None:
|
||||
for dns in aliases:
|
||||
cmd.append("--domains {}".format(dns))
|
||||
cmd.append(f"--domains {dns}")
|
||||
|
||||
if preferred_challenges:
|
||||
cmd.append("--preferred-challenges {}".format(preferred_challenges))
|
||||
cmd.append(f"--preferred-challenges {preferred_challenges}")
|
||||
|
||||
if tls_sni_01_port:
|
||||
cmd.append("--tls-sni-01-port {}".format(tls_sni_01_port))
|
||||
cmd.append(f"--tls-sni-01-port {tls_sni_01_port}")
|
||||
if tls_sni_01_address:
|
||||
cmd.append("--tls-sni-01-address {}".format(tls_sni_01_address))
|
||||
cmd.append(f"--tls-sni-01-address {tls_sni_01_address}")
|
||||
if http_01_port:
|
||||
cmd.append("--http-01-port {}".format(http_01_port))
|
||||
cmd.append(f"--http-01-port {http_01_port}")
|
||||
if http_01_address:
|
||||
cmd.append("--http-01-address {}".format(http_01_address))
|
||||
cmd.append(f"--http-01-address {http_01_address}")
|
||||
|
||||
res = __salt__["cmd.run_all"](" ".join(cmd))
|
||||
|
||||
|
@ -269,13 +269,13 @@ def cert(
|
|||
}
|
||||
|
||||
if "no action taken" in res["stdout"]:
|
||||
comment = "Certificate {} unchanged".format(cert_file)
|
||||
comment = f"Certificate {cert_file} unchanged"
|
||||
result = None
|
||||
elif renew:
|
||||
comment = "Certificate {} renewed".format(certname)
|
||||
comment = f"Certificate {certname} renewed"
|
||||
result = True
|
||||
else:
|
||||
comment = "Certificate {} obtained".format(certname)
|
||||
comment = f"Certificate {certname} obtained"
|
||||
result = True
|
||||
|
||||
ret = {
|
||||
|
@ -339,7 +339,7 @@ def info(name):
|
|||
cert_info = __salt__["x509.read_certificate"](cert_file)
|
||||
else:
|
||||
# Cobble it together using the openssl binary
|
||||
openssl_cmd = "openssl x509 -in {} -noout -text".format(cert_file)
|
||||
openssl_cmd = f"openssl x509 -in {cert_file} -noout -text"
|
||||
cert_info = {"text": __salt__["cmd.run"](openssl_cmd, output_loglevel="quiet")}
|
||||
return cert_info
|
||||
|
||||
|
|
|
@ -207,14 +207,14 @@ if not HAS_APT:
|
|||
if self.architectures:
|
||||
opts.append("arch={}".format(",".join(self.architectures)))
|
||||
if self.signedby:
|
||||
opts.append("signed-by={}".format(self.signedby))
|
||||
opts.append(f"signed-by={self.signedby}")
|
||||
|
||||
if opts:
|
||||
repo_line.append("[{}]".format(" ".join(opts)))
|
||||
|
||||
repo_line = repo_line + [self.uri, self.dist, " ".join(self.comps)]
|
||||
if self.comment:
|
||||
repo_line.append("#{}".format(self.comment))
|
||||
repo_line.append(f"#{self.comment}")
|
||||
return " ".join(repo_line) + "\n"
|
||||
|
||||
def _parse_sources(self, line):
|
||||
|
@ -277,7 +277,7 @@ if not HAS_APT:
|
|||
architectures = "arch={}".format(",".join(architectures))
|
||||
opts_count.append(architectures)
|
||||
if signedby:
|
||||
signedby = "signed-by={}".format(signedby)
|
||||
signedby = f"signed-by={signedby}"
|
||||
opts_count.append(signedby)
|
||||
if len(opts_count) > 1:
|
||||
opts_line = "[" + " ".join(opts_count) + "]"
|
||||
|
@ -340,7 +340,7 @@ def _reconstruct_ppa_name(owner_name, ppa_name):
|
|||
"""
|
||||
Stringify PPA name from args.
|
||||
"""
|
||||
return "ppa:{}/{}".format(owner_name, ppa_name)
|
||||
return f"ppa:{owner_name}/{ppa_name}"
|
||||
|
||||
|
||||
def _call_apt(args, scope=True, **kwargs):
|
||||
|
@ -353,7 +353,7 @@ def _call_apt(args, scope=True, **kwargs):
|
|||
and salt.utils.systemd.has_scope(__context__)
|
||||
and __salt__["config.get"]("systemd.scope", True)
|
||||
):
|
||||
cmd.extend(["systemd-run", "--scope", "--description", '"{}"'.format(__name__)])
|
||||
cmd.extend(["systemd-run", "--scope", "--description", f'"{__name__}"'])
|
||||
cmd.extend(args)
|
||||
|
||||
params = {
|
||||
|
@ -465,7 +465,7 @@ def latest_version(*names, **kwargs):
|
|||
for name in names:
|
||||
ret[name] = ""
|
||||
pkgs = list_pkgs(versions_as_list=True)
|
||||
repo = ["-o", "APT::Default-Release={}".format(fromrepo)] if fromrepo else None
|
||||
repo = ["-o", f"APT::Default-Release={fromrepo}"] if fromrepo else None
|
||||
|
||||
# Refresh before looking for the latest version available
|
||||
if refresh:
|
||||
|
@ -942,7 +942,7 @@ def install(
|
|||
continue
|
||||
else:
|
||||
version_num = target
|
||||
pkgstr = "{}={}".format(pkgname, version_num)
|
||||
pkgstr = f"{pkgname}={version_num}"
|
||||
else:
|
||||
pkgstr = pkgpath
|
||||
|
||||
|
@ -1318,7 +1318,7 @@ def upgrade(refresh=True, dist_upgrade=False, **kwargs):
|
|||
]
|
||||
for option in dpkg_options:
|
||||
cmd.append("-o")
|
||||
cmd.append("DPkg::Options::={}".format(option))
|
||||
cmd.append(f"DPkg::Options::={option}")
|
||||
|
||||
if kwargs.get("force_yes", False):
|
||||
cmd.append("--force-yes")
|
||||
|
@ -1391,15 +1391,15 @@ def hold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W0613
|
|||
|
||||
state = get_selections(pattern=target, state="hold")
|
||||
if not state:
|
||||
ret[target]["comment"] = "Package {} not currently held.".format(target)
|
||||
ret[target]["comment"] = f"Package {target} not currently held."
|
||||
elif not salt.utils.data.is_true(state.get("hold", False)):
|
||||
if "test" in __opts__ and __opts__["test"]:
|
||||
ret[target].update(result=None)
|
||||
ret[target]["comment"] = "Package {} is set to be held.".format(target)
|
||||
ret[target]["comment"] = f"Package {target} is set to be held."
|
||||
else:
|
||||
result = set_selections(selection={"hold": [target]})
|
||||
ret[target].update(changes=result[target], result=True)
|
||||
ret[target]["comment"] = "Package {} is now being held.".format(target)
|
||||
ret[target]["comment"] = f"Package {target} is now being held."
|
||||
else:
|
||||
ret[target].update(result=True)
|
||||
ret[target]["comment"] = "Package {} is already set to be held.".format(
|
||||
|
@ -1456,7 +1456,7 @@ def unhold(name=None, pkgs=None, sources=None, **kwargs): # pylint: disable=W06
|
|||
|
||||
state = get_selections(pattern=target)
|
||||
if not state:
|
||||
ret[target]["comment"] = "Package {} does not have a state.".format(target)
|
||||
ret[target]["comment"] = f"Package {target} does not have a state."
|
||||
elif salt.utils.data.is_true(state.get("hold", False)):
|
||||
if "test" in __opts__ and __opts__["test"]:
|
||||
ret[target].update(result=None)
|
||||
|
@ -1552,7 +1552,7 @@ def list_pkgs(
|
|||
if __grains__.get("cpuarch", "") == "x86_64":
|
||||
osarch = __grains__.get("osarch", "")
|
||||
if arch != "all" and osarch == "amd64" and osarch != arch:
|
||||
name += ":{}".format(arch)
|
||||
name += f":{arch}"
|
||||
if cols:
|
||||
if ("install" in linetype or "hold" in linetype) and "installed" in status:
|
||||
__salt__["pkg_resource.add_pkg"](ret["installed"], name, version_num)
|
||||
|
@ -1780,7 +1780,7 @@ def _consolidate_repo_sources(sources):
|
|||
Consolidate APT sources.
|
||||
"""
|
||||
if not isinstance(sources, SourcesList):
|
||||
raise TypeError("'{}' not a '{}'".format(type(sources), SourcesList))
|
||||
raise TypeError(f"'{type(sources)}' not a '{SourcesList}'")
|
||||
|
||||
consolidated = {}
|
||||
delete_files = set()
|
||||
|
@ -1961,7 +1961,7 @@ def get_repo(repo, **kwargs):
|
|||
dist = __grains__["oscodename"]
|
||||
owner_name, ppa_name = repo[4:].split("/")
|
||||
if ppa_auth:
|
||||
auth_info = "{}@".format(ppa_auth)
|
||||
auth_info = f"{ppa_auth}@"
|
||||
repo = LP_PVT_SRC_FORMAT.format(auth_info, owner_name, ppa_name, dist)
|
||||
else:
|
||||
if HAS_SOFTWAREPROPERTIES:
|
||||
|
@ -1974,7 +1974,7 @@ def get_repo(repo, **kwargs):
|
|||
repo = softwareproperties.ppa.expand_ppa_line(repo, dist)[0]
|
||||
except NameError as name_error:
|
||||
raise CommandExecutionError(
|
||||
"Could not find ppa {}: {}".format(repo, name_error)
|
||||
f"Could not find ppa {repo}: {name_error}"
|
||||
)
|
||||
else:
|
||||
repo = LP_SRC_FORMAT.format(owner_name, ppa_name, dist)
|
||||
|
@ -2000,7 +2000,7 @@ def get_repo(repo, **kwargs):
|
|||
)
|
||||
except SyntaxError:
|
||||
raise CommandExecutionError(
|
||||
"Error: repo '{}' is not a well formatted definition".format(repo)
|
||||
f"Error: repo '{repo}' is not a well formatted definition"
|
||||
)
|
||||
|
||||
for source in repos.values():
|
||||
|
@ -2070,7 +2070,7 @@ def del_repo(repo, **kwargs):
|
|||
) = _split_repo_str(repo)
|
||||
except SyntaxError:
|
||||
raise SaltInvocationError(
|
||||
"Error: repo '{}' not a well formatted definition".format(repo)
|
||||
f"Error: repo '{repo}' not a well formatted definition"
|
||||
)
|
||||
|
||||
for source in repos:
|
||||
|
@ -2132,9 +2132,7 @@ def del_repo(repo, **kwargs):
|
|||
refresh_db()
|
||||
return ret
|
||||
|
||||
raise CommandExecutionError(
|
||||
"Repo {} doesn't exist in the sources.list(s)".format(repo)
|
||||
)
|
||||
raise CommandExecutionError(f"Repo {repo} doesn't exist in the sources.list(s)")
|
||||
|
||||
|
||||
def _convert_if_int(value):
|
||||
|
@ -2427,11 +2425,11 @@ def add_repo_key(
|
|||
else:
|
||||
cmd.extend(["adv", "--batch", "--keyserver", keyserver, "--recv", keyid])
|
||||
elif keyid:
|
||||
error_msg = "No keyserver specified for keyid: {}".format(keyid)
|
||||
error_msg = f"No keyserver specified for keyid: {keyid}"
|
||||
raise SaltInvocationError(error_msg)
|
||||
else:
|
||||
raise TypeError(
|
||||
"{}() takes at least 1 argument (0 given)".format(add_repo_key.__name__)
|
||||
f"{add_repo_key.__name__}() takes at least 1 argument (0 given)"
|
||||
)
|
||||
|
||||
cmd_ret = _call_apt(cmd, **kwargs)
|
||||
|
@ -2731,7 +2729,7 @@ def mod_repo(repo, saltenv="base", aptkey=True, **kwargs):
|
|||
repo = LP_SRC_FORMAT.format(owner_name, ppa_name, dist)
|
||||
else:
|
||||
raise CommandExecutionError(
|
||||
'cannot parse "ppa:" style repo definitions: {}'.format(repo)
|
||||
f'cannot parse "ppa:" style repo definitions: {repo}'
|
||||
)
|
||||
|
||||
sources = SourcesList()
|
||||
|
@ -2769,9 +2767,7 @@ def mod_repo(repo, saltenv="base", aptkey=True, **kwargs):
|
|||
repo_signedby,
|
||||
) = _split_repo_str(repo)
|
||||
except SyntaxError:
|
||||
raise SyntaxError(
|
||||
"Error: repo '{}' not a well formatted definition".format(repo)
|
||||
)
|
||||
raise SyntaxError(f"Error: repo '{repo}' not a well formatted definition")
|
||||
|
||||
full_comp_list = {comp.strip() for comp in repo_comps}
|
||||
no_proxy = __salt__["config.option"]("no_proxy")
|
||||
|
@ -2813,7 +2809,7 @@ def mod_repo(repo, saltenv="base", aptkey=True, **kwargs):
|
|||
"adv",
|
||||
"--batch",
|
||||
"--keyserver-options",
|
||||
"http-proxy={}".format(http_proxy_url),
|
||||
f"http-proxy={http_proxy_url}",
|
||||
"--keyserver",
|
||||
keyserver,
|
||||
"--logger-fd",
|
||||
|
@ -2859,7 +2855,7 @@ def mod_repo(repo, saltenv="base", aptkey=True, **kwargs):
|
|||
key_url = kwargs["key_url"]
|
||||
fn_ = pathlib.Path(__salt__["cp.cache_file"](key_url, saltenv))
|
||||
if not fn_:
|
||||
raise CommandExecutionError("Error: file not found: {}".format(key_url))
|
||||
raise CommandExecutionError(f"Error: file not found: {key_url}")
|
||||
|
||||
if kwargs["signedby"] and fn_.name != kwargs["signedby"].name:
|
||||
# override the signedby defined in the name with the
|
||||
|
@ -2879,9 +2875,7 @@ def mod_repo(repo, saltenv="base", aptkey=True, **kwargs):
|
|||
cmd = ["apt-key", "add", str(fn_)]
|
||||
out = __salt__["cmd.run_stdout"](cmd, python_shell=False, **kwargs)
|
||||
if not out.upper().startswith("OK"):
|
||||
raise CommandExecutionError(
|
||||
"Error: failed to add key from {}".format(key_url)
|
||||
)
|
||||
raise CommandExecutionError(f"Error: failed to add key from {key_url}")
|
||||
|
||||
elif "key_text" in kwargs:
|
||||
key_text = kwargs["key_text"]
|
||||
|
@ -2890,9 +2884,7 @@ def mod_repo(repo, saltenv="base", aptkey=True, **kwargs):
|
|||
cmd, stdin=key_text, python_shell=False, **kwargs
|
||||
)
|
||||
if not out.upper().startswith("OK"):
|
||||
raise CommandExecutionError(
|
||||
"Error: failed to add key:\n{}".format(key_text)
|
||||
)
|
||||
raise CommandExecutionError(f"Error: failed to add key:\n{key_text}")
|
||||
|
||||
if "comps" in kwargs:
|
||||
kwargs["comps"] = [comp.strip() for comp in kwargs["comps"].split(",")]
|
||||
|
@ -3276,7 +3268,7 @@ def set_selections(path=None, selection=None, clear=False, saltenv="base"):
|
|||
salt.utils.yaml.parser.ParserError,
|
||||
salt.utils.yaml.scanner.ScannerError,
|
||||
) as exc:
|
||||
raise SaltInvocationError("Improperly-formatted selection: {}".format(exc))
|
||||
raise SaltInvocationError(f"Improperly-formatted selection: {exc}")
|
||||
|
||||
if path:
|
||||
path = __salt__["cp.cache_file"](path, saltenv)
|
||||
|
@ -3312,7 +3304,7 @@ def set_selections(path=None, selection=None, clear=False, saltenv="base"):
|
|||
if _state == sel_revmap.get(_pkg):
|
||||
continue
|
||||
cmd = ["dpkg", "--set-selections"]
|
||||
cmd_in = "{} {}".format(_pkg, _state)
|
||||
cmd_in = f"{_pkg} {_state}"
|
||||
if not __opts__["test"]:
|
||||
result = _call_apt(cmd, scope=False, stdin=cmd_in)
|
||||
if result["retcode"] != 0:
|
||||
|
@ -3508,16 +3500,16 @@ def _get_http_proxy_url():
|
|||
# Set http_proxy_url for use in various internet facing actions...eg apt-key adv
|
||||
if host and port:
|
||||
if username and password:
|
||||
http_proxy_url = "http://{}:{}@{}:{}".format(username, password, host, port)
|
||||
http_proxy_url = f"http://{username}:{password}@{host}:{port}"
|
||||
else:
|
||||
http_proxy_url = "http://{}:{}".format(host, port)
|
||||
http_proxy_url = f"http://{host}:{port}"
|
||||
|
||||
return http_proxy_url
|
||||
|
||||
|
||||
def list_downloaded(root=None, **kwargs):
|
||||
"""
|
||||
.. versionadded:: 3000?
|
||||
.. versionadded:: 3000
|
||||
|
||||
List prefetched packages downloaded by apt in the local disk.
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ def _config_getter(
|
|||
password=None,
|
||||
ignore_retcode=False,
|
||||
output_encoding=None,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
):
|
||||
"""
|
||||
Common code for config.get_* functions, builds and runs the git CLI command
|
||||
|
@ -224,7 +224,7 @@ def _git_run(
|
|||
redirect_stderr=False,
|
||||
saltenv="base",
|
||||
output_encoding=None,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
):
|
||||
"""
|
||||
simple, throw an exception with the error message on an error return code.
|
||||
|
@ -323,7 +323,7 @@ def _git_run(
|
|||
ignore_retcode=ignore_retcode,
|
||||
redirect_stderr=redirect_stderr,
|
||||
output_encoding=output_encoding,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
)
|
||||
finally:
|
||||
if tmp_ssh_wrapper:
|
||||
|
@ -390,7 +390,7 @@ def _git_run(
|
|||
ignore_retcode=ignore_retcode,
|
||||
redirect_stderr=redirect_stderr,
|
||||
output_encoding=output_encoding,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
if result["retcode"] == 0:
|
||||
|
@ -403,7 +403,7 @@ def _git_run(
|
|||
)
|
||||
err = result["stdout" if redirect_stderr else "stderr"]
|
||||
if err:
|
||||
msg += ": {}".format(salt.utils.url.redact_http_basic_auth(err))
|
||||
msg += f": {salt.utils.url.redact_http_basic_auth(err)}"
|
||||
raise CommandExecutionError(msg)
|
||||
return result
|
||||
|
||||
|
@ -564,7 +564,7 @@ def archive(
|
|||
password=None,
|
||||
ignore_retcode=False,
|
||||
output_encoding=None,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
):
|
||||
"""
|
||||
.. versionchanged:: 2015.8.0
|
||||
|
@ -1019,7 +1019,7 @@ def clone(
|
|||
https_user
|
||||
Set HTTP Basic Auth username. Only accepted for HTTPS URLs.
|
||||
|
||||
.. versionadded:: 20515.5.0
|
||||
.. versionadded:: 2015.5.0
|
||||
|
||||
https_pass
|
||||
Set HTTP Basic Auth password. Only accepted for HTTPS URLs.
|
||||
|
@ -1215,7 +1215,7 @@ def config_get(
|
|||
password=None,
|
||||
ignore_retcode=False,
|
||||
output_encoding=None,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
):
|
||||
"""
|
||||
Get the value of a key in the git configuration file
|
||||
|
@ -1293,7 +1293,7 @@ def config_get(
|
|||
password=password,
|
||||
ignore_retcode=ignore_retcode,
|
||||
output_encoding=output_encoding,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
# git config --get exits with retcode of 1 when key does not exist
|
||||
|
@ -1318,7 +1318,7 @@ def config_get_regexp(
|
|||
password=None,
|
||||
ignore_retcode=False,
|
||||
output_encoding=None,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
):
|
||||
r"""
|
||||
.. versionadded:: 2015.8.0
|
||||
|
@ -1395,7 +1395,7 @@ def config_get_regexp(
|
|||
password=password,
|
||||
ignore_retcode=ignore_retcode,
|
||||
output_encoding=output_encoding,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
# git config --get exits with retcode of 1 when key does not exist
|
||||
|
@ -1425,7 +1425,7 @@ def config_set(
|
|||
password=None,
|
||||
ignore_retcode=False,
|
||||
output_encoding=None,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
):
|
||||
"""
|
||||
.. versionchanged:: 2015.8.0
|
||||
|
@ -1574,7 +1574,7 @@ def config_set(
|
|||
cwd=cwd,
|
||||
ignore_retcode=ignore_retcode,
|
||||
output_encoding=output_encoding,
|
||||
**{"all": True, "global": global_}
|
||||
**{"all": True, "global": global_},
|
||||
)
|
||||
|
||||
|
||||
|
@ -1586,7 +1586,7 @@ def config_unset(
|
|||
password=None,
|
||||
ignore_retcode=False,
|
||||
output_encoding=None,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
):
|
||||
"""
|
||||
.. versionadded:: 2015.8.0
|
||||
|
@ -1695,9 +1695,9 @@ def config_unset(
|
|||
)
|
||||
is None
|
||||
):
|
||||
raise CommandExecutionError("Key '{}' does not exist".format(key))
|
||||
raise CommandExecutionError(f"Key '{key}' does not exist")
|
||||
else:
|
||||
msg = "Multiple values exist for key '{}'".format(key)
|
||||
msg = f"Multiple values exist for key '{key}'"
|
||||
if value_regex is not None:
|
||||
msg += " and value_regex matches multiple values"
|
||||
raise CommandExecutionError(msg)
|
||||
|
@ -2355,9 +2355,9 @@ def init(
|
|||
if bare:
|
||||
command.append("--bare")
|
||||
if template is not None:
|
||||
command.append("--template={}".format(template))
|
||||
command.append(f"--template={template}")
|
||||
if separate_git_dir is not None:
|
||||
command.append("--separate-git-dir={}".format(separate_git_dir))
|
||||
command.append(f"--separate-git-dir={separate_git_dir}")
|
||||
if shared is not None:
|
||||
if isinstance(shared, int) and not isinstance(shared, bool):
|
||||
shared = "0" + str(shared)
|
||||
|
@ -2365,7 +2365,7 @@ def init(
|
|||
# Using lower here because booleans would be capitalized when
|
||||
# converted to a string.
|
||||
shared = str(shared).lower()
|
||||
command.append("--shared={}".format(shared))
|
||||
command.append(f"--shared={shared}")
|
||||
command.extend(_format_opts(opts))
|
||||
command.append(cwd)
|
||||
return _git_run(
|
||||
|
@ -2814,7 +2814,7 @@ def list_worktrees(
|
|||
worktree_root = os.path.join(cwd, worktree_root)
|
||||
if not os.path.isdir(worktree_root):
|
||||
raise CommandExecutionError(
|
||||
"Worktree admin directory {} not present".format(worktree_root)
|
||||
f"Worktree admin directory {worktree_root} not present"
|
||||
)
|
||||
|
||||
def _read_file(path):
|
||||
|
@ -3081,7 +3081,7 @@ def merge(
|
|||
identity=None,
|
||||
ignore_retcode=False,
|
||||
output_encoding=None,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
):
|
||||
"""
|
||||
Interface to `git-merge(1)`_
|
||||
|
@ -3205,7 +3205,7 @@ def merge_base(
|
|||
password=None,
|
||||
ignore_retcode=False,
|
||||
output_encoding=None,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
):
|
||||
"""
|
||||
.. versionadded:: 2015.8.0
|
||||
|
@ -3487,7 +3487,7 @@ def merge_tree(
|
|||
base = merge_base(cwd, refs=[ref1, ref2], output_encoding=output_encoding)
|
||||
except (SaltInvocationError, CommandExecutionError):
|
||||
raise CommandExecutionError(
|
||||
"Unable to determine merge base for {} and {}".format(ref1, ref2)
|
||||
f"Unable to determine merge base for {ref1} and {ref2}"
|
||||
)
|
||||
command.extend([base, ref1, ref2])
|
||||
return _git_run(
|
||||
|
@ -3627,7 +3627,7 @@ def push(
|
|||
ignore_retcode=False,
|
||||
saltenv="base",
|
||||
output_encoding=None,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
):
|
||||
"""
|
||||
Interface to `git-push(1)`_
|
||||
|
@ -3927,7 +3927,7 @@ def remote_get(
|
|||
)
|
||||
if remote not in all_remotes:
|
||||
raise CommandExecutionError(
|
||||
"Remote '{}' not present in git checkout located at {}".format(remote, cwd)
|
||||
f"Remote '{remote}' not present in git checkout located at {cwd}"
|
||||
)
|
||||
return all_remotes[remote]
|
||||
|
||||
|
@ -3944,7 +3944,7 @@ def remote_refs(
|
|||
ignore_retcode=False,
|
||||
output_encoding=None,
|
||||
saltenv="base",
|
||||
**kwargs
|
||||
**kwargs,
|
||||
):
|
||||
"""
|
||||
.. versionadded:: 2015.8.0
|
||||
|
@ -4850,7 +4850,7 @@ def submodule(
|
|||
ignore_retcode=False,
|
||||
saltenv="base",
|
||||
output_encoding=None,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
):
|
||||
"""
|
||||
.. versionchanged:: 2015.8.0
|
||||
|
@ -5290,7 +5290,7 @@ def worktree_add(
|
|||
password=None,
|
||||
ignore_retcode=False,
|
||||
output_encoding=None,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
):
|
||||
"""
|
||||
.. versionadded:: 2015.8.0
|
||||
|
@ -5602,5 +5602,5 @@ def worktree_rm(cwd, user=None, output_encoding=None):
|
|||
try:
|
||||
salt.utils.files.rm_rf(cwd)
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise CommandExecutionError("Unable to remove {}: {}".format(cwd, exc))
|
||||
raise CommandExecutionError(f"Unable to remove {cwd}: {exc}")
|
||||
return True
|
||||
|
|
|
@ -119,7 +119,7 @@ def version():
|
|||
ver = Version(cversion["stdout"])
|
||||
if ver < Version("1.0"):
|
||||
raise CommandExecutionError("LXC should be at least 1.0")
|
||||
__context__[k] = "{}".format(ver)
|
||||
__context__[k] = f"{ver}"
|
||||
return __context__.get(k, None)
|
||||
|
||||
|
||||
|
@ -141,7 +141,7 @@ def _ip_sort(ip):
|
|||
idx = "201"
|
||||
elif "::" in ip:
|
||||
idx = "100"
|
||||
return "{}___{}".format(idx, ip)
|
||||
return f"{idx}___{ip}"
|
||||
|
||||
|
||||
def search_lxc_bridges():
|
||||
|
@ -173,7 +173,7 @@ def search_lxc_bridges():
|
|||
for ifc, ip in __grains__.get("ip_interfaces", {}).items():
|
||||
if ifc in running_bridges:
|
||||
bridges.add(ifc)
|
||||
elif os.path.exists("/sys/devices/virtual/net/{}/bridge".format(ifc)):
|
||||
elif os.path.exists(f"/sys/devices/virtual/net/{ifc}/bridge"):
|
||||
bridges.add(ifc)
|
||||
bridges = list(bridges)
|
||||
# if we found interfaces that have lxc in their names
|
||||
|
@ -186,7 +186,7 @@ def search_lxc_bridges():
|
|||
pref = "a"
|
||||
elif "br0" == a:
|
||||
pref = "c"
|
||||
return "{}_{}".format(pref, a)
|
||||
return f"{pref}_{a}"
|
||||
|
||||
bridges.sort(key=sort_bridges)
|
||||
__context__["lxc.bridges"] = bridges
|
||||
|
@ -439,12 +439,12 @@ def cloud_init_interface(name, vm_=None, **kwargs):
|
|||
if ip:
|
||||
fullip = ip
|
||||
if netmask:
|
||||
fullip += "/{}".format(netmask)
|
||||
fullip += f"/{netmask}"
|
||||
eth0["ipv4"] = fullip
|
||||
if mac is not None:
|
||||
eth0["mac"] = mac
|
||||
for ix, iopts in enumerate(_cloud_get("additional_ips", [])):
|
||||
ifh = "eth{}".format(ix + 1)
|
||||
ifh = f"eth{ix + 1}"
|
||||
ethx = nic_opts.setdefault(ifh, {})
|
||||
if gw is None:
|
||||
gw = iopts.get("gateway", ethx.get("gateway", None))
|
||||
|
@ -465,7 +465,7 @@ def cloud_init_interface(name, vm_=None, **kwargs):
|
|||
ethx["ipv4"] = aip
|
||||
nm = iopts.get("netmask", "")
|
||||
if nm:
|
||||
ethx["ipv4"] += "/{}".format(nm)
|
||||
ethx["ipv4"] += f"/{nm}"
|
||||
for i in ("mac", "hwaddr"):
|
||||
if i in iopts:
|
||||
ethx["mac"] = iopts[i]
|
||||
|
@ -543,7 +543,7 @@ def _get_profile(key, name, **kwargs):
|
|||
profile_match = {}
|
||||
else:
|
||||
profile_match = __salt__["config.get"](
|
||||
"lxc.{1}:{0}".format(name, key), default=None, merge="recurse"
|
||||
f"lxc.{key}:{name}", default=None, merge="recurse"
|
||||
)
|
||||
if profile_match is None:
|
||||
# No matching profile, make the profile an empty dict so that
|
||||
|
@ -551,7 +551,7 @@ def _get_profile(key, name, **kwargs):
|
|||
profile_match = {}
|
||||
|
||||
if not isinstance(profile_match, dict):
|
||||
raise CommandExecutionError("lxc.{} must be a dictionary".format(key))
|
||||
raise CommandExecutionError(f"lxc.{key} must be a dictionary")
|
||||
|
||||
# Overlay the kwargs to override matched profile data
|
||||
overrides = salt.utils.args.clean_kwargs(**copy.deepcopy(kwargs))
|
||||
|
@ -669,7 +669,7 @@ def _rand_cpu_str(cpu):
|
|||
cpu = int(cpu)
|
||||
avail = __salt__["status.nproc"]()
|
||||
if cpu < avail:
|
||||
return "0-{}".format(avail)
|
||||
return f"0-{avail}"
|
||||
to_set = set()
|
||||
while len(to_set) < cpu:
|
||||
choice = random.randint(0, avail - 1)
|
||||
|
@ -832,7 +832,7 @@ def _network_conf(conf_tuples=None, **kwargs):
|
|||
"ipv6",
|
||||
]:
|
||||
continue
|
||||
ret.append({"lxc.network.{}".format(key): val})
|
||||
ret.append({f"lxc.network.{key}": val})
|
||||
# gateway (in automode) must be appended following network conf !
|
||||
if not gateway:
|
||||
gateway = args.get("gateway", None)
|
||||
|
@ -892,7 +892,7 @@ def _get_lxc_default_data(**kwargs):
|
|||
for k in ["utsname", "rootfs"]:
|
||||
val = kwargs.get(k, None)
|
||||
if val is not None:
|
||||
ret["lxc.{}".format(k)] = val
|
||||
ret[f"lxc.{k}"] = val
|
||||
autostart = kwargs.get("autostart")
|
||||
# autostart can have made in kwargs, but with the None
|
||||
# value which is invalid, we need an explicit boolean
|
||||
|
@ -1115,7 +1115,7 @@ def _get_base(**kwargs):
|
|||
hash_ = salt.utils.hashutils.get_hash(
|
||||
img_tar, __salt__["config.get"]("hash_type")
|
||||
)
|
||||
name = "__base_{}_{}_{}".format(proto, img_name, hash_)
|
||||
name = f"__base_{proto}_{img_name}_{hash_}"
|
||||
if not exists(name, path=path):
|
||||
create(
|
||||
name, template=template, image=image, path=path, vgname=vgname, **kwargs
|
||||
|
@ -1125,11 +1125,11 @@ def _get_base(**kwargs):
|
|||
edit_conf(
|
||||
info(name, path=path)["config"],
|
||||
out_format="commented",
|
||||
**{"lxc.rootfs": rootfs}
|
||||
**{"lxc.rootfs": rootfs},
|
||||
)
|
||||
return name
|
||||
elif template:
|
||||
name = "__base_{}".format(template)
|
||||
name = f"__base_{template}"
|
||||
if not exists(name, path=path):
|
||||
create(
|
||||
name, template=template, image=image, path=path, vgname=vgname, **kwargs
|
||||
|
@ -1139,7 +1139,7 @@ def _get_base(**kwargs):
|
|||
edit_conf(
|
||||
info(name, path=path)["config"],
|
||||
out_format="commented",
|
||||
**{"lxc.rootfs": rootfs}
|
||||
**{"lxc.rootfs": rootfs},
|
||||
)
|
||||
return name
|
||||
return ""
|
||||
|
@ -1171,7 +1171,7 @@ def init(
|
|||
bootstrap_args=None,
|
||||
bootstrap_shell=None,
|
||||
bootstrap_url=None,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
):
|
||||
"""
|
||||
Initialize a new container.
|
||||
|
@ -1499,7 +1499,7 @@ def init(
|
|||
try:
|
||||
stop(name, path=path)
|
||||
except (SaltInvocationError, CommandExecutionError) as exc:
|
||||
ret["comment"] = "Unable to stop container: {}".format(exc)
|
||||
ret["comment"] = f"Unable to stop container: {exc}"
|
||||
if changes:
|
||||
ret["changes"] = changes_dict
|
||||
return ret
|
||||
|
@ -1507,7 +1507,7 @@ def init(
|
|||
try:
|
||||
start(name, path=path)
|
||||
except (SaltInvocationError, CommandExecutionError) as exc:
|
||||
ret["comment"] = "Unable to stop container: {}".format(exc)
|
||||
ret["comment"] = f"Unable to stop container: {exc}"
|
||||
if changes:
|
||||
ret["changes"] = changes_dict
|
||||
return ret
|
||||
|
@ -1515,7 +1515,7 @@ def init(
|
|||
if remove_seed_marker:
|
||||
run(
|
||||
name,
|
||||
"rm -f '{}'".format(SEED_MARKER),
|
||||
f"rm -f '{SEED_MARKER}'",
|
||||
path=path,
|
||||
chroot_fallback=False,
|
||||
python_shell=False,
|
||||
|
@ -1524,11 +1524,11 @@ def init(
|
|||
# set the default user/password, only the first time
|
||||
if ret.get("result", True) and password:
|
||||
gid = "/.lxc.initial_pass"
|
||||
gids = [gid, "/lxc.initial_pass", "/.lxc.{}.initial_pass".format(name)]
|
||||
gids = [gid, "/lxc.initial_pass", f"/.lxc.{name}.initial_pass"]
|
||||
if not any(
|
||||
retcode(
|
||||
name,
|
||||
'test -e "{}"'.format(x),
|
||||
f'test -e "{x}"',
|
||||
chroot_fallback=True,
|
||||
path=path,
|
||||
ignore_retcode=True,
|
||||
|
@ -1544,7 +1544,7 @@ def init(
|
|||
default_user not in users
|
||||
and retcode(
|
||||
name,
|
||||
"id {}".format(default_user),
|
||||
f"id {default_user}",
|
||||
python_shell=False,
|
||||
path=path,
|
||||
chroot_fallback=True,
|
||||
|
@ -1563,7 +1563,7 @@ def init(
|
|||
encrypted=password_encrypted,
|
||||
)
|
||||
except (SaltInvocationError, CommandExecutionError) as exc:
|
||||
msg = "{}: Failed to set password".format(user) + exc.strerror
|
||||
msg = f"{user}: Failed to set password" + exc.strerror
|
||||
# only hardfail in unrecoverable situation:
|
||||
# root cannot be setted up
|
||||
if user == "root":
|
||||
|
@ -1591,11 +1591,11 @@ def init(
|
|||
if ret.get("result", True) and dnsservers:
|
||||
# retro compatibility, test also old markers
|
||||
gid = "/.lxc.initial_dns"
|
||||
gids = [gid, "/lxc.initial_dns", "/lxc.{}.initial_dns".format(name)]
|
||||
gids = [gid, "/lxc.initial_dns", f"/lxc.{name}.initial_dns"]
|
||||
if not any(
|
||||
retcode(
|
||||
name,
|
||||
'test -e "{}"'.format(x),
|
||||
f'test -e "{x}"',
|
||||
chroot_fallback=True,
|
||||
path=path,
|
||||
ignore_retcode=True,
|
||||
|
@ -1628,13 +1628,13 @@ def init(
|
|||
|
||||
# retro compatibility, test also old markers
|
||||
if remove_seed_marker:
|
||||
run(name, "rm -f '{}'".format(SEED_MARKER), path=path, python_shell=False)
|
||||
run(name, f"rm -f '{SEED_MARKER}'", path=path, python_shell=False)
|
||||
gid = "/.lxc.initial_seed"
|
||||
gids = [gid, "/lxc.initial_seed"]
|
||||
if any(
|
||||
retcode(
|
||||
name,
|
||||
"test -e {}".format(x),
|
||||
f"test -e {x}",
|
||||
path=path,
|
||||
chroot_fallback=True,
|
||||
ignore_retcode=True,
|
||||
|
@ -1703,7 +1703,7 @@ def init(
|
|||
try:
|
||||
stop(name, path=path)
|
||||
except (SaltInvocationError, CommandExecutionError) as exc:
|
||||
ret["comment"] = "Unable to stop container: {}".format(exc)
|
||||
ret["comment"] = f"Unable to stop container: {exc}"
|
||||
ret["result"] = False
|
||||
|
||||
state_post = state(name, path=path)
|
||||
|
@ -1711,7 +1711,7 @@ def init(
|
|||
changes.append({"state": {"old": state_pre, "new": state_post}})
|
||||
|
||||
if ret.get("result", True):
|
||||
ret["comment"] = "Container '{}' successfully initialized".format(name)
|
||||
ret["comment"] = f"Container '{name}' successfully initialized"
|
||||
ret["result"] = True
|
||||
if changes:
|
||||
ret["changes"] = changes_dict
|
||||
|
@ -1834,8 +1834,8 @@ def _after_ignition_network_profile(cmd, ret, name, network_profile, path, nic_o
|
|||
# destroy the container if it was partially created
|
||||
cmd = "lxc-destroy"
|
||||
if path:
|
||||
cmd += " -P {}".format(pipes.quote(path))
|
||||
cmd += " -n {}".format(name)
|
||||
cmd += f" -P {pipes.quote(path)}"
|
||||
cmd += f" -n {name}"
|
||||
__salt__["cmd.retcode"](cmd, python_shell=False)
|
||||
raise CommandExecutionError(
|
||||
"Container could not be created with cmd '{}': {}".format(
|
||||
|
@ -1943,7 +1943,7 @@ def create(
|
|||
# Required params for 'download' template
|
||||
download_template_deps = ("dist", "release", "arch")
|
||||
|
||||
cmd = "lxc-create -n {}".format(name)
|
||||
cmd = f"lxc-create -n {name}"
|
||||
|
||||
profile = get_container_profile(copy.deepcopy(profile))
|
||||
kw_overrides = copy.deepcopy(kwargs)
|
||||
|
@ -1959,7 +1959,7 @@ def create(
|
|||
|
||||
path = select("path")
|
||||
if exists(name, path=path):
|
||||
raise CommandExecutionError("Container '{}' already exists".format(name))
|
||||
raise CommandExecutionError(f"Container '{name}' already exists")
|
||||
|
||||
tvg = select("vgname")
|
||||
vgname = tvg if tvg else __salt__["config.get"]("lxc.vgname")
|
||||
|
@ -1997,31 +1997,31 @@ def create(
|
|||
)
|
||||
options["imgtar"] = img_tar
|
||||
if path:
|
||||
cmd += " -P {}".format(pipes.quote(path))
|
||||
cmd += f" -P {pipes.quote(path)}"
|
||||
if not os.path.exists(path):
|
||||
os.makedirs(path)
|
||||
if config:
|
||||
cmd += " -f {}".format(config)
|
||||
cmd += f" -f {config}"
|
||||
if template:
|
||||
cmd += " -t {}".format(template)
|
||||
cmd += f" -t {template}"
|
||||
if backing:
|
||||
backing = backing.lower()
|
||||
cmd += " -B {}".format(backing)
|
||||
cmd += f" -B {backing}"
|
||||
if backing in ("zfs",):
|
||||
if zfsroot:
|
||||
cmd += " --zfsroot {}".format(zfsroot)
|
||||
cmd += f" --zfsroot {zfsroot}"
|
||||
if backing in ("lvm",):
|
||||
if lvname:
|
||||
cmd += " --lvname {}".format(lvname)
|
||||
cmd += f" --lvname {lvname}"
|
||||
if vgname:
|
||||
cmd += " --vgname {}".format(vgname)
|
||||
cmd += f" --vgname {vgname}"
|
||||
if thinpool:
|
||||
cmd += " --thinpool {}".format(thinpool)
|
||||
cmd += f" --thinpool {thinpool}"
|
||||
if backing not in ("dir", "overlayfs"):
|
||||
if fstype:
|
||||
cmd += " --fstype {}".format(fstype)
|
||||
cmd += f" --fstype {fstype}"
|
||||
if size:
|
||||
cmd += " --fssize {}".format(size)
|
||||
cmd += f" --fssize {size}"
|
||||
|
||||
if options:
|
||||
if template == "download":
|
||||
|
@ -2034,7 +2034,7 @@ def create(
|
|||
)
|
||||
cmd += " --"
|
||||
for key, val in options.items():
|
||||
cmd += " --{} {}".format(key, val)
|
||||
cmd += f" --{key} {val}"
|
||||
|
||||
ret = __salt__["cmd.run_all"](cmd, python_shell=False)
|
||||
# please do not merge extra conflicting stuff
|
||||
|
@ -2108,13 +2108,11 @@ def clone(name, orig, profile=None, network_profile=None, nic_opts=None, **kwarg
|
|||
|
||||
path = select("path")
|
||||
if exists(name, path=path):
|
||||
raise CommandExecutionError("Container '{}' already exists".format(name))
|
||||
raise CommandExecutionError(f"Container '{name}' already exists")
|
||||
|
||||
_ensure_exists(orig, path=path)
|
||||
if state(orig, path=path) != "stopped":
|
||||
raise CommandExecutionError(
|
||||
"Container '{}' must be stopped to be cloned".format(orig)
|
||||
)
|
||||
raise CommandExecutionError(f"Container '{orig}' must be stopped to be cloned")
|
||||
|
||||
backing = select("backing")
|
||||
snapshot = select("snapshot")
|
||||
|
@ -2132,21 +2130,21 @@ def clone(name, orig, profile=None, network_profile=None, nic_opts=None, **kwarg
|
|||
if Version(version()) >= Version("2.0"):
|
||||
# https://linuxcontainers.org/lxc/manpages//man1/lxc-copy.1.html
|
||||
cmd = "lxc-copy"
|
||||
cmd += " {} -n {} -N {}".format(snapshot, orig, name)
|
||||
cmd += f" {snapshot} -n {orig} -N {name}"
|
||||
else:
|
||||
# https://linuxcontainers.org/lxc/manpages//man1/lxc-clone.1.html
|
||||
cmd = "lxc-clone"
|
||||
cmd += " {} -o {} -n {}".format(snapshot, orig, name)
|
||||
cmd += f" {snapshot} -o {orig} -n {name}"
|
||||
if path:
|
||||
cmd += " -P {}".format(pipes.quote(path))
|
||||
cmd += f" -P {pipes.quote(path)}"
|
||||
if not os.path.exists(path):
|
||||
os.makedirs(path)
|
||||
if backing:
|
||||
backing = backing.lower()
|
||||
cmd += " -B {}".format(backing)
|
||||
cmd += f" -B {backing}"
|
||||
if backing not in ("dir", "overlayfs"):
|
||||
if size:
|
||||
cmd += " -L {}".format(size)
|
||||
cmd += f" -L {size}"
|
||||
ret = __salt__["cmd.run_all"](cmd, python_shell=False)
|
||||
# please do not merge extra conflicting stuff
|
||||
# inside those two line (ret =, return)
|
||||
|
@ -2177,7 +2175,7 @@ def ls_(active=None, cache=True, path=None):
|
|||
salt '*' lxc.ls
|
||||
salt '*' lxc.ls active=True
|
||||
"""
|
||||
contextvar = "lxc.ls{}".format(path)
|
||||
contextvar = f"lxc.ls{path}"
|
||||
if active:
|
||||
contextvar += ".active"
|
||||
if cache and (contextvar in __context__):
|
||||
|
@ -2186,7 +2184,7 @@ def ls_(active=None, cache=True, path=None):
|
|||
ret = []
|
||||
cmd = "lxc-ls"
|
||||
if path:
|
||||
cmd += " -P {}".format(pipes.quote(path))
|
||||
cmd += f" -P {pipes.quote(path)}"
|
||||
if active:
|
||||
cmd += " --active"
|
||||
output = __salt__["cmd.run_stdout"](cmd, python_shell=False)
|
||||
|
@ -2242,8 +2240,8 @@ def list_(extra=False, limit=None, path=None):
|
|||
for container in ctnrs:
|
||||
cmd = "lxc-info"
|
||||
if path:
|
||||
cmd += " -P {}".format(pipes.quote(path))
|
||||
cmd += " -n {}".format(container)
|
||||
cmd += f" -P {pipes.quote(path)}"
|
||||
cmd += f" -n {container}"
|
||||
c_info = __salt__["cmd.run"](cmd, python_shell=False, output_loglevel="debug")
|
||||
c_state = None
|
||||
for line in c_info.splitlines():
|
||||
|
@ -2294,20 +2292,20 @@ def _change_state(
|
|||
return {
|
||||
"result": True,
|
||||
"state": {"old": expected, "new": expected},
|
||||
"comment": "Container '{}' already {}".format(name, expected),
|
||||
"comment": f"Container '{name}' already {expected}",
|
||||
}
|
||||
|
||||
if cmd == "lxc-destroy":
|
||||
# Kill the container first
|
||||
scmd = "lxc-stop"
|
||||
if path:
|
||||
scmd += " -P {}".format(pipes.quote(path))
|
||||
scmd += " -k -n {}".format(name)
|
||||
scmd += f" -P {pipes.quote(path)}"
|
||||
scmd += f" -k -n {name}"
|
||||
__salt__["cmd.run"](scmd, python_shell=False)
|
||||
|
||||
if path and " -P " not in cmd:
|
||||
cmd += " -P {}".format(pipes.quote(path))
|
||||
cmd += " -n {}".format(name)
|
||||
cmd += f" -P {pipes.quote(path)}"
|
||||
cmd += f" -n {name}"
|
||||
|
||||
# certain lxc commands need to be taken with care (lxc-start)
|
||||
# as te command itself mess with double forks; we must not
|
||||
|
@ -2337,8 +2335,8 @@ def _change_state(
|
|||
# some commands do not wait, so we will
|
||||
rcmd = "lxc-wait"
|
||||
if path:
|
||||
rcmd += " -P {}".format(pipes.quote(path))
|
||||
rcmd += " -n {} -s {}".format(name, expected.upper())
|
||||
rcmd += f" -P {pipes.quote(path)}"
|
||||
rcmd += f" -n {name} -s {expected.upper()}"
|
||||
__salt__["cmd.run"](rcmd, python_shell=False, timeout=30)
|
||||
_clear_context()
|
||||
post = state(name, path=path)
|
||||
|
@ -2351,7 +2349,7 @@ def _ensure_exists(name, path=None):
|
|||
Raise an exception if the container does not exist
|
||||
"""
|
||||
if not exists(name, path=path):
|
||||
raise CommandExecutionError("Container '{}' does not exist".format(name))
|
||||
raise CommandExecutionError(f"Container '{name}' does not exist")
|
||||
|
||||
|
||||
def _ensure_running(name, no_start=False, path=None):
|
||||
|
@ -2373,11 +2371,11 @@ def _ensure_running(name, no_start=False, path=None):
|
|||
return start(name, path=path)
|
||||
elif pre == "stopped":
|
||||
if no_start:
|
||||
raise CommandExecutionError("Container '{}' is not running".format(name))
|
||||
raise CommandExecutionError(f"Container '{name}' is not running")
|
||||
return start(name, path=path)
|
||||
elif pre == "frozen":
|
||||
if no_start:
|
||||
raise CommandExecutionError("Container '{}' is not running".format(name))
|
||||
raise CommandExecutionError(f"Container '{name}' is not running")
|
||||
return unfreeze(name, path=path)
|
||||
|
||||
|
||||
|
@ -2459,13 +2457,11 @@ def start(name, **kwargs):
|
|||
lxc_config = os.path.join(cpath, name, "config")
|
||||
# we try to start, even without config, if global opts are there
|
||||
if os.path.exists(lxc_config):
|
||||
cmd += " -f {}".format(pipes.quote(lxc_config))
|
||||
cmd += f" -f {pipes.quote(lxc_config)}"
|
||||
cmd += " -d"
|
||||
_ensure_exists(name, path=path)
|
||||
if state(name, path=path) == "frozen":
|
||||
raise CommandExecutionError(
|
||||
"Container '{}' is frozen, use lxc.unfreeze".format(name)
|
||||
)
|
||||
raise CommandExecutionError(f"Container '{name}' is frozen, use lxc.unfreeze")
|
||||
# lxc-start daemonize itself violently, we must not communicate with it
|
||||
use_vt = kwargs.get("use_vt", None)
|
||||
with_communicate = kwargs.get("with_communicate", False)
|
||||
|
@ -2560,11 +2556,11 @@ def freeze(name, **kwargs):
|
|||
start_ = kwargs.get("start", False)
|
||||
if orig_state == "stopped":
|
||||
if not start_:
|
||||
raise CommandExecutionError("Container '{}' is stopped".format(name))
|
||||
raise CommandExecutionError(f"Container '{name}' is stopped")
|
||||
start(name, path=path)
|
||||
cmd = "lxc-freeze"
|
||||
if path:
|
||||
cmd += " -P {}".format(pipes.quote(path))
|
||||
cmd += f" -P {pipes.quote(path)}"
|
||||
ret = _change_state(cmd, name, "frozen", use_vt=use_vt, path=path)
|
||||
if orig_state == "stopped" and start_:
|
||||
ret["state"]["old"] = orig_state
|
||||
|
@ -2596,10 +2592,10 @@ def unfreeze(name, path=None, use_vt=None):
|
|||
"""
|
||||
_ensure_exists(name, path=path)
|
||||
if state(name, path=path) == "stopped":
|
||||
raise CommandExecutionError("Container '{}' is stopped".format(name))
|
||||
raise CommandExecutionError(f"Container '{name}' is stopped")
|
||||
cmd = "lxc-unfreeze"
|
||||
if path:
|
||||
cmd += " -P {}".format(pipes.quote(path))
|
||||
cmd += f" -P {pipes.quote(path)}"
|
||||
return _change_state(cmd, name, "running", path=path, use_vt=use_vt)
|
||||
|
||||
|
||||
|
@ -2635,7 +2631,7 @@ def destroy(name, stop=False, path=None):
|
|||
"""
|
||||
_ensure_exists(name, path=path)
|
||||
if not stop and state(name, path=path) != "stopped":
|
||||
raise CommandExecutionError("Container '{}' is not stopped".format(name))
|
||||
raise CommandExecutionError(f"Container '{name}' is not stopped")
|
||||
return _change_state("lxc-destroy", name, None, path=path)
|
||||
|
||||
|
||||
|
@ -2684,7 +2680,7 @@ def state(name, path=None):
|
|||
"""
|
||||
# Don't use _ensure_exists() here, it will mess with _change_state()
|
||||
|
||||
cachekey = "lxc.state.{}{}".format(name, path)
|
||||
cachekey = f"lxc.state.{name}{path}"
|
||||
try:
|
||||
return __context__[cachekey]
|
||||
except KeyError:
|
||||
|
@ -2693,13 +2689,13 @@ def state(name, path=None):
|
|||
else:
|
||||
cmd = "lxc-info"
|
||||
if path:
|
||||
cmd += " -P {}".format(pipes.quote(path))
|
||||
cmd += " -n {}".format(name)
|
||||
cmd += f" -P {pipes.quote(path)}"
|
||||
cmd += f" -n {name}"
|
||||
ret = __salt__["cmd.run_all"](cmd, python_shell=False)
|
||||
if ret["retcode"] != 0:
|
||||
_clear_context()
|
||||
raise CommandExecutionError(
|
||||
"Unable to get state of container '{}'".format(name)
|
||||
f"Unable to get state of container '{name}'"
|
||||
)
|
||||
c_infos = ret["stdout"].splitlines()
|
||||
c_state = None
|
||||
|
@ -2731,13 +2727,11 @@ def get_parameter(name, parameter, path=None):
|
|||
_ensure_exists(name, path=path)
|
||||
cmd = "lxc-cgroup"
|
||||
if path:
|
||||
cmd += " -P {}".format(pipes.quote(path))
|
||||
cmd += " -n {} {}".format(name, parameter)
|
||||
cmd += f" -P {pipes.quote(path)}"
|
||||
cmd += f" -n {name} {parameter}"
|
||||
ret = __salt__["cmd.run_all"](cmd, python_shell=False)
|
||||
if ret["retcode"] != 0:
|
||||
raise CommandExecutionError(
|
||||
"Unable to retrieve value for '{}'".format(parameter)
|
||||
)
|
||||
raise CommandExecutionError(f"Unable to retrieve value for '{parameter}'")
|
||||
return ret["stdout"].strip()
|
||||
|
||||
|
||||
|
@ -2762,8 +2756,8 @@ def set_parameter(name, parameter, value, path=None):
|
|||
|
||||
cmd = "lxc-cgroup"
|
||||
if path:
|
||||
cmd += " -P {}".format(pipes.quote(path))
|
||||
cmd += " -n {} {} {}".format(name, parameter, value)
|
||||
cmd += f" -P {pipes.quote(path)}"
|
||||
cmd += f" -n {name} {parameter} {value}"
|
||||
ret = __salt__["cmd.run_all"](cmd, python_shell=False)
|
||||
if ret["retcode"] != 0:
|
||||
return False
|
||||
|
@ -2787,7 +2781,7 @@ def info(name, path=None):
|
|||
|
||||
salt '*' lxc.info name
|
||||
"""
|
||||
cachekey = "lxc.info.{}{}".format(name, path)
|
||||
cachekey = f"lxc.info.{name}{path}"
|
||||
try:
|
||||
return __context__[cachekey]
|
||||
except KeyError:
|
||||
|
@ -2799,9 +2793,7 @@ def info(name, path=None):
|
|||
conf_file = os.path.join(cpath, str(name), "config")
|
||||
|
||||
if not os.path.isfile(conf_file):
|
||||
raise CommandExecutionError(
|
||||
"LXC config file {} does not exist".format(conf_file)
|
||||
)
|
||||
raise CommandExecutionError(f"LXC config file {conf_file} does not exist")
|
||||
|
||||
ret = {}
|
||||
config = []
|
||||
|
@ -3000,9 +2992,7 @@ def update_lxc_conf(name, lxc_conf, lxc_conf_unset, path=None):
|
|||
cpath = get_root_path(path)
|
||||
lxc_conf_p = os.path.join(cpath, name, "config")
|
||||
if not os.path.exists(lxc_conf_p):
|
||||
raise SaltInvocationError(
|
||||
"Configuration file {} does not exist".format(lxc_conf_p)
|
||||
)
|
||||
raise SaltInvocationError(f"Configuration file {lxc_conf_p} does not exist")
|
||||
|
||||
changes = {"edited": [], "added": [], "removed": []}
|
||||
ret = {"changes": changes, "result": True, "comment": ""}
|
||||
|
@ -3054,17 +3044,15 @@ def update_lxc_conf(name, lxc_conf, lxc_conf_unset, path=None):
|
|||
conf = ""
|
||||
for key, val in dest_lxc_conf:
|
||||
if not val:
|
||||
conf += "{}\n".format(key)
|
||||
conf += f"{key}\n"
|
||||
else:
|
||||
conf += "{} = {}\n".format(key.strip(), val.strip())
|
||||
conf += f"{key.strip()} = {val.strip()}\n"
|
||||
conf_changed = conf != orig_config
|
||||
chrono = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
|
||||
if conf_changed:
|
||||
# DO NOT USE salt.utils.files.fopen here, i got (kiorky)
|
||||
# problems with lxc configs which were wiped !
|
||||
with salt.utils.files.fopen(
|
||||
"{}.{}".format(lxc_conf_p, chrono), "w"
|
||||
) as wfic:
|
||||
with salt.utils.files.fopen(f"{lxc_conf_p}.{chrono}", "w") as wfic:
|
||||
wfic.write(salt.utils.stringutils.to_str(conf))
|
||||
with salt.utils.files.fopen(lxc_conf_p, "w") as wfic:
|
||||
wfic.write(salt.utils.stringutils.to_str(conf))
|
||||
|
@ -3113,8 +3101,8 @@ def set_dns(name, dnsservers=None, searchdomains=None, path=None):
|
|||
searchdomains = searchdomains.split(",")
|
||||
except AttributeError:
|
||||
raise SaltInvocationError("Invalid input for 'searchdomains' parameter")
|
||||
dns = ["nameserver {}".format(x) for x in dnsservers]
|
||||
dns.extend(["search {}".format(x) for x in searchdomains])
|
||||
dns = [f"nameserver {x}" for x in dnsservers]
|
||||
dns.extend([f"search {x}" for x in searchdomains])
|
||||
dns = "\n".join(dns) + "\n"
|
||||
# we may be using resolvconf in the container
|
||||
# We need to handle that case with care:
|
||||
|
@ -3129,7 +3117,7 @@ def set_dns(name, dnsservers=None, searchdomains=None, path=None):
|
|||
# - We finally also set /etc/resolv.conf in all cases
|
||||
rstr = __salt__["test.random_hash"]()
|
||||
# no tmp here, apparmor won't let us execute !
|
||||
script = "/sbin/{}_dns.sh".format(rstr)
|
||||
script = f"/sbin/{rstr}_dns.sh"
|
||||
DNS_SCRIPT = "\n".join(
|
||||
[
|
||||
# 'set -x',
|
||||
|
@ -3153,7 +3141,7 @@ def set_dns(name, dnsservers=None, searchdomains=None, path=None):
|
|||
]
|
||||
)
|
||||
result = run_all(
|
||||
name, "tee {}".format(script), path=path, stdin=DNS_SCRIPT, python_shell=True
|
||||
name, f"tee {script}", path=path, stdin=DNS_SCRIPT, python_shell=True
|
||||
)
|
||||
if result["retcode"] == 0:
|
||||
result = run_all(
|
||||
|
@ -3170,7 +3158,7 @@ def set_dns(name, dnsservers=None, searchdomains=None, path=None):
|
|||
python_shell=True,
|
||||
)
|
||||
if result["retcode"] != 0:
|
||||
error = "Unable to write to /etc/resolv.conf in container '{}'".format(name)
|
||||
error = f"Unable to write to /etc/resolv.conf in container '{name}'"
|
||||
if result["stderr"]:
|
||||
error += ": {}".format(result["stderr"])
|
||||
raise CommandExecutionError(error)
|
||||
|
@ -3193,12 +3181,12 @@ def running_systemd(name, cache=True, path=None):
|
|||
salt '*' lxc.running_systemd ubuntu
|
||||
|
||||
"""
|
||||
k = "lxc.systemd.test.{}{}".format(name, path)
|
||||
k = f"lxc.systemd.test.{name}{path}"
|
||||
ret = __context__.get(k, None)
|
||||
if ret is None or not cache:
|
||||
rstr = __salt__["test.random_hash"]()
|
||||
# no tmp here, apparmor won't let us execute !
|
||||
script = "/sbin/{}_testsystemd.sh".format(rstr)
|
||||
script = f"/sbin/{rstr}_testsystemd.sh"
|
||||
# ubuntu already had since trusty some bits of systemd but was
|
||||
# still using upstart ...
|
||||
# we need to be a bit more careful that just testing that systemd
|
||||
|
@ -3227,7 +3215,7 @@ def running_systemd(name, cache=True, path=None):
|
|||
"""
|
||||
)
|
||||
result = run_all(
|
||||
name, "tee {}".format(script), path=path, stdin=_script, python_shell=True
|
||||
name, f"tee {script}", path=path, stdin=_script, python_shell=True
|
||||
)
|
||||
if result["retcode"] == 0:
|
||||
result = run_all(
|
||||
|
@ -3237,9 +3225,7 @@ def running_systemd(name, cache=True, path=None):
|
|||
python_shell=True,
|
||||
)
|
||||
else:
|
||||
raise CommandExecutionError(
|
||||
"lxc {} failed to copy initd tester".format(name)
|
||||
)
|
||||
raise CommandExecutionError(f"lxc {name} failed to copy initd tester")
|
||||
run_all(
|
||||
name,
|
||||
'sh -c \'if [ -f "{0}" ];then rm -f "{0}";fi\''.format(script),
|
||||
|
@ -3361,9 +3347,9 @@ def wait_started(name, path=None, timeout=300):
|
|||
|
||||
"""
|
||||
if not exists(name, path=path):
|
||||
raise CommandExecutionError("Container {} does does exists".format(name))
|
||||
raise CommandExecutionError(f"Container {name} does does exists")
|
||||
if not state(name, path=path) == "running":
|
||||
raise CommandExecutionError("Container {} is not running".format(name))
|
||||
raise CommandExecutionError(f"Container {name} is not running")
|
||||
ret = False
|
||||
if running_systemd(name, path=path):
|
||||
test_started = test_sd_started_state
|
||||
|
@ -3520,7 +3506,7 @@ def bootstrap(
|
|||
seeded = (
|
||||
retcode(
|
||||
name,
|
||||
"test -e '{}'".format(SEED_MARKER),
|
||||
f"test -e '{SEED_MARKER}'",
|
||||
path=path,
|
||||
chroot_fallback=True,
|
||||
ignore_retcode=True,
|
||||
|
@ -3543,9 +3529,9 @@ def bootstrap(
|
|||
if needs_install or force_install or unconditional_install:
|
||||
if install:
|
||||
rstr = __salt__["test.random_hash"]()
|
||||
configdir = "/var/tmp/.c_{}".format(rstr)
|
||||
configdir = f"/var/tmp/.c_{rstr}"
|
||||
|
||||
cmd = "install -m 0700 -d {}".format(configdir)
|
||||
cmd = f"install -m 0700 -d {configdir}"
|
||||
if run_all(name, cmd, path=path, python_shell=False)["retcode"] != 0:
|
||||
log.error("tmpdir %s creation failed %s", configdir, cmd)
|
||||
return False
|
||||
|
@ -3553,11 +3539,11 @@ def bootstrap(
|
|||
bs_ = __salt__["config.gather_bootstrap_script"](
|
||||
bootstrap=bootstrap_url
|
||||
)
|
||||
script = "/sbin/{}_bootstrap.sh".format(rstr)
|
||||
script = f"/sbin/{rstr}_bootstrap.sh"
|
||||
copy_to(name, bs_, script, path=path)
|
||||
result = run_all(
|
||||
name,
|
||||
'sh -c "chmod +x {}"'.format(script),
|
||||
f'sh -c "chmod +x {script}"',
|
||||
path=path,
|
||||
python_shell=True,
|
||||
)
|
||||
|
@ -3631,7 +3617,7 @@ def bootstrap(
|
|||
freeze(name, path=path)
|
||||
# mark seeded upon successful install
|
||||
if ret:
|
||||
run(name, "touch '{}'".format(SEED_MARKER), path=path, python_shell=False)
|
||||
run(name, f"touch '{SEED_MARKER}'", path=path, python_shell=False)
|
||||
return ret
|
||||
|
||||
|
||||
|
@ -3652,7 +3638,7 @@ def attachable(name, path=None):
|
|||
|
||||
salt 'minion' lxc.attachable ubuntu
|
||||
"""
|
||||
cachekey = "lxc.attachable{}{}".format(name, path)
|
||||
cachekey = f"lxc.attachable{name}{path}"
|
||||
try:
|
||||
return __context__[cachekey]
|
||||
except KeyError:
|
||||
|
@ -3662,8 +3648,8 @@ def attachable(name, path=None):
|
|||
log.debug("Checking if LXC container %s is attachable", name)
|
||||
cmd = "lxc-attach"
|
||||
if path:
|
||||
cmd += " -P {}".format(pipes.quote(path))
|
||||
cmd += " --clear-env -n {} -- /usr/bin/env".format(name)
|
||||
cmd += f" -P {pipes.quote(path)}"
|
||||
cmd += f" --clear-env -n {name} -- /usr/bin/env"
|
||||
result = (
|
||||
__salt__["cmd.retcode"](
|
||||
cmd, python_shell=False, output_loglevel="quiet", ignore_retcode=True
|
||||
|
@ -3719,7 +3705,7 @@ def _run(
|
|||
)
|
||||
else:
|
||||
if not chroot_fallback:
|
||||
raise CommandExecutionError("{} is not attachable.".format(name))
|
||||
raise CommandExecutionError(f"{name} is not attachable.")
|
||||
rootfs = info(name, path=path).get("rootfs")
|
||||
# Set context var to make cmd.run_chroot run cmd.run instead of
|
||||
# cmd.run_all.
|
||||
|
@ -3820,7 +3806,7 @@ def run(
|
|||
|
||||
.. code-block:: bash
|
||||
|
||||
salt myminion lxc.run mycontainer 'ifconfig -a'
|
||||
salt myminion lxc.run mycontainer 'ip addr show'
|
||||
"""
|
||||
return _run(
|
||||
name,
|
||||
|
@ -3912,7 +3898,7 @@ def run_stdout(
|
|||
|
||||
.. code-block:: bash
|
||||
|
||||
salt myminion lxc.run_stdout mycontainer 'ifconfig -a'
|
||||
salt myminion lxc.run_stdout mycontainer 'ip addr show'
|
||||
"""
|
||||
return _run(
|
||||
name,
|
||||
|
@ -4214,7 +4200,7 @@ def _get_md5(name, path):
|
|||
Get the MD5 checksum of a file from a container
|
||||
"""
|
||||
output = run_stdout(
|
||||
name, 'md5sum "{}"'.format(path), chroot_fallback=True, ignore_retcode=True
|
||||
name, f'md5sum "{path}"', chroot_fallback=True, ignore_retcode=True
|
||||
)
|
||||
try:
|
||||
return output.split()[0]
|
||||
|
@ -4381,7 +4367,7 @@ def write_conf(conf_file, conf):
|
|||
line[key],
|
||||
(str, (str,), (int,), float),
|
||||
):
|
||||
out_line = " = ".join((key, "{}".format(line[key])))
|
||||
out_line = " = ".join((key, f"{line[key]}"))
|
||||
elif isinstance(line[key], dict):
|
||||
out_line = " = ".join((key, line[key]["value"]))
|
||||
if "comment" in line[key]:
|
||||
|
@ -4474,7 +4460,7 @@ def edit_conf(
|
|||
net_changes = _config_list(
|
||||
conf,
|
||||
only_net=True,
|
||||
**{"network_profile": DEFAULT_NIC, "nic_opts": nic_opts}
|
||||
**{"network_profile": DEFAULT_NIC, "nic_opts": nic_opts},
|
||||
)
|
||||
if net_changes:
|
||||
lxc_config.extend(net_changes)
|
||||
|
@ -4524,20 +4510,20 @@ def reboot(name, path=None):
|
|||
salt 'minion' lxc.reboot myvm
|
||||
|
||||
"""
|
||||
ret = {"result": True, "changes": {}, "comment": "{} rebooted".format(name)}
|
||||
ret = {"result": True, "changes": {}, "comment": f"{name} rebooted"}
|
||||
does_exist = exists(name, path=path)
|
||||
if does_exist and (state(name, path=path) == "running"):
|
||||
try:
|
||||
stop(name, path=path)
|
||||
except (SaltInvocationError, CommandExecutionError) as exc:
|
||||
ret["comment"] = "Unable to stop container: {}".format(exc)
|
||||
ret["comment"] = f"Unable to stop container: {exc}"
|
||||
ret["result"] = False
|
||||
return ret
|
||||
if does_exist and (state(name, path=path) != "running"):
|
||||
try:
|
||||
start(name, path=path)
|
||||
except (SaltInvocationError, CommandExecutionError) as exc:
|
||||
ret["comment"] = "Unable to stop container: {}".format(exc)
|
||||
ret["comment"] = f"Unable to stop container: {exc}"
|
||||
ret["result"] = False
|
||||
return ret
|
||||
ret["changes"][name] = "rebooted"
|
||||
|
@ -4559,7 +4545,7 @@ def reconfigure(
|
|||
utsname=None,
|
||||
rootfs=None,
|
||||
path=None,
|
||||
**kwargs
|
||||
**kwargs,
|
||||
):
|
||||
"""
|
||||
Reconfigure a container.
|
||||
|
@ -4625,7 +4611,7 @@ def reconfigure(
|
|||
path = os.path.join(cpath, name, "config")
|
||||
ret = {
|
||||
"name": name,
|
||||
"comment": "config for {} up to date".format(name),
|
||||
"comment": f"config for {name} up to date",
|
||||
"result": True,
|
||||
"changes": changes,
|
||||
}
|
||||
|
@ -4677,7 +4663,7 @@ def reconfigure(
|
|||
edit_conf(path, out_format="commented", lxc_config=new_cfg)
|
||||
chunks = read_conf(path, out_format="commented")
|
||||
if old_chunks != chunks:
|
||||
ret["comment"] = "{} lxc config updated".format(name)
|
||||
ret["comment"] = f"{name} lxc config updated"
|
||||
if state(name, path=path) == "running":
|
||||
cret = reboot(name, path=path)
|
||||
ret["result"] = cret["result"]
|
||||
|
@ -4763,9 +4749,9 @@ def get_pid(name, path=None):
|
|||
"""
|
||||
if name not in list_(limit="running", path=path):
|
||||
raise CommandExecutionError(
|
||||
"Container {} is not running, can't determine PID".format(name)
|
||||
f"Container {name} is not running, can't determine PID"
|
||||
)
|
||||
info = __salt__["cmd.run"]("lxc-info -n {}".format(name)).split("\n")
|
||||
info = __salt__["cmd.run"](f"lxc-info -n {name}").split("\n")
|
||||
pid = [
|
||||
line.split(":")[1].strip()
|
||||
for line in info
|
||||
|
@ -4812,21 +4798,19 @@ def add_veth(name, interface_name, bridge=None, path=None):
|
|||
raise CommandExecutionError(
|
||||
"Directory /var/run required for lxc.add_veth doesn't exists"
|
||||
)
|
||||
if not __salt__["file.file_exists"]("/proc/{}/ns/net".format(pid)):
|
||||
if not __salt__["file.file_exists"](f"/proc/{pid}/ns/net"):
|
||||
raise CommandExecutionError(
|
||||
"Proc file for container {} network namespace doesn't exists".format(name)
|
||||
f"Proc file for container {name} network namespace doesn't exists"
|
||||
)
|
||||
|
||||
if not __salt__["file.directory_exists"]("/var/run/netns"):
|
||||
__salt__["file.mkdir"]("/var/run/netns")
|
||||
|
||||
# Ensure that the symlink is up to date (change on container restart)
|
||||
if __salt__["file.is_link"]("/var/run/netns/{}".format(name)):
|
||||
__salt__["file.remove"]("/var/run/netns/{}".format(name))
|
||||
if __salt__["file.is_link"](f"/var/run/netns/{name}"):
|
||||
__salt__["file.remove"](f"/var/run/netns/{name}")
|
||||
|
||||
__salt__["file.symlink"](
|
||||
"/proc/{}/ns/net".format(pid), "/var/run/netns/{}".format(name)
|
||||
)
|
||||
__salt__["file.symlink"](f"/proc/{pid}/ns/net", f"/var/run/netns/{name}")
|
||||
|
||||
# Ensure that interface doesn't exists
|
||||
interface_exists = 0 == __salt__["cmd.retcode"](
|
||||
|
@ -4851,12 +4835,10 @@ def add_veth(name, interface_name, bridge=None, path=None):
|
|||
)
|
||||
!= 0
|
||||
):
|
||||
raise CommandExecutionError(f"Error while creating the veth pair {random_veth}")
|
||||
if __salt__["cmd.retcode"](f"ip link set dev {random_veth} up") != 0:
|
||||
raise CommandExecutionError(
|
||||
"Error while creating the veth pair {}".format(random_veth)
|
||||
)
|
||||
if __salt__["cmd.retcode"]("ip link set dev {} up".format(random_veth)) != 0:
|
||||
raise CommandExecutionError(
|
||||
"Error while bringing up host-side veth {}".format(random_veth)
|
||||
f"Error while bringing up host-side veth {random_veth}"
|
||||
)
|
||||
|
||||
# Attach it to the container
|
||||
|
@ -4872,7 +4854,7 @@ def add_veth(name, interface_name, bridge=None, path=None):
|
|||
)
|
||||
)
|
||||
|
||||
__salt__["file.remove"]("/var/run/netns/{}".format(name))
|
||||
__salt__["file.remove"](f"/var/run/netns/{name}")
|
||||
|
||||
if bridge is not None:
|
||||
__salt__["bridge.addif"](bridge, random_veth)
|
||||
|
|
|
@ -89,7 +89,7 @@ def get_str(
|
|||
):
|
||||
"""
|
||||
.. versionadded:: 2014.7.0
|
||||
.. versionchanged:: 3004.0
|
||||
.. versionchanged:: 3004
|
||||
|
||||
Changed the default character set used to include symbols and implemented arguments to control the used character set.
|
||||
|
||||
|
@ -99,14 +99,14 @@ def get_str(
|
|||
Any valid number of bytes.
|
||||
|
||||
chars : None
|
||||
.. versionadded:: 3004.0
|
||||
.. versionadded:: 3004
|
||||
|
||||
String with any character that should be used to generate random string.
|
||||
|
||||
This argument supersedes all other character controlling arguments.
|
||||
|
||||
lowercase : True
|
||||
.. versionadded:: 3004.0
|
||||
.. versionadded:: 3004
|
||||
|
||||
Use lowercase letters in generated random string.
|
||||
(see :py:data:`string.ascii_lowercase`)
|
||||
|
@ -114,7 +114,7 @@ def get_str(
|
|||
This argument is superseded by chars.
|
||||
|
||||
uppercase : True
|
||||
.. versionadded:: 3004.0
|
||||
.. versionadded:: 3004
|
||||
|
||||
Use uppercase letters in generated random string.
|
||||
(see :py:data:`string.ascii_uppercase`)
|
||||
|
@ -122,7 +122,7 @@ def get_str(
|
|||
This argument is superseded by chars.
|
||||
|
||||
digits : True
|
||||
.. versionadded:: 3004.0
|
||||
.. versionadded:: 3004
|
||||
|
||||
Use digits in generated random string.
|
||||
(see :py:data:`string.digits`)
|
||||
|
@ -130,7 +130,7 @@ def get_str(
|
|||
This argument is superseded by chars.
|
||||
|
||||
printable : False
|
||||
.. versionadded:: 3004.0
|
||||
.. versionadded:: 3004
|
||||
|
||||
Use printable characters in generated random string and includes lowercase, uppercase,
|
||||
digits, punctuation and whitespace.
|
||||
|
@ -143,7 +143,7 @@ def get_str(
|
|||
This argument is superseded by chars.
|
||||
|
||||
punctuation : True
|
||||
.. versionadded:: 3004.0
|
||||
.. versionadded:: 3004
|
||||
|
||||
Use punctuation characters in generated random string.
|
||||
(see :py:data:`string.punctuation`)
|
||||
|
@ -151,7 +151,7 @@ def get_str(
|
|||
This argument is superseded by chars.
|
||||
|
||||
whitespace : False
|
||||
.. versionadded:: 3004.0
|
||||
.. versionadded:: 3004
|
||||
|
||||
Use whitespace characters in generated random string.
|
||||
(see :py:data:`string.whitespace`)
|
||||
|
|
|
@ -299,7 +299,7 @@ def _netstat_bsd():
|
|||
ret = []
|
||||
if __grains__["kernel"] == "NetBSD":
|
||||
for addr_family in ("inet", "inet6"):
|
||||
cmd = "netstat -f {} -an | tail -n+3".format(addr_family)
|
||||
cmd = f"netstat -f {addr_family} -an | tail -n+3"
|
||||
out = __salt__["cmd.run"](cmd, python_shell=True)
|
||||
for line in out.splitlines():
|
||||
comps = line.split()
|
||||
|
@ -382,7 +382,7 @@ def _netstat_sunos():
|
|||
ret = []
|
||||
for addr_family in ("inet", "inet6"):
|
||||
# Lookup TCP connections
|
||||
cmd = "netstat -f {} -P tcp -an | tail +5".format(addr_family)
|
||||
cmd = f"netstat -f {addr_family} -P tcp -an | tail +5"
|
||||
out = __salt__["cmd.run"](cmd, python_shell=True)
|
||||
for line in out.splitlines():
|
||||
comps = line.split()
|
||||
|
@ -397,7 +397,7 @@ def _netstat_sunos():
|
|||
}
|
||||
)
|
||||
# Lookup UDP connections
|
||||
cmd = "netstat -f {} -P udp -an | tail +5".format(addr_family)
|
||||
cmd = f"netstat -f {addr_family} -P udp -an | tail +5"
|
||||
out = __salt__["cmd.run"](cmd, python_shell=True)
|
||||
for line in out.splitlines():
|
||||
comps = line.split()
|
||||
|
@ -421,7 +421,7 @@ def _netstat_aix():
|
|||
## for addr_family in ('inet', 'inet6'):
|
||||
for addr_family in ("inet",):
|
||||
# Lookup connections
|
||||
cmd = "netstat -n -a -f {} | tail -n +3".format(addr_family)
|
||||
cmd = f"netstat -n -a -f {addr_family} | tail -n +3"
|
||||
out = __salt__["cmd.run"](cmd, python_shell=True)
|
||||
for line in out.splitlines():
|
||||
comps = line.split()
|
||||
|
@ -1012,7 +1012,7 @@ def traceroute(host):
|
|||
"ip": traceline[2],
|
||||
}
|
||||
for idx, delay in enumerate(delays):
|
||||
result["ms{}".format(idx + 1)] = delay
|
||||
result[f"ms{idx + 1}"] = delay
|
||||
except IndexError:
|
||||
result = {}
|
||||
|
||||
|
@ -1333,6 +1333,60 @@ def ip_addrs6(interface=None, include_loopback=False, cidr=None):
|
|||
ipaddrs6 = salt.utils.functools.alias_function(ip_addrs6, "ipaddrs6")
|
||||
|
||||
|
||||
def ip_neighs():
|
||||
"""
|
||||
Return the ip neighbour (arp) table from the minion for IPv4 addresses
|
||||
|
||||
.. versionadded:: 3007.0
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt '*' network.ip_neighs
|
||||
"""
|
||||
ret = {}
|
||||
out = __salt__["cmd.run"]("ip neigh show")
|
||||
for line in out.splitlines():
|
||||
comps = line.split()
|
||||
if len(comps) < 5:
|
||||
continue
|
||||
if "." in comps[0]:
|
||||
ret[comps[4]] = comps[0]
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
ipneighs = salt.utils.functools.alias_function(ip_neighs, "ipneighs")
|
||||
|
||||
|
||||
def ip_neighs6():
|
||||
"""
|
||||
Return the ip neighbour (arp) table from the minion for IPv6 addresses
|
||||
|
||||
.. versionadded:: 3007.0
|
||||
|
||||
CLI Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
salt '*' network.ip_neighs6
|
||||
"""
|
||||
ret = {}
|
||||
out = __salt__["cmd.run"]("ip neigh show")
|
||||
for line in out.splitlines():
|
||||
comps = line.split()
|
||||
if len(comps) < 5:
|
||||
continue
|
||||
if ":" in comps[0]:
|
||||
ret[comps[4]] = comps[0]
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
ipneighs6 = salt.utils.functools.alias_function(ip_neighs6, "ipneighs6")
|
||||
|
||||
|
||||
def get_hostname():
|
||||
"""
|
||||
Get hostname
|
||||
|
@ -1400,7 +1454,7 @@ def mod_hostname(hostname):
|
|||
# Grab the old hostname so we know which hostname to change and then
|
||||
# change the hostname using the hostname command
|
||||
if hostname_cmd.endswith("hostnamectl"):
|
||||
result = __salt__["cmd.run_all"]("{} status".format(hostname_cmd))
|
||||
result = __salt__["cmd.run_all"](f"{hostname_cmd} status")
|
||||
if 0 == result["retcode"]:
|
||||
out = result["stdout"]
|
||||
for line in out.splitlines():
|
||||
|
@ -1432,7 +1486,7 @@ def mod_hostname(hostname):
|
|||
)
|
||||
return False
|
||||
elif not __utils__["platform.is_sunos"]():
|
||||
__salt__["cmd.run"]("{} {}".format(hostname_cmd, hostname))
|
||||
__salt__["cmd.run"](f"{hostname_cmd} {hostname}")
|
||||
else:
|
||||
__salt__["cmd.run"]("{} -S {}".format(uname_cmd, hostname.split(".")[0]))
|
||||
|
||||
|
@ -1490,7 +1544,7 @@ def mod_hostname(hostname):
|
|||
)
|
||||
if __salt__["cmd.run_all"](nirtcfg_cmd)["retcode"] != 0:
|
||||
raise CommandExecutionError(
|
||||
"Couldn't set hostname to: {}\n".format(str_hostname)
|
||||
f"Couldn't set hostname to: {str_hostname}\n"
|
||||
)
|
||||
elif __grains__["os_family"] == "OpenBSD":
|
||||
with __utils__["files.fopen"]("/etc/myname", "w") as fh_:
|
||||
|
@ -1666,7 +1720,7 @@ def _get_bufsize_linux(iface):
|
|||
"""
|
||||
ret = {"result": False}
|
||||
|
||||
cmd = "/sbin/ethtool -g {}".format(iface)
|
||||
cmd = f"/sbin/ethtool -g {iface}"
|
||||
out = __salt__["cmd.run"](cmd)
|
||||
pat = re.compile(r"^(.+):\s+(\d+)$")
|
||||
suffix = "max-"
|
||||
|
@ -1770,7 +1824,7 @@ def routes(family=None):
|
|||
salt '*' network.routes
|
||||
"""
|
||||
if family != "inet" and family != "inet6" and family is not None:
|
||||
raise CommandExecutionError("Invalid address family {}".format(family))
|
||||
raise CommandExecutionError(f"Invalid address family {family}")
|
||||
|
||||
if __grains__["kernel"] == "Linux":
|
||||
if not __utils__["path.which"]("netstat"):
|
||||
|
@ -1814,7 +1868,7 @@ def default_route(family=None):
|
|||
salt '*' network.default_route
|
||||
"""
|
||||
if family != "inet" and family != "inet6" and family is not None:
|
||||
raise CommandExecutionError("Invalid address family {}".format(family))
|
||||
raise CommandExecutionError(f"Invalid address family {family}")
|
||||
|
||||
_routes = routes(family)
|
||||
|
||||
|
@ -1872,7 +1926,7 @@ def get_route(ip):
|
|||
"""
|
||||
|
||||
if __grains__["kernel"] == "Linux":
|
||||
cmd = "ip route get {}".format(ip)
|
||||
cmd = f"ip route get {ip}"
|
||||
out = __salt__["cmd.run"](cmd, python_shell=True)
|
||||
regexp = re.compile(
|
||||
r"(via\s+(?P<gateway>[\w\.:]+))?\s+dev\s+(?P<interface>[\w\.\:\-]+)\s+.*src\s+(?P<source>[\w\.:]+)"
|
||||
|
@ -1896,7 +1950,7 @@ def get_route(ip):
|
|||
# flags: <UP,DONE,KERNEL>
|
||||
# recvpipe sendpipe ssthresh rtt,ms rttvar,ms hopcount mtu expire
|
||||
# 0 0 0 0 0 0 1500 0
|
||||
cmd = "/usr/sbin/route -n get {}".format(ip)
|
||||
cmd = f"/usr/sbin/route -n get {ip}"
|
||||
out = __salt__["cmd.run"](cmd, python_shell=False)
|
||||
|
||||
ret = {"destination": ip, "gateway": None, "interface": None, "source": None}
|
||||
|
@ -1925,7 +1979,7 @@ def get_route(ip):
|
|||
# flags: <UP,GATEWAY,DONE,STATIC>
|
||||
# use mtu expire
|
||||
# 8352657 0 0
|
||||
cmd = "route -n get {}".format(ip)
|
||||
cmd = f"route -n get {ip}"
|
||||
out = __salt__["cmd.run"](cmd, python_shell=False)
|
||||
|
||||
ret = {"destination": ip, "gateway": None, "interface": None, "source": None}
|
||||
|
@ -1953,7 +2007,7 @@ def get_route(ip):
|
|||
# flags: <UP,GATEWAY,HOST,DONE,STATIC>
|
||||
# recvpipe sendpipe ssthresh rtt,msec rttvar hopcount mtu expire
|
||||
# 0 0 0 0 0 0 0 -68642
|
||||
cmd = "route -n get {}".format(ip)
|
||||
cmd = f"route -n get {ip}"
|
||||
out = __salt__["cmd.run"](cmd, python_shell=False)
|
||||
|
||||
ret = {"destination": ip, "gateway": None, "interface": None, "source": None}
|
||||
|
|
|
@ -81,7 +81,7 @@ def _ensure_exists(wrapped):
|
|||
@functools.wraps(wrapped)
|
||||
def check_exists(name, *args, **kwargs):
|
||||
if not exists(name):
|
||||
raise CommandExecutionError("Container '{}' does not exist".format(name))
|
||||
raise CommandExecutionError(f"Container '{name}' does not exist")
|
||||
return wrapped(name, *args, **salt.utils.args.clean_kwargs(**kwargs))
|
||||
|
||||
return check_exists
|
||||
|
@ -115,14 +115,14 @@ def _make_container_root(name):
|
|||
path = _root(name)
|
||||
if os.path.exists(path):
|
||||
__context__["retcode"] = salt.defaults.exitcodes.SALT_BUILD_FAIL
|
||||
raise CommandExecutionError("Container {} already exists".format(name))
|
||||
raise CommandExecutionError(f"Container {name} already exists")
|
||||
else:
|
||||
try:
|
||||
os.makedirs(path)
|
||||
return path
|
||||
except OSError as exc:
|
||||
raise CommandExecutionError(
|
||||
"Unable to make container root directory {}: {}".format(name, exc)
|
||||
f"Unable to make container root directory {name}: {exc}"
|
||||
)
|
||||
|
||||
|
||||
|
@ -132,10 +132,8 @@ def _build_failed(dst, name):
|
|||
shutil.rmtree(dst)
|
||||
except OSError as exc:
|
||||
if exc.errno != errno.ENOENT:
|
||||
raise CommandExecutionError(
|
||||
"Unable to cleanup container root dir {}".format(dst)
|
||||
)
|
||||
raise CommandExecutionError("Container {} failed to build".format(name))
|
||||
raise CommandExecutionError(f"Unable to cleanup container root dir {dst}")
|
||||
raise CommandExecutionError(f"Container {name} failed to build")
|
||||
|
||||
|
||||
def _bootstrap_arch(name, **kwargs):
|
||||
|
@ -147,7 +145,7 @@ def _bootstrap_arch(name, **kwargs):
|
|||
"pacstrap not found, is the arch-install-scripts package installed?"
|
||||
)
|
||||
dst = _make_container_root(name)
|
||||
cmd = "pacstrap -c -d {} base".format(dst)
|
||||
cmd = f"pacstrap -c -d {dst} base"
|
||||
ret = __salt__["cmd.run_all"](cmd, python_shell=False)
|
||||
if ret["retcode"] != 0:
|
||||
_build_failed(dst, name)
|
||||
|
@ -183,7 +181,7 @@ def _bootstrap_debian(name, **kwargs):
|
|||
)
|
||||
|
||||
dst = _make_container_root(name)
|
||||
cmd = "debootstrap --arch=amd64 {} {}".format(version, dst)
|
||||
cmd = f"debootstrap --arch=amd64 {version} {dst}"
|
||||
ret = __salt__["cmd.run_all"](cmd, python_shell=False)
|
||||
if ret["retcode"] != 0:
|
||||
_build_failed(dst, name)
|
||||
|
@ -224,7 +222,7 @@ def _bootstrap_ubuntu(name, **kwargs):
|
|||
else:
|
||||
version = "xenial"
|
||||
dst = _make_container_root(name)
|
||||
cmd = "debootstrap --arch=amd64 {} {}".format(version, dst)
|
||||
cmd = f"debootstrap --arch=amd64 {version} {dst}"
|
||||
ret = __salt__["cmd.run_all"](cmd, python_shell=False)
|
||||
if ret["retcode"] != 0:
|
||||
_build_failed(dst, name)
|
||||
|
@ -258,7 +256,7 @@ def _ensure_systemd(version):
|
|||
try:
|
||||
version = int(version)
|
||||
except ValueError:
|
||||
raise CommandExecutionError("Invalid version '{}'".format(version))
|
||||
raise CommandExecutionError(f"Invalid version '{version}'")
|
||||
|
||||
try:
|
||||
installed = _sd_version()
|
||||
|
@ -280,7 +278,7 @@ def _machinectl(cmd, output_loglevel="debug", ignore_retcode=False, use_vt=False
|
|||
"""
|
||||
prefix = "machinectl --no-legend --no-pager"
|
||||
return __salt__["cmd.run_all"](
|
||||
"{} {}".format(prefix, cmd),
|
||||
f"{prefix} {cmd}",
|
||||
output_loglevel=output_loglevel,
|
||||
ignore_retcode=ignore_retcode,
|
||||
use_vt=use_vt,
|
||||
|
@ -350,9 +348,7 @@ def pid(name):
|
|||
try:
|
||||
return int(info(name).get("PID"))
|
||||
except (TypeError, ValueError) as exc:
|
||||
raise CommandExecutionError(
|
||||
"Unable to get PID for container '{}': {}".format(name, exc)
|
||||
)
|
||||
raise CommandExecutionError(f"Unable to get PID for container '{name}': {exc}")
|
||||
|
||||
|
||||
def run(
|
||||
|
@ -403,7 +399,7 @@ def run(
|
|||
|
||||
.. code-block:: bash
|
||||
|
||||
salt myminion nspawn.run mycontainer 'ifconfig -a'
|
||||
salt myminion nspawn.run mycontainer 'ip addr show'
|
||||
"""
|
||||
return _run(
|
||||
name,
|
||||
|
@ -469,7 +465,7 @@ def run_stdout(
|
|||
|
||||
.. code-block:: bash
|
||||
|
||||
salt myminion nspawn.run_stdout mycontainer 'ifconfig -a'
|
||||
salt myminion nspawn.run_stdout mycontainer 'ip addr show'
|
||||
"""
|
||||
return _run(
|
||||
name,
|
||||
|
@ -706,9 +702,9 @@ def bootstrap_container(name, dist=None, version=None):
|
|||
dist = __grains__["os"].lower()
|
||||
log.debug("nspawn.bootstrap: no dist provided, defaulting to '%s'", dist)
|
||||
try:
|
||||
return globals()["_bootstrap_{}".format(dist)](name, version=version)
|
||||
return globals()[f"_bootstrap_{dist}"](name, version=version)
|
||||
except KeyError:
|
||||
raise CommandExecutionError('Unsupported distribution "{}"'.format(dist))
|
||||
raise CommandExecutionError(f'Unsupported distribution "{dist}"')
|
||||
|
||||
|
||||
def _needs_install(name):
|
||||
|
@ -786,7 +782,7 @@ def bootstrap_salt(
|
|||
needs_install = _needs_install(name)
|
||||
else:
|
||||
needs_install = True
|
||||
seeded = retcode(name, "test -e '{}'".format(SEED_MARKER)) == 0
|
||||
seeded = retcode(name, f"test -e '{SEED_MARKER}'") == 0
|
||||
tmp = tempfile.mkdtemp()
|
||||
if seeded and not unconditional_install:
|
||||
ret = True
|
||||
|
@ -803,20 +799,20 @@ def bootstrap_salt(
|
|||
if needs_install or force_install or unconditional_install:
|
||||
if install:
|
||||
rstr = __salt__["test.random_hash"]()
|
||||
configdir = "/tmp/.c_{}".format(rstr)
|
||||
run(name, "install -m 0700 -d {}".format(configdir), python_shell=False)
|
||||
configdir = f"/tmp/.c_{rstr}"
|
||||
run(name, f"install -m 0700 -d {configdir}", python_shell=False)
|
||||
bs_ = __salt__["config.gather_bootstrap_script"](
|
||||
bootstrap=bootstrap_url
|
||||
)
|
||||
dest_dir = os.path.join("/tmp", rstr)
|
||||
for cmd in [
|
||||
"mkdir -p {}".format(dest_dir),
|
||||
"chmod 700 {}".format(dest_dir),
|
||||
f"mkdir -p {dest_dir}",
|
||||
f"chmod 700 {dest_dir}",
|
||||
]:
|
||||
if run_stdout(name, cmd):
|
||||
log.error("tmpdir %s creation failed (%s)", dest_dir, cmd)
|
||||
return False
|
||||
copy_to(name, bs_, "{}/bootstrap.sh".format(dest_dir), makedirs=True)
|
||||
copy_to(name, bs_, f"{dest_dir}/bootstrap.sh", makedirs=True)
|
||||
copy_to(name, cfg_files["config"], os.path.join(configdir, "minion"))
|
||||
copy_to(
|
||||
name, cfg_files["privkey"], os.path.join(configdir, "minion.pem")
|
||||
|
@ -849,7 +845,7 @@ def bootstrap_salt(
|
|||
stop(name)
|
||||
# mark seeded upon successful install
|
||||
if ret:
|
||||
run(name, "touch '{}'".format(SEED_MARKER), python_shell=False)
|
||||
run(name, f"touch '{SEED_MARKER}'", python_shell=False)
|
||||
return ret
|
||||
|
||||
|
||||
|
@ -933,7 +929,7 @@ def exists(name):
|
|||
|
||||
salt myminion nspawn.exists <name>
|
||||
"""
|
||||
contextkey = "nspawn.exists.{}".format(name)
|
||||
contextkey = f"nspawn.exists.{name}"
|
||||
if contextkey in __context__:
|
||||
return __context__[contextkey]
|
||||
__context__[contextkey] = name in list_all()
|
||||
|
@ -952,7 +948,7 @@ def state(name):
|
|||
salt myminion nspawn.state <name>
|
||||
"""
|
||||
try:
|
||||
cmd = "show {} --property=State".format(name)
|
||||
cmd = f"show {name} --property=State"
|
||||
return _machinectl(cmd, ignore_retcode=True)["stdout"].split("=")[-1]
|
||||
except IndexError:
|
||||
return "stopped"
|
||||
|
@ -992,11 +988,9 @@ def info(name, **kwargs):
|
|||
|
||||
# Have to parse 'machinectl status' here since 'machinectl show' doesn't
|
||||
# contain IP address info or OS info. *shakes fist angrily*
|
||||
c_info = _machinectl("status {}".format(name))
|
||||
c_info = _machinectl(f"status {name}")
|
||||
if c_info["retcode"] != 0:
|
||||
raise CommandExecutionError(
|
||||
"Unable to get info for container '{}'".format(name)
|
||||
)
|
||||
raise CommandExecutionError(f"Unable to get info for container '{name}'")
|
||||
# Better human-readable names. False means key should be ignored.
|
||||
key_name_map = {
|
||||
"Iface": "Network Interface",
|
||||
|
@ -1052,7 +1046,7 @@ def enable(name):
|
|||
|
||||
salt myminion nspawn.enable <name>
|
||||
"""
|
||||
cmd = "systemctl enable systemd-nspawn@{}".format(name)
|
||||
cmd = f"systemctl enable systemd-nspawn@{name}"
|
||||
if __salt__["cmd.retcode"](cmd, python_shell=False) != 0:
|
||||
__context__["retcode"] = salt.defaults.exitcodes.EX_UNAVAILABLE
|
||||
return False
|
||||
|
@ -1070,7 +1064,7 @@ def disable(name):
|
|||
|
||||
salt myminion nspawn.enable <name>
|
||||
"""
|
||||
cmd = "systemctl disable systemd-nspawn@{}".format(name)
|
||||
cmd = f"systemctl disable systemd-nspawn@{name}"
|
||||
if __salt__["cmd.retcode"](cmd, python_shell=False) != 0:
|
||||
__context__["retcode"] = salt.defaults.exitcodes.EX_UNAVAILABLE
|
||||
return False
|
||||
|
@ -1089,9 +1083,9 @@ def start(name):
|
|||
salt myminion nspawn.start <name>
|
||||
"""
|
||||
if _sd_version() >= 219:
|
||||
ret = _machinectl("start {}".format(name))
|
||||
ret = _machinectl(f"start {name}")
|
||||
else:
|
||||
cmd = "systemctl start systemd-nspawn@{}".format(name)
|
||||
cmd = f"systemctl start systemd-nspawn@{name}"
|
||||
ret = __salt__["cmd.run_all"](cmd, python_shell=False)
|
||||
|
||||
if ret["retcode"] != 0:
|
||||
|
@ -1112,9 +1106,9 @@ def stop(name, kill=False):
|
|||
action = "terminate"
|
||||
else:
|
||||
action = "poweroff"
|
||||
ret = _machinectl("{} {}".format(action, name))
|
||||
ret = _machinectl(f"{action} {name}")
|
||||
else:
|
||||
cmd = "systemctl stop systemd-nspawn@{}".format(name)
|
||||
cmd = f"systemctl stop systemd-nspawn@{name}"
|
||||
ret = __salt__["cmd.run_all"](cmd, python_shell=False)
|
||||
|
||||
if ret["retcode"] != 0:
|
||||
|
@ -1204,7 +1198,7 @@ def reboot(name, kill=False):
|
|||
"""
|
||||
if _sd_version() >= 219:
|
||||
if state(name) == "running":
|
||||
ret = _machinectl("reboot {}".format(name))
|
||||
ret = _machinectl(f"reboot {name}")
|
||||
else:
|
||||
# 'machinectl reboot' will fail on a stopped container
|
||||
return start(name)
|
||||
|
@ -1214,7 +1208,7 @@ def reboot(name, kill=False):
|
|||
# we need stop and start the container in separate actions.
|
||||
|
||||
# First stop the container
|
||||
cmd = "systemctl stop systemd-nspawn@{}".format(name)
|
||||
cmd = f"systemctl stop systemd-nspawn@{name}"
|
||||
ret = __salt__["cmd.run_all"](cmd, python_shell=False)
|
||||
# Now check if successful
|
||||
if ret["retcode"] != 0:
|
||||
|
@ -1222,7 +1216,7 @@ def reboot(name, kill=False):
|
|||
return False
|
||||
# Finally, start the container back up. No need to check the retcode a
|
||||
# second time, it'll be checked below once we exit the if/else block.
|
||||
cmd = "systemctl start systemd-nspawn@{}".format(name)
|
||||
cmd = f"systemctl start systemd-nspawn@{name}"
|
||||
ret = __salt__["cmd.run_all"](cmd, python_shell=False)
|
||||
|
||||
if ret["retcode"] != 0:
|
||||
|
@ -1257,15 +1251,13 @@ def remove(name, stop=False):
|
|||
salt '*' nspawn.remove foo stop=True
|
||||
"""
|
||||
if not stop and state(name) != "stopped":
|
||||
raise CommandExecutionError("Container '{}' is not stopped".format(name))
|
||||
raise CommandExecutionError(f"Container '{name}' is not stopped")
|
||||
|
||||
def _failed_remove(name, exc):
|
||||
raise CommandExecutionError(
|
||||
"Unable to remove container '{}': {}".format(name, exc)
|
||||
)
|
||||
raise CommandExecutionError(f"Unable to remove container '{name}': {exc}")
|
||||
|
||||
if _sd_version() >= 219:
|
||||
ret = _machinectl("remove {}".format(name))
|
||||
ret = _machinectl(f"remove {name}")
|
||||
if ret["retcode"] != 0:
|
||||
__context__["retcode"] = salt.defaults.exitcodes.EX_UNAVAILABLE
|
||||
_failed_remove(name, ret["stderr"])
|
||||
|
@ -1315,10 +1307,10 @@ def copy_to(name, source, dest, overwrite=False, makedirs=False):
|
|||
if source.startswith("salt://"):
|
||||
cached_source = __salt__["cp.cache_file"](source)
|
||||
if not cached_source:
|
||||
raise CommandExecutionError("Unable to cache {}".format(source))
|
||||
raise CommandExecutionError(f"Unable to cache {source}")
|
||||
path = cached_source
|
||||
except AttributeError:
|
||||
raise SaltInvocationError("Invalid source file {}".format(source))
|
||||
raise SaltInvocationError(f"Invalid source file {source}")
|
||||
|
||||
if _sd_version() >= 219:
|
||||
# TODO: Use machinectl copy-to
|
||||
|
@ -1346,13 +1338,13 @@ def _pull_image(pull_type, image, name, **kwargs):
|
|||
"""
|
||||
_ensure_systemd(219)
|
||||
if exists(name):
|
||||
raise SaltInvocationError("Container '{}' already exists".format(name))
|
||||
raise SaltInvocationError(f"Container '{name}' already exists")
|
||||
if pull_type in ("raw", "tar"):
|
||||
valid_kwargs = ("verify",)
|
||||
elif pull_type == "dkr":
|
||||
valid_kwargs = ("index",)
|
||||
else:
|
||||
raise SaltInvocationError("Unsupported image type '{}'".format(pull_type))
|
||||
raise SaltInvocationError(f"Unsupported image type '{pull_type}'")
|
||||
|
||||
kwargs = salt.utils.args.clean_kwargs(**kwargs)
|
||||
bad_kwargs = {
|
||||
|
@ -1384,7 +1376,7 @@ def _pull_image(pull_type, image, name, **kwargs):
|
|||
else:
|
||||
if verify not in ("signature", "checksum"):
|
||||
_bad_verify()
|
||||
pull_opts.append("--verify={}".format(verify))
|
||||
pull_opts.append(f"--verify={verify}")
|
||||
|
||||
elif pull_type == "dkr":
|
||||
# No need to validate the index URL, machinectl will take care of this
|
||||
|
|
|
@ -175,7 +175,7 @@ def bridge_exists(br):
|
|||
|
||||
salt '*' openvswitch.bridge_exists br0
|
||||
"""
|
||||
cmd = "ovs-vsctl br-exists {}".format(br)
|
||||
cmd = f"ovs-vsctl br-exists {br}"
|
||||
result = __salt__["cmd.run_all"](cmd)
|
||||
retcode = result["retcode"]
|
||||
return _retcode_to_bool(retcode)
|
||||
|
@ -193,11 +193,11 @@ def bridge_create(br, may_exist=True, parent=None, vlan=None):
|
|||
parent : string
|
||||
name of the parent bridge (if the bridge shall be created as a fake
|
||||
bridge). If specified, vlan must also be specified.
|
||||
.. versionadded:: 3006
|
||||
.. versionadded:: 3006.0
|
||||
vlan : int
|
||||
VLAN ID of the bridge (if the bridge shall be created as a fake
|
||||
bridge). If specified, parent must also be specified.
|
||||
.. versionadded:: 3006
|
||||
.. versionadded:: 3006.0
|
||||
|
||||
Returns:
|
||||
True on success, else False.
|
||||
|
@ -215,8 +215,8 @@ def bridge_create(br, may_exist=True, parent=None, vlan=None):
|
|||
raise ArgumentValueError("If parent is specified, vlan must also be specified.")
|
||||
if vlan is not None and parent is None:
|
||||
raise ArgumentValueError("If vlan is specified, parent must also be specified.")
|
||||
param_parent = "" if parent is None else " {}".format(parent)
|
||||
param_vlan = "" if vlan is None else " {}".format(vlan)
|
||||
param_parent = "" if parent is None else f" {parent}"
|
||||
param_vlan = "" if vlan is None else f" {vlan}"
|
||||
cmd = "ovs-vsctl {1}add-br {0}{2}{3}".format(
|
||||
br, param_may_exist, param_parent, param_vlan
|
||||
)
|
||||
|
@ -244,7 +244,7 @@ def bridge_delete(br, if_exists=True):
|
|||
salt '*' openvswitch.bridge_delete br0
|
||||
"""
|
||||
param_if_exists = _param_if_exists(if_exists)
|
||||
cmd = "ovs-vsctl {1}del-br {0}".format(br, param_if_exists)
|
||||
cmd = f"ovs-vsctl {param_if_exists}del-br {br}"
|
||||
result = __salt__["cmd.run_all"](cmd)
|
||||
retcode = result["retcode"]
|
||||
return _retcode_to_bool(retcode)
|
||||
|
@ -252,7 +252,7 @@ def bridge_delete(br, if_exists=True):
|
|||
|
||||
def bridge_to_parent(br):
|
||||
"""
|
||||
.. versionadded:: 3006
|
||||
.. versionadded:: 3006.0
|
||||
|
||||
Returns the parent bridge of a bridge.
|
||||
|
||||
|
@ -271,7 +271,7 @@ def bridge_to_parent(br):
|
|||
|
||||
salt '*' openvswitch.bridge_to_parent br0
|
||||
"""
|
||||
cmd = "ovs-vsctl br-to-parent {}".format(br)
|
||||
cmd = f"ovs-vsctl br-to-parent {br}"
|
||||
result = __salt__["cmd.run_all"](cmd)
|
||||
if result["retcode"] != 0:
|
||||
return False
|
||||
|
@ -280,7 +280,7 @@ def bridge_to_parent(br):
|
|||
|
||||
def bridge_to_vlan(br):
|
||||
"""
|
||||
.. versionadded:: 3006
|
||||
.. versionadded:: 3006.0
|
||||
|
||||
Returns the VLAN ID of a bridge.
|
||||
|
||||
|
@ -298,7 +298,7 @@ def bridge_to_vlan(br):
|
|||
|
||||
salt '*' openvswitch.bridge_to_parent br0
|
||||
"""
|
||||
cmd = "ovs-vsctl br-to-vlan {}".format(br)
|
||||
cmd = f"ovs-vsctl br-to-vlan {br}"
|
||||
result = __salt__["cmd.run_all"](cmd)
|
||||
if result["retcode"] != 0:
|
||||
return False
|
||||
|
@ -327,9 +327,9 @@ def port_add(br, port, may_exist=False, internal=False):
|
|||
salt '*' openvswitch.port_add br0 8080
|
||||
"""
|
||||
param_may_exist = _param_may_exist(may_exist)
|
||||
cmd = "ovs-vsctl {2}add-port {0} {1}".format(br, port, param_may_exist)
|
||||
cmd = f"ovs-vsctl {param_may_exist}add-port {br} {port}"
|
||||
if internal:
|
||||
cmd += " -- set interface {} type=internal".format(port)
|
||||
cmd += f" -- set interface {port} type=internal"
|
||||
result = __salt__["cmd.run_all"](cmd)
|
||||
retcode = result["retcode"]
|
||||
return _retcode_to_bool(retcode)
|
||||
|
@ -358,9 +358,9 @@ def port_remove(br, port, if_exists=True):
|
|||
param_if_exists = _param_if_exists(if_exists)
|
||||
|
||||
if port and not br:
|
||||
cmd = "ovs-vsctl {1}del-port {0}".format(port, param_if_exists)
|
||||
cmd = f"ovs-vsctl {param_if_exists}del-port {port}"
|
||||
else:
|
||||
cmd = "ovs-vsctl {2}del-port {0} {1}".format(br, port, param_if_exists)
|
||||
cmd = f"ovs-vsctl {param_if_exists}del-port {br} {port}"
|
||||
result = __salt__["cmd.run_all"](cmd)
|
||||
retcode = result["retcode"]
|
||||
return _retcode_to_bool(retcode)
|
||||
|
@ -384,7 +384,7 @@ def port_list(br):
|
|||
|
||||
salt '*' openvswitch.port_list br0
|
||||
"""
|
||||
cmd = "ovs-vsctl list-ports {}".format(br)
|
||||
cmd = f"ovs-vsctl list-ports {br}"
|
||||
result = __salt__["cmd.run_all"](cmd)
|
||||
retcode = result["retcode"]
|
||||
stdout = result["stdout"]
|
||||
|
@ -409,7 +409,7 @@ def port_get_tag(port):
|
|||
|
||||
salt '*' openvswitch.port_get_tag tap0
|
||||
"""
|
||||
cmd = "ovs-vsctl get port {} tag".format(port)
|
||||
cmd = f"ovs-vsctl get port {port} tag"
|
||||
result = __salt__["cmd.run_all"](cmd)
|
||||
retcode = result["retcode"]
|
||||
stdout = result["stdout"]
|
||||
|
@ -434,7 +434,7 @@ def interface_get_options(port):
|
|||
|
||||
salt '*' openvswitch.interface_get_options tap0
|
||||
"""
|
||||
cmd = "ovs-vsctl get interface {} options".format(port)
|
||||
cmd = f"ovs-vsctl get interface {port} options"
|
||||
result = __salt__["cmd.run_all"](cmd)
|
||||
retcode = result["retcode"]
|
||||
stdout = result["stdout"]
|
||||
|
@ -459,7 +459,7 @@ def interface_get_type(port):
|
|||
|
||||
salt '*' openvswitch.interface_get_type tap0
|
||||
"""
|
||||
cmd = "ovs-vsctl get interface {} type".format(port)
|
||||
cmd = f"ovs-vsctl get interface {port} type"
|
||||
result = __salt__["cmd.run_all"](cmd)
|
||||
retcode = result["retcode"]
|
||||
stdout = result["stdout"]
|
||||
|
@ -495,15 +495,15 @@ def port_create_vlan(br, port, id, internal=False):
|
|||
elif not internal and port not in interfaces:
|
||||
return False
|
||||
elif port in port_list(br):
|
||||
cmd = "ovs-vsctl set port {} tag={}".format(port, id)
|
||||
cmd = f"ovs-vsctl set port {port} tag={id}"
|
||||
if internal:
|
||||
cmd += " -- set interface {} type=internal".format(port)
|
||||
cmd += f" -- set interface {port} type=internal"
|
||||
result = __salt__["cmd.run_all"](cmd)
|
||||
return _retcode_to_bool(result["retcode"])
|
||||
else:
|
||||
cmd = "ovs-vsctl add-port {} {} tag={}".format(br, port, id)
|
||||
cmd = f"ovs-vsctl add-port {br} {port} tag={id}"
|
||||
if internal:
|
||||
cmd += " -- set interface {} type=internal".format(port)
|
||||
cmd += f" -- set interface {port} type=internal"
|
||||
result = __salt__["cmd.run_all"](cmd)
|
||||
return _retcode_to_bool(result["retcode"])
|
||||
|
||||
|
@ -599,7 +599,7 @@ def port_create_vxlan(br, port, id, remote, dst_port=None):
|
|||
|
||||
def db_get(table, record, column, if_exists=False):
|
||||
"""
|
||||
.. versionadded:: 3006
|
||||
.. versionadded:: 3006.0
|
||||
|
||||
Gets a column's value for a specific record.
|
||||
|
||||
|
@ -622,7 +622,7 @@ def db_get(table, record, column, if_exists=False):
|
|||
|
||||
salt '*' openvswitch.db_get Port br0 vlan_mode
|
||||
"""
|
||||
cmd = ["ovs-vsctl", "--format=json", "--columns={}".format(column)]
|
||||
cmd = ["ovs-vsctl", "--format=json", f"--columns={column}"]
|
||||
if if_exists:
|
||||
cmd += ["--if-exists"]
|
||||
cmd += ["list", table, record]
|
||||
|
@ -638,7 +638,7 @@ def db_get(table, record, column, if_exists=False):
|
|||
|
||||
def db_set(table, record, column, value, if_exists=False):
|
||||
"""
|
||||
.. versionadded:: 3006
|
||||
.. versionadded:: 3006.0
|
||||
|
||||
Sets a column's value for a specific record.
|
||||
|
||||
|
@ -666,7 +666,7 @@ def db_set(table, record, column, value, if_exists=False):
|
|||
cmd = ["ovs-vsctl"]
|
||||
if if_exists:
|
||||
cmd += ["--if-exists"]
|
||||
cmd += ["set", table, record, "{}={}".format(column, json.dumps(value))]
|
||||
cmd += ["set", table, record, f"{column}={json.dumps(value)}"]
|
||||
result = __salt__["cmd.run_all"](cmd)
|
||||
if result["retcode"] != 0:
|
||||
return result["stderr"]
|
||||
|
|
|
@ -32,7 +32,7 @@ def get(
|
|||
saltenv=None,
|
||||
):
|
||||
"""
|
||||
.. versionadded:: 0.14
|
||||
.. versionadded:: 0.14.0
|
||||
|
||||
Attempt to retrieve the named value from :ref:`in-memory pillar data
|
||||
<pillar-in-memory>`. If the pillar key is not present in the in-memory
|
||||
|
@ -184,7 +184,7 @@ def get(
|
|||
|
||||
ret = salt.utils.data.traverse_dict_and_list(pillar_dict, key, default, delimiter)
|
||||
if ret is KeyError:
|
||||
raise KeyError("Pillar key not found: {}".format(key))
|
||||
raise KeyError(f"Pillar key not found: {key}")
|
||||
|
||||
return ret
|
||||
|
||||
|
@ -264,9 +264,7 @@ def items(*args, **kwargs):
|
|||
valid_rend=__opts__["decrypt_pillar_renderers"],
|
||||
)
|
||||
except Exception as exc: # pylint: disable=broad-except
|
||||
raise CommandExecutionError(
|
||||
"Failed to decrypt pillar override: {}".format(exc)
|
||||
)
|
||||
raise CommandExecutionError(f"Failed to decrypt pillar override: {exc}")
|
||||
|
||||
pillar = salt.pillar.get_pillar(
|
||||
__opts__,
|
||||
|
@ -295,7 +293,7 @@ def _obfuscate_inner(var):
|
|||
elif isinstance(var, (list, set, tuple)):
|
||||
return type(var)(_obfuscate_inner(v) for v in var)
|
||||
else:
|
||||
return "<{}>".format(var.__class__.__name__)
|
||||
return f"<{var.__class__.__name__}>"
|
||||
|
||||
|
||||
def obfuscate(*args, **kwargs):
|
||||
|
@ -538,10 +536,10 @@ def keys(key, delimiter=DEFAULT_TARGET_DELIM):
|
|||
ret = salt.utils.data.traverse_dict_and_list(__pillar__, key, KeyError, delimiter)
|
||||
|
||||
if ret is KeyError:
|
||||
raise KeyError("Pillar key not found: {}".format(key))
|
||||
raise KeyError(f"Pillar key not found: {key}")
|
||||
|
||||
if not isinstance(ret, dict):
|
||||
raise ValueError("Pillar value in key {} is not a dict".format(key))
|
||||
raise ValueError(f"Pillar value in key {key} is not a dict")
|
||||
|
||||
return list(ret)
|
||||
|
||||
|
|
|
@ -113,7 +113,7 @@ def __virtual__():
|
|||
"load rh_service.py as virtual 'service'",
|
||||
)
|
||||
return __virtualname__
|
||||
return (False, "Cannot load rh_service module: OS not in {}".format(enable))
|
||||
return (False, f"Cannot load rh_service module: OS not in {enable}")
|
||||
|
||||
|
||||
def _runlevel():
|
||||
|
@ -137,7 +137,7 @@ def _chkconfig_add(name):
|
|||
/etc/init.d. The service is initially configured to be disabled at all
|
||||
run-levels.
|
||||
"""
|
||||
cmd = "/sbin/chkconfig --add {}".format(name)
|
||||
cmd = f"/sbin/chkconfig --add {name}"
|
||||
if __salt__["cmd.retcode"](cmd, python_shell=False) == 0:
|
||||
log.info('Added initscript "%s" to chkconfig', name)
|
||||
return True
|
||||
|
@ -150,7 +150,7 @@ def _service_is_upstart(name):
|
|||
"""
|
||||
Return True if the service is an upstart service, otherwise return False.
|
||||
"""
|
||||
return HAS_UPSTART and os.path.exists("/etc/init/{}.conf".format(name))
|
||||
return HAS_UPSTART and os.path.exists(f"/etc/init/{name}.conf")
|
||||
|
||||
|
||||
def _service_is_sysv(name):
|
||||
|
@ -169,7 +169,7 @@ def _service_is_chkconfig(name):
|
|||
"""
|
||||
Return True if the service is managed by chkconfig.
|
||||
"""
|
||||
cmdline = "/sbin/chkconfig --list {}".format(name)
|
||||
cmdline = f"/sbin/chkconfig --list {name}"
|
||||
return (
|
||||
__salt__["cmd.retcode"](cmdline, python_shell=False, ignore_retcode=True) == 0
|
||||
)
|
||||
|
@ -188,7 +188,7 @@ def _sysv_is_enabled(name, runlevel=None):
|
|||
|
||||
if runlevel is None:
|
||||
runlevel = _runlevel()
|
||||
return len(glob.glob("/etc/rc.d/rc{}.d/S??{}".format(runlevel, name))) > 0
|
||||
return len(glob.glob(f"/etc/rc.d/rc{runlevel}.d/S??{name}")) > 0
|
||||
|
||||
|
||||
def _chkconfig_is_enabled(name, runlevel=None):
|
||||
|
@ -197,14 +197,14 @@ def _chkconfig_is_enabled(name, runlevel=None):
|
|||
return ``False``. If ``runlevel`` is ``None``, then use the current
|
||||
runlevel.
|
||||
"""
|
||||
cmdline = "/sbin/chkconfig --list {}".format(name)
|
||||
cmdline = f"/sbin/chkconfig --list {name}"
|
||||
result = __salt__["cmd.run_all"](cmdline, python_shell=False)
|
||||
|
||||
if runlevel is None:
|
||||
runlevel = _runlevel()
|
||||
if result["retcode"] == 0:
|
||||
for row in result["stdout"].splitlines():
|
||||
if "{}:on".format(runlevel) in row:
|
||||
if f"{runlevel}:on" in row:
|
||||
if row.split()[0] == name:
|
||||
return True
|
||||
elif row.split() == [name, "on"]:
|
||||
|
@ -220,7 +220,7 @@ def _sysv_enable(name):
|
|||
"""
|
||||
if not _service_is_chkconfig(name) and not _chkconfig_add(name):
|
||||
return False
|
||||
cmd = "/sbin/chkconfig {} on".format(name)
|
||||
cmd = f"/sbin/chkconfig {name} on"
|
||||
return not __salt__["cmd.retcode"](cmd, python_shell=False)
|
||||
|
||||
|
||||
|
@ -233,7 +233,7 @@ def _sysv_disable(name):
|
|||
"""
|
||||
if not _service_is_chkconfig(name) and not _chkconfig_add(name):
|
||||
return False
|
||||
cmd = "/sbin/chkconfig {} off".format(name)
|
||||
cmd = f"/sbin/chkconfig {name} off"
|
||||
return not __salt__["cmd.retcode"](cmd, python_shell=False)
|
||||
|
||||
|
||||
|
@ -244,7 +244,7 @@ def _sysv_delete(name):
|
|||
"""
|
||||
if not _service_is_chkconfig(name):
|
||||
return False
|
||||
cmd = "/sbin/chkconfig --del {}".format(name)
|
||||
cmd = f"/sbin/chkconfig --del {name}"
|
||||
return not __salt__["cmd.retcode"](cmd)
|
||||
|
||||
|
||||
|
@ -253,10 +253,10 @@ def _upstart_delete(name):
|
|||
Delete an upstart service. This will only rename the .conf file
|
||||
"""
|
||||
if HAS_UPSTART:
|
||||
if os.path.exists("/etc/init/{}.conf".format(name)):
|
||||
if os.path.exists(f"/etc/init/{name}.conf"):
|
||||
os.rename(
|
||||
"/etc/init/{}.conf".format(name),
|
||||
"/etc/init/{}.conf.removed".format(name),
|
||||
f"/etc/init/{name}.conf",
|
||||
f"/etc/init/{name}.conf.removed",
|
||||
)
|
||||
return True
|
||||
|
||||
|
@ -435,9 +435,9 @@ def start(name):
|
|||
salt '*' service.start <service name>
|
||||
"""
|
||||
if _service_is_upstart(name):
|
||||
cmd = "start {}".format(name)
|
||||
cmd = f"start {name}"
|
||||
else:
|
||||
cmd = "/sbin/service {} start".format(name)
|
||||
cmd = f"/sbin/service {name} start"
|
||||
return not __salt__["cmd.retcode"](cmd, python_shell=False)
|
||||
|
||||
|
||||
|
@ -452,9 +452,9 @@ def stop(name):
|
|||
salt '*' service.stop <service name>
|
||||
"""
|
||||
if _service_is_upstart(name):
|
||||
cmd = "stop {}".format(name)
|
||||
cmd = f"stop {name}"
|
||||
else:
|
||||
cmd = "/sbin/service {} stop".format(name)
|
||||
cmd = f"/sbin/service {name} stop"
|
||||
return not __salt__["cmd.retcode"](cmd, python_shell=False)
|
||||
|
||||
|
||||
|
@ -469,9 +469,9 @@ def restart(name):
|
|||
salt '*' service.restart <service name>
|
||||
"""
|
||||
if _service_is_upstart(name):
|
||||
cmd = "restart {}".format(name)
|
||||
cmd = f"restart {name}"
|
||||
else:
|
||||
cmd = "/sbin/service {} restart".format(name)
|
||||
cmd = f"/sbin/service {name} restart"
|
||||
return not __salt__["cmd.retcode"](cmd, python_shell=False)
|
||||
|
||||
|
||||
|
@ -486,9 +486,9 @@ def reload_(name):
|
|||
salt '*' service.reload <service name>
|
||||
"""
|
||||
if _service_is_upstart(name):
|
||||
cmd = "reload {}".format(name)
|
||||
cmd = f"reload {name}"
|
||||
else:
|
||||
cmd = "/sbin/service {} reload".format(name)
|
||||
cmd = f"/sbin/service {name} reload"
|
||||
return not __salt__["cmd.retcode"](cmd, python_shell=False)
|
||||
|
||||
|
||||
|
@ -526,12 +526,12 @@ def status(name, sig=None):
|
|||
results = {}
|
||||
for service in services:
|
||||
if _service_is_upstart(service):
|
||||
cmd = "status {}".format(service)
|
||||
cmd = f"status {service}"
|
||||
results[service] = "start/running" in __salt__["cmd.run"](
|
||||
cmd, python_shell=False
|
||||
)
|
||||
else:
|
||||
cmd = "/sbin/service {} status".format(service)
|
||||
cmd = f"/sbin/service {service} status"
|
||||
results[service] = (
|
||||
__salt__["cmd.retcode"](cmd, python_shell=False, ignore_retcode=True)
|
||||
== 0
|
||||
|
@ -545,7 +545,7 @@ def delete(name, **kwargs):
|
|||
"""
|
||||
Delete the named service
|
||||
|
||||
.. versionadded:: 2016.3
|
||||
.. versionadded:: 2016.3.0
|
||||
|
||||
CLI Example:
|
||||
|
||||
|
|
|
@ -317,6 +317,14 @@ from salt.utils.decorators import memoize
|
|||
from salt.utils.json import dumps, loads
|
||||
from salt.utils.odict import OrderedDict
|
||||
|
||||
try:
|
||||
from junit_xml import TestCase, TestSuite
|
||||
|
||||
HAS_JUNIT = True
|
||||
except ImportError:
|
||||
HAS_JUNIT = False
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
try:
|
||||
|
@ -433,7 +441,9 @@ def report_highstate_tests(saltenv=None):
|
|||
}
|
||||
|
||||
|
||||
def run_state_tests(state, saltenv=None, check_all=False, only_fails=False):
|
||||
def run_state_tests(
|
||||
state, saltenv=None, check_all=False, only_fails=False, junit=False
|
||||
):
|
||||
"""
|
||||
Execute tests for a salt state and return results
|
||||
Nested states will also be tested
|
||||
|
@ -442,6 +452,8 @@ def run_state_tests(state, saltenv=None, check_all=False, only_fails=False):
|
|||
:param str saltenv: optional saltenv. Defaults to base
|
||||
:param bool check_all: boolean to run all tests in state/saltcheck-tests directory
|
||||
:param bool only_fails: boolean to only print failure results
|
||||
:param bool junit: boolean to print results in junit format
|
||||
.. versionadded:: 3007.0
|
||||
|
||||
CLI Example:
|
||||
|
||||
|
@ -473,7 +485,6 @@ def run_state_tests(state, saltenv=None, check_all=False, only_fails=False):
|
|||
stl.add_test_files_for_sls(state_name, check_all)
|
||||
stl.load_test_suite()
|
||||
results_dict = OrderedDict()
|
||||
|
||||
# Check for situations to disable parallization
|
||||
if parallel:
|
||||
if type(num_proc) == float:
|
||||
|
@ -517,7 +528,11 @@ def run_state_tests(state, saltenv=None, check_all=False, only_fails=False):
|
|||
# If passed a duplicate state, don't overwrite with empty res
|
||||
if not results.get(state_name):
|
||||
results[state_name] = results_dict
|
||||
return _generate_out_list(results, only_fails=only_fails)
|
||||
|
||||
if junit and HAS_JUNIT:
|
||||
return _generate_junit_out_list(results)
|
||||
else:
|
||||
return _generate_out_list(results, only_fails=only_fails)
|
||||
|
||||
|
||||
def parallel_scheck(data):
|
||||
|
@ -534,12 +549,14 @@ run_state_tests_ssh = salt.utils.functools.alias_function(
|
|||
)
|
||||
|
||||
|
||||
def run_highstate_tests(saltenv=None, only_fails=False):
|
||||
def run_highstate_tests(saltenv=None, only_fails=False, junit=False):
|
||||
"""
|
||||
Execute all tests for states assigned to the minion through highstate and return results
|
||||
|
||||
:param str saltenv: optional saltenv. Defaults to base
|
||||
:param bool only_fails: boolean to only print failure results
|
||||
:param bool junit: boolean to print results in junit format
|
||||
.. versionadded:: 3007.0
|
||||
|
||||
CLI Example:
|
||||
|
||||
|
@ -556,7 +573,9 @@ def run_highstate_tests(saltenv=None, only_fails=False):
|
|||
sls_list = _get_top_states(saltenv)
|
||||
all_states = ",".join(sls_list)
|
||||
|
||||
return run_state_tests(all_states, saltenv=saltenv, only_fails=only_fails)
|
||||
return run_state_tests(
|
||||
all_states, saltenv=saltenv, only_fails=only_fails, junit=junit
|
||||
)
|
||||
|
||||
|
||||
def _eval_failure_only_print(state_name, results, only_fails):
|
||||
|
@ -618,6 +637,35 @@ def _generate_out_list(results, only_fails=False):
|
|||
return out_list
|
||||
|
||||
|
||||
def _generate_junit_out_list(results):
|
||||
"""
|
||||
generates test results output list in JUnit format
|
||||
"""
|
||||
total_time = 0.0
|
||||
test_cases = []
|
||||
failed = 0
|
||||
for state in results:
|
||||
if not results[state]:
|
||||
test_cases.append(TestCase("missing_test", "", "", "Test(s) Missing"))
|
||||
else:
|
||||
for name, val in sorted(results[state].items()):
|
||||
time = float(val["duration"])
|
||||
status = val["status"]
|
||||
test_cases.append(TestCase(name, "", round(time, 4)))
|
||||
if status.startswith("Fail"):
|
||||
failed = 1
|
||||
test_cases[len(test_cases) - 1].add_failure_info(status)
|
||||
if status.startswith("Skip"):
|
||||
test_cases[len(test_cases) - 1].add_skipped_info(status)
|
||||
total_time = total_time + float(val["duration"])
|
||||
test_suite = TestSuite("test_results", test_cases)
|
||||
# Set exit code to 1 if failed tests
|
||||
# Use-cases for exist code handling of missing or skipped?
|
||||
__context__["retcode"] = failed
|
||||
xml_string = TestSuite.to_xml_string([test_suite])
|
||||
return xml_string
|
||||
|
||||
|
||||
def _render_file(file_path):
|
||||
"""
|
||||
call the salt utility to render a file
|
||||
|
@ -648,7 +696,7 @@ def _is_valid_function(module_name, function):
|
|||
functions = __salt__["sys.list_functions"](module_name)
|
||||
except salt.exceptions.SaltException:
|
||||
functions = ["unable to look up functions"]
|
||||
return "{}.{}".format(module_name, function) in functions
|
||||
return f"{module_name}.{function}" in functions
|
||||
|
||||
|
||||
def _get_top_states(saltenv="base"):
|
||||
|
@ -875,19 +923,19 @@ class SaltCheck:
|
|||
if output_details:
|
||||
if assertion_section:
|
||||
assertion_section_repr_title = " {}".format("assertion_section")
|
||||
assertion_section_repr_value = " {}".format(assertion_section)
|
||||
assertion_section_repr_value = f" {assertion_section}"
|
||||
else:
|
||||
assertion_section_repr_title = ""
|
||||
assertion_section_repr_value = ""
|
||||
value[
|
||||
"module.function [args]{}".format(assertion_section_repr_title)
|
||||
f"module.function [args]{assertion_section_repr_title}"
|
||||
] = "{} {}{}".format(
|
||||
mod_and_func,
|
||||
dumps(args),
|
||||
assertion_section_repr_value,
|
||||
)
|
||||
value["saltcheck assertion"] = "{}{} {}".format(
|
||||
("" if expected_return is None else "{} ".format(expected_return)),
|
||||
("" if expected_return is None else f"{expected_return} "),
|
||||
assertion_desc,
|
||||
("hidden" if not assert_print_result else module_output),
|
||||
)
|
||||
|
@ -932,7 +980,7 @@ class SaltCheck:
|
|||
for num, assert_group in enumerate(
|
||||
test_dict.get("assertions"), start=1
|
||||
):
|
||||
result["assertion{}".format(num)] = self._run_assertions(
|
||||
result[f"assertion{num}"] = self._run_assertions(
|
||||
mod_and_func,
|
||||
args,
|
||||
assert_group,
|
||||
|
@ -1032,7 +1080,7 @@ class SaltCheck:
|
|||
"""
|
||||
result = "Pass"
|
||||
try:
|
||||
assert returned is True, "{} not True".format(returned)
|
||||
assert returned is True, f"{returned} not True"
|
||||
except AssertionError as err:
|
||||
result = "Fail: " + str(err)
|
||||
return result
|
||||
|
@ -1046,7 +1094,7 @@ class SaltCheck:
|
|||
if isinstance(returned, str):
|
||||
returned = bool(returned)
|
||||
try:
|
||||
assert returned is False, "{} not False".format(returned)
|
||||
assert returned is False, f"{returned} not False"
|
||||
except AssertionError as err:
|
||||
result = "Fail: " + str(err)
|
||||
return result
|
||||
|
@ -1092,7 +1140,7 @@ class SaltCheck:
|
|||
"""
|
||||
result = "Pass"
|
||||
try:
|
||||
assert expected > returned, "{} not False".format(returned)
|
||||
assert expected > returned, f"{returned} not False"
|
||||
except AssertionError as err:
|
||||
result = "Fail: " + str(err)
|
||||
return result
|
||||
|
@ -1104,7 +1152,7 @@ class SaltCheck:
|
|||
"""
|
||||
result = "Pass"
|
||||
try:
|
||||
assert expected >= returned, "{} not False".format(returned)
|
||||
assert expected >= returned, f"{returned} not False"
|
||||
except AssertionError as err:
|
||||
result = "Fail: " + str(err)
|
||||
return result
|
||||
|
@ -1116,7 +1164,7 @@ class SaltCheck:
|
|||
"""
|
||||
result = "Pass"
|
||||
try:
|
||||
assert expected < returned, "{} not False".format(returned)
|
||||
assert expected < returned, f"{returned} not False"
|
||||
except AssertionError as err:
|
||||
result = "Fail: " + str(err)
|
||||
return result
|
||||
|
@ -1128,7 +1176,7 @@ class SaltCheck:
|
|||
"""
|
||||
result = "Pass"
|
||||
try:
|
||||
assert expected <= returned, "{} not False".format(returned)
|
||||
assert expected <= returned, f"{returned} not False"
|
||||
except AssertionError as err:
|
||||
result = "Fail: " + str(err)
|
||||
return result
|
||||
|
@ -1140,7 +1188,7 @@ class SaltCheck:
|
|||
"""
|
||||
result = "Pass"
|
||||
try:
|
||||
assert not returned, "{} is not empty".format(returned)
|
||||
assert not returned, f"{returned} is not empty"
|
||||
except AssertionError as err:
|
||||
result = "Fail: " + str(err)
|
||||
return result
|
||||
|
@ -1252,7 +1300,7 @@ class StateTestLoader:
|
|||
all_sls_paths.append(test_path)
|
||||
|
||||
state_name_base = state_name.split(".")[0]
|
||||
test_path = "salt://{}/{}".format(state_name_base, self.saltcheck_test_location)
|
||||
test_path = f"salt://{state_name_base}/{self.saltcheck_test_location}"
|
||||
all_sls_paths.append(test_path)
|
||||
|
||||
unique_paths = set(all_sls_paths)
|
||||
|
@ -1368,13 +1416,13 @@ class StateTestLoader:
|
|||
os.path.join(
|
||||
os.sep.join(split_sls[: len(split_sls) - 1]),
|
||||
os.path.normpath(self.saltcheck_test_location),
|
||||
"{}.tst".format(split_sls[-1]),
|
||||
f"{split_sls[-1]}.tst",
|
||||
),
|
||||
os.path.join(
|
||||
split_sls[0],
|
||||
os.path.normpath(self.saltcheck_test_location),
|
||||
os.sep.join(split_sls[1:-1]),
|
||||
"{}.tst".format(split_sls[-1]),
|
||||
f"{split_sls[-1]}.tst",
|
||||
),
|
||||
}
|
||||
# for this state, find matching test files and load them
|
||||
|
|
|
@ -135,22 +135,22 @@ def setenforce(mode):
|
|||
if isinstance(mode, str):
|
||||
if mode.lower() == "enforcing":
|
||||
mode = "1"
|
||||
modestring = "Enforcing"
|
||||
modestring = "enforcing"
|
||||
elif mode.lower() == "permissive":
|
||||
mode = "0"
|
||||
modestring = "Permissive"
|
||||
modestring = "permissive"
|
||||
elif mode.lower() == "disabled":
|
||||
mode = "0"
|
||||
modestring = "Disabled"
|
||||
modestring = "disabled"
|
||||
else:
|
||||
return "Invalid mode {}".format(mode)
|
||||
return f"Invalid mode {mode}"
|
||||
elif isinstance(mode, int):
|
||||
if mode:
|
||||
mode = "1"
|
||||
else:
|
||||
mode = "0"
|
||||
else:
|
||||
return "Invalid mode {}".format(mode)
|
||||
return f"Invalid mode {mode}"
|
||||
|
||||
# enforce file does not exist if currently disabled. Only for toggling enforcing/permissive
|
||||
if getenforce() != "Disabled":
|
||||
|
@ -204,9 +204,9 @@ def setsebool(boolean, value, persist=False):
|
|||
salt '*' selinux.setsebool virt_use_usb off
|
||||
"""
|
||||
if persist:
|
||||
cmd = "setsebool -P {} {}".format(boolean, value)
|
||||
cmd = f"setsebool -P {boolean} {value}"
|
||||
else:
|
||||
cmd = "setsebool {} {}".format(boolean, value)
|
||||
cmd = f"setsebool {boolean} {value}"
|
||||
return not __salt__["cmd.retcode"](cmd, python_shell=False)
|
||||
|
||||
|
||||
|
@ -227,7 +227,7 @@ def setsebools(pairs, persist=False):
|
|||
else:
|
||||
cmd = "setsebool "
|
||||
for boolean, value in pairs.items():
|
||||
cmd = "{} {}={}".format(cmd, boolean, value)
|
||||
cmd = f"{cmd} {boolean}={value}"
|
||||
return not __salt__["cmd.retcode"](cmd, python_shell=False)
|
||||
|
||||
|
||||
|
@ -284,9 +284,9 @@ def setsemod(module, state):
|
|||
.. versionadded:: 2016.3.0
|
||||
"""
|
||||
if state.lower() == "enabled":
|
||||
cmd = "semodule -e {}".format(module)
|
||||
cmd = f"semodule -e {module}"
|
||||
elif state.lower() == "disabled":
|
||||
cmd = "semodule -d {}".format(module)
|
||||
cmd = f"semodule -d {module}"
|
||||
return not __salt__["cmd.retcode"](cmd)
|
||||
|
||||
|
||||
|
@ -304,7 +304,7 @@ def install_semod(module_path):
|
|||
"""
|
||||
if module_path.find("salt://") == 0:
|
||||
module_path = __salt__["cp.cache_file"](module_path)
|
||||
cmd = "semodule -i {}".format(module_path)
|
||||
cmd = f"semodule -i {module_path}"
|
||||
return not __salt__["cmd.retcode"](cmd)
|
||||
|
||||
|
||||
|
@ -320,7 +320,7 @@ def remove_semod(module):
|
|||
|
||||
.. versionadded:: 2016.11.6
|
||||
"""
|
||||
cmd = "semodule -r {}".format(module)
|
||||
cmd = f"semodule -r {module}"
|
||||
return not __salt__["cmd.retcode"](cmd)
|
||||
|
||||
|
||||
|
@ -376,7 +376,7 @@ def _validate_filetype(filetype):
|
|||
specification. Throws an SaltInvocationError if it isn't.
|
||||
"""
|
||||
if filetype not in _SELINUX_FILETYPES.keys():
|
||||
raise SaltInvocationError("Invalid filetype given: {}".format(filetype))
|
||||
raise SaltInvocationError(f"Invalid filetype given: {filetype}")
|
||||
return True
|
||||
|
||||
|
||||
|
@ -394,7 +394,7 @@ def _parse_protocol_port(name, protocol, port):
|
|||
protocol_port_pattern = r"^(tcp|udp)\/(([\d]+)\-?[\d]+)$"
|
||||
name_parts = re.match(protocol_port_pattern, name)
|
||||
if not name_parts:
|
||||
name_parts = re.match(protocol_port_pattern, "{}/{}".format(protocol, port))
|
||||
name_parts = re.match(protocol_port_pattern, f"{protocol}/{port}")
|
||||
if not name_parts:
|
||||
raise SaltInvocationError(
|
||||
'Invalid name "{}" format and protocol and port not provided or invalid:'
|
||||
|
@ -609,20 +609,20 @@ def _fcontext_add_or_delete_policy(
|
|||
"""
|
||||
if action not in ["add", "delete"]:
|
||||
raise SaltInvocationError(
|
||||
'Actions supported are "add" and "delete", not "{}".'.format(action)
|
||||
f'Actions supported are "add" and "delete", not "{action}".'
|
||||
)
|
||||
cmd = "semanage fcontext --{}".format(action)
|
||||
cmd = f"semanage fcontext --{action}"
|
||||
# "semanage --ftype a" isn't valid on Centos 6,
|
||||
# don't pass --ftype since "a" is the default filetype.
|
||||
if filetype is not None and filetype != "a":
|
||||
_validate_filetype(filetype)
|
||||
cmd += " --ftype {}".format(filetype)
|
||||
cmd += f" --ftype {filetype}"
|
||||
if sel_type is not None:
|
||||
cmd += " --type {}".format(sel_type)
|
||||
cmd += f" --type {sel_type}"
|
||||
if sel_user is not None:
|
||||
cmd += " --seuser {}".format(sel_user)
|
||||
cmd += f" --seuser {sel_user}"
|
||||
if sel_level is not None:
|
||||
cmd += " --range {}".format(sel_level)
|
||||
cmd += f" --range {sel_level}"
|
||||
cmd += " " + re.escape(name)
|
||||
return __salt__["cmd.run_all"](cmd)
|
||||
|
||||
|
@ -841,15 +841,15 @@ def _port_add_or_delete_policy(
|
|||
"""
|
||||
if action not in ["add", "delete"]:
|
||||
raise SaltInvocationError(
|
||||
'Actions supported are "add" and "delete", not "{}".'.format(action)
|
||||
f'Actions supported are "add" and "delete", not "{action}".'
|
||||
)
|
||||
if action == "add" and not sel_type:
|
||||
raise SaltInvocationError("SELinux Type is required to add a policy")
|
||||
(protocol, port) = _parse_protocol_port(name, protocol, port)
|
||||
cmd = "semanage port --{} --proto {}".format(action, protocol)
|
||||
cmd = f"semanage port --{action} --proto {protocol}"
|
||||
if sel_type:
|
||||
cmd += " --type {}".format(sel_type)
|
||||
cmd += f" --type {sel_type}"
|
||||
if sel_range:
|
||||
cmd += " --range {}".format(sel_range)
|
||||
cmd += " {}".format(port)
|
||||
cmd += f" --range {sel_range}"
|
||||
cmd += f" {port}"
|
||||
return __salt__["cmd.run_all"](cmd)
|
||||
|
|
|
@ -546,7 +546,7 @@ def list_state_functions(*args, **kwargs): # pylint: disable=unused-argument
|
|||
salt '*' sys.list_state_functions 'file.*'
|
||||
salt '*' sys.list_state_functions 'file.s*'
|
||||
|
||||
.. versionadded:: 2016.9
|
||||
.. versionadded:: 2016.9.0
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ def _build_sdb_uri(key):
|
|||
Salt node id's are used as the key for vm_ dicts.
|
||||
|
||||
"""
|
||||
return "{}{}".format(VAGRANT_SDB_URL, key)
|
||||
return f"{VAGRANT_SDB_URL}{key}"
|
||||
|
||||
|
||||
def _build_machine_uri(machine, cwd):
|
||||
|
@ -73,7 +73,7 @@ def _build_machine_uri(machine, cwd):
|
|||
never collide with a Salt node id -- which is important since we
|
||||
will be storing both in the same table.
|
||||
"""
|
||||
key = "{}?{}".format(machine, os.path.abspath(cwd))
|
||||
key = f"{machine}?{os.path.abspath(cwd)}"
|
||||
return _build_sdb_uri(key)
|
||||
|
||||
|
||||
|
@ -102,9 +102,7 @@ def get_vm_info(name):
|
|||
"Probable sdb driver not found. Check your configuration."
|
||||
)
|
||||
if vm_ is None or "machine" not in vm_:
|
||||
raise SaltInvocationError(
|
||||
"No Vagrant machine defined for Salt_id {}".format(name)
|
||||
)
|
||||
raise SaltInvocationError(f"No Vagrant machine defined for Salt_id {name}")
|
||||
return vm_
|
||||
|
||||
|
||||
|
@ -161,7 +159,7 @@ def _vagrant_ssh_config(vm_):
|
|||
"""
|
||||
machine = vm_["machine"]
|
||||
log.info("requesting vagrant ssh-config for VM %s", machine or "(default)")
|
||||
cmd = "vagrant ssh-config {}".format(machine)
|
||||
cmd = f"vagrant ssh-config {machine}"
|
||||
reply = __salt__["cmd.shell"](
|
||||
cmd, runas=vm_.get("runas"), cwd=vm_.get("cwd"), ignore_retcode=True
|
||||
)
|
||||
|
@ -305,12 +303,12 @@ def vm_state(name="", cwd=None):
|
|||
else:
|
||||
if not cwd:
|
||||
raise SaltInvocationError(
|
||||
"Path to Vagranfile must be defined, but cwd={}".format(cwd)
|
||||
f"Path to Vagranfile must be defined, but cwd={cwd}"
|
||||
)
|
||||
machine = ""
|
||||
|
||||
info = []
|
||||
cmd = "vagrant status {}".format(machine)
|
||||
cmd = f"vagrant status {machine}"
|
||||
reply = __salt__["cmd.shell"](cmd, cwd)
|
||||
log.info("--->\n%s", reply)
|
||||
for line in reply.split("\n"): # build a list of the text reply
|
||||
|
@ -404,13 +402,11 @@ def _start(
|
|||
try:
|
||||
machine = vm_["machine"]
|
||||
except KeyError:
|
||||
raise SaltInvocationError(
|
||||
"No Vagrant machine defined for Salt_id {}".format(name)
|
||||
)
|
||||
raise SaltInvocationError(f"No Vagrant machine defined for Salt_id {name}")
|
||||
|
||||
vagrant_provider = vm_.get("vagrant_provider", "")
|
||||
provider_ = "--provider={}".format(vagrant_provider) if vagrant_provider else ""
|
||||
cmd = "vagrant up {} {}".format(machine, provider_)
|
||||
provider_ = f"--provider={vagrant_provider}" if vagrant_provider else ""
|
||||
cmd = f"vagrant up {machine} {provider_}"
|
||||
ret = __salt__["cmd.run_all"](
|
||||
cmd, runas=vm_.get("runas"), cwd=vm_.get("cwd"), output_loglevel="info"
|
||||
)
|
||||
|
@ -424,7 +420,7 @@ def _start(
|
|||
break
|
||||
|
||||
if ret["retcode"] == 0:
|
||||
return 'Started "{}" using Vagrant machine "{}".'.format(name, machine)
|
||||
return f'Started "{name}" using Vagrant machine "{machine}".'
|
||||
return False
|
||||
|
||||
|
||||
|
@ -458,7 +454,7 @@ def stop(name):
|
|||
vm_ = get_vm_info(name)
|
||||
machine = vm_["machine"]
|
||||
|
||||
cmd = "vagrant halt {}".format(machine)
|
||||
cmd = f"vagrant halt {machine}"
|
||||
ret = __salt__["cmd.retcode"](cmd, runas=vm_.get("runas"), cwd=vm_.get("cwd"))
|
||||
return ret == 0
|
||||
|
||||
|
@ -476,7 +472,7 @@ def pause(name):
|
|||
vm_ = get_vm_info(name)
|
||||
machine = vm_["machine"]
|
||||
|
||||
cmd = "vagrant suspend {}".format(machine)
|
||||
cmd = f"vagrant suspend {machine}"
|
||||
ret = __salt__["cmd.retcode"](cmd, runas=vm_.get("runas"), cwd=vm_.get("cwd"))
|
||||
return ret == 0
|
||||
|
||||
|
@ -498,7 +494,7 @@ def reboot(name, provision=False):
|
|||
machine = vm_["machine"]
|
||||
prov = "--provision" if provision else ""
|
||||
|
||||
cmd = "vagrant reload {} {}".format(machine, prov)
|
||||
cmd = f"vagrant reload {machine} {prov}"
|
||||
ret = __salt__["cmd.retcode"](cmd, runas=vm_.get("runas"), cwd=vm_.get("cwd"))
|
||||
return ret == 0
|
||||
|
||||
|
@ -518,14 +514,14 @@ def destroy(name):
|
|||
vm_ = get_vm_info(name)
|
||||
machine = vm_["machine"]
|
||||
|
||||
cmd = "vagrant destroy -f {}".format(machine)
|
||||
cmd = f"vagrant destroy -f {machine}"
|
||||
|
||||
ret = __salt__["cmd.run_all"](
|
||||
cmd, runas=vm_.get("runas"), cwd=vm_.get("cwd"), output_loglevel="info"
|
||||
)
|
||||
if ret["retcode"] == 0:
|
||||
_erase_vm_info(name)
|
||||
return "Destroyed VM {}".format(name)
|
||||
return f"Destroyed VM {name}"
|
||||
return False
|
||||
|
||||
|
||||
|
@ -566,8 +562,9 @@ def get_ssh_config(name, network_mask="", get_private_key=False):
|
|||
The IP address of the bridged adapter will typically be assigned by DHCP and unknown to you,
|
||||
but you should be able to determine what IP network the address will be chosen from.
|
||||
If you enter a CIDR network mask, Salt will attempt to find the VM's address for you.
|
||||
The host machine will send an "ifconfig" command to the VM (using ssh to `ssh_host`:`ssh_port`)
|
||||
and return the IP address of the first interface it can find which matches your mask.
|
||||
The host machine will send an "ip link show" or "ifconfig" command to the VM
|
||||
(using ssh to `ssh_host`:`ssh_port`) and return the IP address of the first interface it
|
||||
can find which matches your mask.
|
||||
"""
|
||||
vm_ = get_vm_info(name)
|
||||
|
||||
|
@ -595,23 +592,32 @@ def get_ssh_config(name, network_mask="", get_private_key=False):
|
|||
"-oStrictHostKeyChecking={StrictHostKeyChecking} "
|
||||
"-oUserKnownHostsFile={UserKnownHostsFile} "
|
||||
"-oControlPath=none "
|
||||
"{User}@{HostName} ifconfig".format(**ssh_config)
|
||||
"{User}@{HostName} ip link show".format(**ssh_config)
|
||||
)
|
||||
|
||||
log.info("Trying ssh -p %(Port)s %(User)s@%(HostName)s ifconfig", ssh_config)
|
||||
log.info(
|
||||
"Trying ssh -p %(Port)s %(User)s@%(HostName)s ip link show", ssh_config
|
||||
)
|
||||
reply = __salt__["cmd.shell"](command)
|
||||
log.info("--->\n%s", reply)
|
||||
target_network_range = ipaddress.ip_network(network_mask, strict=False)
|
||||
|
||||
found_address = None
|
||||
for line in reply.split("\n"):
|
||||
try: # try to find a bridged network address
|
||||
# the lines we are looking for appear like:
|
||||
# ip addr show
|
||||
# inet 192.168.0.107/24 brd 192.168.0.255 scope global dynamic noprefixroute enx3c18a040229d
|
||||
# inet 10.16.119.90/32 scope global gpd0
|
||||
# inet 127.0.0.1/8 scope host lo
|
||||
# inet 192.168.0.116/24 brd 192.168.0.255 scope global dynamic noprefixroute enp0s3
|
||||
# inet6 fe80::df56:869b:f0d5:f77c/64 scope link noprefixroute
|
||||
# ifconfig
|
||||
# "inet addr:10.124.31.185 Bcast:10.124.31.255 Mask:255.255.248.0"
|
||||
# or "inet6 addr: fe80::a00:27ff:fe04:7aac/64 Scope:Link"
|
||||
tokens = line.replace(
|
||||
"addr:", "", 1
|
||||
).split() # remove "addr:" if it exists, then split
|
||||
found_address = None
|
||||
if "inet" in tokens:
|
||||
nxt = tokens.index("inet") + 1
|
||||
found_address = ipaddress.ip_address(tokens[nxt])
|
||||
|
@ -627,9 +633,53 @@ def get_ssh_config(name, network_mask="", get_private_key=False):
|
|||
log.info(
|
||||
"Network IP address in %s detected as: %s",
|
||||
target_network_range,
|
||||
ans.get("ip_address", "(not found)"),
|
||||
ans.get("ip_address", "(not found using ip addr show)"),
|
||||
)
|
||||
|
||||
if found_address is None:
|
||||
# attempt to get ip address using ifconfig
|
||||
command = (
|
||||
"ssh -i {IdentityFile} -p {Port} "
|
||||
"-oStrictHostKeyChecking={StrictHostKeyChecking} "
|
||||
"-oUserKnownHostsFile={UserKnownHostsFile} "
|
||||
"-oControlPath=none "
|
||||
"{User}@{HostName} ifconfig".format(**ssh_config)
|
||||
)
|
||||
|
||||
log.info(
|
||||
"Trying ssh -p %(Port)s %(User)s@%(HostName)s ifconfig", ssh_config
|
||||
)
|
||||
reply = __salt__["cmd.shell"](command)
|
||||
log.info("ifconfig returned:\n%s", reply)
|
||||
target_network_range = ipaddress.ip_network(network_mask, strict=False)
|
||||
|
||||
for line in reply.split("\n"):
|
||||
try: # try to find a bridged network address
|
||||
# the lines we are looking for appear like:
|
||||
# "inet addr:10.124.31.185 Bcast:10.124.31.255 Mask:255.255.248.0"
|
||||
# or "inet6 addr: fe80::a00:27ff:fe04:7aac/64 Scope:Link"
|
||||
tokens = line.replace(
|
||||
"addr:", "", 1
|
||||
).split() # remove "addr:" if it exists, then split
|
||||
found_address = None
|
||||
if "inet" in tokens:
|
||||
nxt = tokens.index("inet") + 1
|
||||
found_address = ipaddress.ip_address(tokens[nxt])
|
||||
elif "inet6" in tokens:
|
||||
nxt = tokens.index("inet6") + 1
|
||||
found_address = ipaddress.ip_address(tokens[nxt].split("/")[0])
|
||||
if found_address in target_network_range:
|
||||
ans["ip_address"] = str(found_address)
|
||||
break # we have located a good matching address
|
||||
except (IndexError, AttributeError, TypeError):
|
||||
pass # all syntax and type errors loop here
|
||||
# falling out if the loop leaves us remembering the last candidate
|
||||
log.info(
|
||||
"Network IP address in %s detected as: %s",
|
||||
target_network_range,
|
||||
ans.get("ip_address", "(not found using ifconfig)"),
|
||||
)
|
||||
|
||||
if get_private_key:
|
||||
# retrieve the Vagrant private key from the host
|
||||
try:
|
||||
|
@ -637,6 +687,6 @@ def get_ssh_config(name, network_mask="", get_private_key=False):
|
|||
ans["private_key"] = salt.utils.stringutils.to_unicode(pks.read())
|
||||
except OSError as e:
|
||||
raise CommandExecutionError(
|
||||
"Error processing Vagrant private key file: {}".format(e)
|
||||
f"Error processing Vagrant private key file: {e}"
|
||||
)
|
||||
return ans
|
||||
|
|
|
@ -4650,7 +4650,7 @@ class _policy_info:
|
|||
"""
|
||||
add quotes around the string
|
||||
"""
|
||||
return '"{}"'.format(val)
|
||||
return f'"{val}"'
|
||||
|
||||
@classmethod
|
||||
def _binary_enable_zero_disable_one_conversion(cls, val, **kwargs):
|
||||
|
@ -4664,7 +4664,7 @@ class _policy_info:
|
|||
elif ord(val) == 1:
|
||||
return "Enabled"
|
||||
else:
|
||||
return "Invalid Value: {!r}".format(val)
|
||||
return f"Invalid Value: {val!r}"
|
||||
else:
|
||||
return "Not Defined"
|
||||
except TypeError:
|
||||
|
@ -4806,9 +4806,9 @@ class _policy_info:
|
|||
try:
|
||||
userSid = win32security.LookupAccountSid("", _sid)
|
||||
if userSid[1]:
|
||||
userSid = "{1}\\{0}".format(userSid[0], userSid[1])
|
||||
userSid = f"{userSid[1]}\\{userSid[0]}"
|
||||
else:
|
||||
userSid = "{}".format(userSid[0])
|
||||
userSid = f"{userSid[0]}"
|
||||
# TODO: This needs to be more specific
|
||||
except Exception: # pylint: disable=broad-except
|
||||
userSid = win32security.ConvertSidToStringSid(_sid)
|
||||
|
@ -5000,7 +5000,7 @@ def _updateNamespace(item, new_namespace):
|
|||
temp_item = item.tag[i + 1 :]
|
||||
else:
|
||||
temp_item = item.tag
|
||||
item.tag = "{{{0}}}{1}".format(new_namespace, temp_item)
|
||||
item.tag = f"{{{new_namespace}}}{temp_item}"
|
||||
for child in item.getiterator():
|
||||
if isinstance(child.tag, str):
|
||||
temp_item = ""
|
||||
|
@ -5009,7 +5009,7 @@ def _updateNamespace(item, new_namespace):
|
|||
temp_item = child.tag[i + 1 :]
|
||||
else:
|
||||
temp_item = child.tag
|
||||
child.tag = "{{{0}}}{1}".format(new_namespace, temp_item)
|
||||
child.tag = f"{{{new_namespace}}}{temp_item}"
|
||||
return item
|
||||
|
||||
|
||||
|
@ -5077,10 +5077,10 @@ def _parse_xml(adm_file):
|
|||
|
||||
modified_xml = ""
|
||||
with salt.utils.files.fopen(adm_file, "rb") as rfh:
|
||||
file_hash = "{:X}".format(zlib.crc32(rfh.read()) & 0xFFFFFFFF)
|
||||
file_hash = f"{zlib.crc32(rfh.read()) & 0xFFFFFFFF:X}"
|
||||
|
||||
name, ext = os.path.splitext(os.path.basename(adm_file))
|
||||
hashed_filename = "{}-{}{}".format(name, file_hash, ext)
|
||||
hashed_filename = f"{name}-{file_hash}{ext}"
|
||||
|
||||
cache_dir = os.path.join(__opts__["cachedir"], "lgpo", "policy_defs")
|
||||
if not os.path.exists(cache_dir):
|
||||
|
@ -5092,7 +5092,7 @@ def _parse_xml(adm_file):
|
|||
log.debug("LGPO: Generating policy template cache for %s%s", name, ext)
|
||||
|
||||
# Remove old files, keep the cache clean
|
||||
file_list = glob.glob(os.path.join(cache_dir, "{}*{}".format(name, ext)))
|
||||
file_list = glob.glob(os.path.join(cache_dir, f"{name}*{ext}"))
|
||||
for file_path in file_list:
|
||||
os.remove(file_path)
|
||||
|
||||
|
@ -5650,7 +5650,7 @@ def _set_advaudit_value(option, value):
|
|||
"""
|
||||
# Set the values in both audit.csv files
|
||||
if not _set_advaudit_file_data(option=option, value=value):
|
||||
raise CommandExecutionError("Failed to set audit.csv option: {}".format(option))
|
||||
raise CommandExecutionError(f"Failed to set audit.csv option: {option}")
|
||||
# Apply the settings locally
|
||||
if not _set_advaudit_pol_data(option=option, value=value):
|
||||
# Only log this error, it will be in effect the next time the machine
|
||||
|
@ -5695,7 +5695,7 @@ def _get_netsh_value(profile, option):
|
|||
|
||||
def _set_netsh_value(profile, section, option, value):
|
||||
if section not in ("firewallpolicy", "settings", "logging", "state"):
|
||||
raise ValueError("LGPO: Invalid section: {}".format(section))
|
||||
raise ValueError(f"LGPO: Invalid section: {section}")
|
||||
log.trace(
|
||||
"LGPO: Setting the following\nProfile: %s\nSection: %s\nOption: %s\nValue: %s",
|
||||
profile,
|
||||
|
@ -5739,7 +5739,7 @@ def _load_secedit_data():
|
|||
Returns:
|
||||
str: The contents of the file generated by the secedit command
|
||||
"""
|
||||
f_exp = os.path.join(__opts__["cachedir"], "secedit-{}.txt".format(UUID))
|
||||
f_exp = os.path.join(__opts__["cachedir"], f"secedit-{UUID}.txt")
|
||||
try:
|
||||
__salt__["cmd.run"](["secedit", "/export", "/cfg", f_exp])
|
||||
with salt.utils.files.fopen(f_exp, encoding="utf-16") as fp:
|
||||
|
@ -5789,7 +5789,7 @@ def _write_secedit_data(inf_data):
|
|||
# Set file names
|
||||
# The database must persist in order for the settings to remain in effect
|
||||
f_sdb = os.path.join(os.getenv("WINDIR"), "security", "database", "salt.sdb")
|
||||
f_inf = os.path.join(__opts__["cachedir"], "secedit-{}.inf".format(UUID))
|
||||
f_inf = os.path.join(__opts__["cachedir"], f"secedit-{UUID}.inf")
|
||||
|
||||
try:
|
||||
# Write the changes to the inf file
|
||||
|
@ -5949,9 +5949,7 @@ def _getAdmlPresentationRefId(adml_data, ref_id):
|
|||
"""
|
||||
helper function to check for a presentation label for a policy element
|
||||
"""
|
||||
search_results = adml_data.xpath(
|
||||
'//*[@*[local-name() = "refId"] = "{}"]'.format(ref_id)
|
||||
)
|
||||
search_results = adml_data.xpath(f'//*[@*[local-name() = "refId"] = "{ref_id}"]')
|
||||
alternate_label = ""
|
||||
if search_results:
|
||||
for result in search_results:
|
||||
|
@ -6217,7 +6215,7 @@ def _encode_string(value):
|
|||
elif not isinstance(value, str):
|
||||
# Should we raise an error here, or attempt to cast to a string
|
||||
raise TypeError(
|
||||
"Value {} is not a string type\nType: {}".format(repr(value), type(value))
|
||||
f"Value {repr(value)} is not a string type\nType: {type(value)}"
|
||||
)
|
||||
return b"".join([value.encode("utf-16-le"), encoded_null])
|
||||
|
||||
|
@ -6258,7 +6256,7 @@ def _buildKnownDataSearchString(
|
|||
encoded_semicolon,
|
||||
chr(registry.vtype[reg_vtype]).encode("utf-32-le"),
|
||||
encoded_semicolon,
|
||||
chr(len(" {}".format(chr(0)).encode("utf-16-le"))).encode("utf-32-le"),
|
||||
chr(len(f" {chr(0)}".encode("utf-16-le"))).encode("utf-32-le"),
|
||||
encoded_semicolon,
|
||||
" ".encode("utf-16-le"),
|
||||
encoded_null,
|
||||
|
@ -6438,7 +6436,7 @@ def _processValueItem(
|
|||
encoded_semicolon,
|
||||
chr(registry.vtype[this_vtype]).encode("utf-32-le"),
|
||||
encoded_semicolon,
|
||||
chr(len(" {}".format(chr(0)).encode("utf-16-le"))).encode(
|
||||
chr(len(f" {chr(0)}".encode("utf-16-le"))).encode(
|
||||
"utf-32-le"
|
||||
),
|
||||
encoded_semicolon,
|
||||
|
@ -6493,7 +6491,7 @@ def _processValueItem(
|
|||
encoded_semicolon,
|
||||
chr(
|
||||
len(
|
||||
"{}{}".format(element_values[i], chr(0)).encode(
|
||||
f"{element_values[i]}{chr(0)}".encode(
|
||||
"utf-16-le"
|
||||
)
|
||||
)
|
||||
|
@ -6524,9 +6522,7 @@ def _processValueItem(
|
|||
encoded_semicolon,
|
||||
chr(registry.vtype[this_vtype]).encode("utf-32-le"),
|
||||
encoded_semicolon,
|
||||
chr(len(" {}".format(chr(0)).encode("utf-16-le"))).encode(
|
||||
"utf-32-le"
|
||||
),
|
||||
chr(len(f" {chr(0)}".encode("utf-16-le"))).encode("utf-32-le"),
|
||||
encoded_semicolon,
|
||||
" ".encode("utf-16-le"),
|
||||
encoded_null,
|
||||
|
@ -6590,9 +6586,7 @@ def _processValueItem(
|
|||
encoded_semicolon,
|
||||
chr(registry.vtype[this_vtype]).encode("utf-32-le"),
|
||||
encoded_semicolon,
|
||||
chr(len(" {}".format(chr(0)).encode("utf-16-le"))).encode(
|
||||
"utf-32-le"
|
||||
),
|
||||
chr(len(f" {chr(0)}".encode("utf-16-le"))).encode("utf-32-le"),
|
||||
encoded_semicolon,
|
||||
" ".encode("utf-16-le"),
|
||||
encoded_null,
|
||||
|
@ -6644,10 +6638,10 @@ def _checkAllAdmxPolicies(
|
|||
if policy_file_data:
|
||||
log.trace("POLICY CLASS %s has file data", policy_class)
|
||||
policy_filedata_split = re.sub(
|
||||
salt.utils.stringutils.to_bytes(r"\]{}$".format(chr(0))),
|
||||
salt.utils.stringutils.to_bytes(rf"\]{chr(0)}$"),
|
||||
b"",
|
||||
re.sub(
|
||||
salt.utils.stringutils.to_bytes(r"^\[{}".format(chr(0))),
|
||||
salt.utils.stringutils.to_bytes(rf"^\[{chr(0)}"),
|
||||
b"",
|
||||
re.sub(
|
||||
re.escape(REG_POL_HEADER.encode("utf-16-le")),
|
||||
|
@ -6661,7 +6655,7 @@ def _checkAllAdmxPolicies(
|
|||
# Get the policy for each item defined in Registry.pol
|
||||
for policy_item in policy_filedata_split:
|
||||
policy_item_key = (
|
||||
policy_item.split("{};".format(chr(0)).encode("utf-16-le"))[0]
|
||||
policy_item.split(f"{chr(0)};".encode("utf-16-le"))[0]
|
||||
.decode("utf-16-le")
|
||||
.lower()
|
||||
)
|
||||
|
@ -6927,7 +6921,7 @@ def _checkAllAdmxPolicies(
|
|||
|
||||
if etree.QName(child_item).localname == "boolean":
|
||||
# https://msdn.microsoft.com/en-us/library/dn605978(v=vs.85).aspx
|
||||
if child_item is not None:
|
||||
if len(child_item) > 0:
|
||||
if (
|
||||
TRUE_VALUE_XPATH(child_item)
|
||||
and this_element_name not in configured_elements
|
||||
|
@ -7424,7 +7418,7 @@ def _build_parent_list(policy_definition, return_full_policy_names, adml_languag
|
|||
parent_list = []
|
||||
policy_namespace = next(iter(policy_definition.nsmap))
|
||||
parent_category = policy_definition.xpath(
|
||||
"{}:parentCategory/@ref".format(policy_namespace),
|
||||
f"{policy_namespace}:parentCategory/@ref",
|
||||
namespaces=policy_definition.nsmap,
|
||||
)
|
||||
admx_policy_definitions = _get_policy_definitions(language=adml_language)
|
||||
|
@ -7495,14 +7489,14 @@ def _admx_policy_parent_walk(
|
|||
)
|
||||
path.append(this_parent_name)
|
||||
if tparent_category.xpath(
|
||||
"{}:parentCategory/@ref".format(policy_namespace), namespaces=policy_nsmap
|
||||
f"{policy_namespace}:parentCategory/@ref", namespaces=policy_nsmap
|
||||
):
|
||||
# parent has a parent
|
||||
path = _admx_policy_parent_walk(
|
||||
path=path,
|
||||
policy_namespace=policy_namespace,
|
||||
parent_category=tparent_category.xpath(
|
||||
"{}:parentCategory/@ref".format(policy_namespace),
|
||||
f"{policy_namespace}:parentCategory/@ref",
|
||||
namespaces=policy_nsmap,
|
||||
)[0],
|
||||
policy_nsmap=policy_nsmap,
|
||||
|
@ -8534,7 +8528,7 @@ def _lookup_admin_template(policy_name, policy_class, adml_language="en-US"):
|
|||
False,
|
||||
None,
|
||||
[],
|
||||
"Unable to find {} policy {}".format(policy_class, policy_name),
|
||||
f"Unable to find {policy_class} policy {policy_name}",
|
||||
)
|
||||
|
||||
|
||||
|
@ -9195,7 +9189,7 @@ def _get_policy_adm_setting(
|
|||
)
|
||||
if etree.QName(child_item).localname == "boolean":
|
||||
# https://msdn.microsoft.com/en-us/library/dn605978(v=vs.85).aspx
|
||||
if child_item is not None:
|
||||
if len(child_item) > 0:
|
||||
if (
|
||||
TRUE_VALUE_XPATH(child_item)
|
||||
and this_element_name not in configured_elements
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue