Commit graph

30566 commits

Author SHA1 Message Date
jeanluc
2e5ee583ab Fix saltext vault/pushover docs
* the correct organization is `salt-extensions`, not `saltstack`
* the release file is strict GitHub-flavoured Markdown only
2023-12-18 03:42:28 -07:00
James Howe
bf26f62a25 Improve augeas example
As pointed out by #65352, the check given here is not safe.
2023-12-17 22:14:18 -07:00
OrangeDog
85324ab63a pre-commit augeas.py 2023-12-17 22:14:18 -07:00
James Howe
218a8c9cca Remove warning that related to now-unsupported systems 2023-12-17 22:14:18 -07:00
Daniel Wozniak
b8c72db128 Merge pull request #65716 from dwoz/merge-forward
[master] Merge forward 3006.x
2023-12-17 21:57:55 -07:00
Daniel A. Wozniak
c88ea27d36 Skip RC test on Photon OS 2023-12-17 20:18:14 -07:00
Daniel A. Wozniak
0744177cd7 Merge remote-tracking branch 'saltstack/3006.x' into merge-forward 2023-12-17 14:58:34 -07:00
Daniel A. Wozniak
15e5e33939 Even more reliable pillar timeout test 2023-12-17 14:57:27 -07:00
Roald Nefs
98367436b2 Fix pre-commit
Signed-off-by: Roald Nefs <info@roaldnefs.com>
2023-12-16 18:26:29 -07:00
Wayne Werner
2d1746c791 Fix potential bug, add changelog
In the source for redis, the default value for password is None, not "".
If the default is an empty string that may cause some unintended
consequences -- though it's entirely possible that Redis does not
support empty passwords, it's always safer to match the underlying
existing codebase.
2023-12-16 18:26:29 -07:00
Marno van der Molen
41fc95ab76 Add password support to Redis returner 2023-12-16 18:26:29 -07:00
Daniel A. Wozniak
251774aded Fix pre-commit 2023-12-16 16:03:26 -07:00
Daniel A. Wozniak
2710c0668d Merge remote-tracking branch 'saltstack/3006.x' into merge-forward 2023-12-16 15:35:16 -07:00
Daniel A. Wozniak
60a1d31e19 Make cluster tests more stable 2023-12-16 15:31:00 -07:00
Pablo Suárez Hernández
dbeb44bdd4 Add unit tests to check path is expanded 2023-12-16 14:48:10 -07:00
Michael Calmer
4d26ff49d0 lint and precommit fixes 2023-12-16 04:49:17 -07:00
Michael Calmer
4e8be2e5a7 make gpgautomimport a named option 2023-12-16 04:49:17 -07:00
Michael Calmer
71ef92ad0a Change versionadded to next major version
Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com>
2023-12-16 04:49:17 -07:00
Michael Calmer
e28e721bf6 fix zypperpkg test after adding more success return codes 2023-12-16 04:49:17 -07:00
Michael Calmer
dcd5c05158 Add comment explaining success return codes
Co-authored-by: Pablo Suárez Hernández <psuarezhernandez@suse.com>
2023-12-16 04:49:17 -07:00
Michael Calmer
3531fd07bd ignore no repos defined exit code 2023-12-16 04:49:17 -07:00
Michael Calmer
5e388d588f call refresh_db with kwargs where possible 2023-12-16 04:49:17 -07:00
Michael Calmer
4e22d1fc11 call refresh_db function from mod_repo 2023-12-16 04:49:17 -07:00
Michael Calmer
cb8d6e80f8 add support for gpgautoimport to refresh_db in the zypperpkg module 2023-12-16 04:49:17 -07:00
Jason Woods
a1ae9cccf5 fix: Enable port modification in state selinux.port_policy_present 2023-12-16 04:34:23 -07:00
jeanluc
c1ac77d842 Run pyupgrade 2023-12-16 04:32:10 -07:00
jeanluc
5d48537179 Correct scene33 hash + regen sigs after rebase
It seems the file lost a space character, making the tests fail
2023-12-16 04:32:10 -07:00
jeanluc
ba2b208b3b Add signature verification to file.managed/archive.extracted 2023-12-16 04:32:10 -07:00
Megan Wilhite
3aed9b5ced Fix pre-commit 2023-12-16 04:31:08 -07:00
Megan Wilhite
0d457c8b36 fix pre-commit 2023-12-16 04:31:08 -07:00
Michael Calmer
6dbae07ad0 skip lines without colon 2023-12-16 04:31:08 -07:00
Michael Calmer
5194da6438 Update Docs
Co-authored-by: Megan Wilhite <mwilhite@vmware.com>
2023-12-16 04:31:08 -07:00
Michael Calmer
6f9105c752 adapt old tests to changed function 2023-12-16 04:31:08 -07:00
Michael Calmer
bd02c1ebe5 add testcase for remove and removeptf 2023-12-16 04:31:08 -07:00
Michael Calmer
59a321874a handle ptf packages inside of normal pkg.remove function 2023-12-16 04:31:08 -07:00
Frode Gundersen
a3ed549fd1 migrate test_tomcat to pytest 2023-12-16 01:30:53 -07:00
Pedro Algarvio
040c0fe7e6 Set the right path for the config file
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
2023-12-16 01:30:01 -07:00
Frode Gundersen
2e0019870f migrate unit_states_test_grains to pytest 2023-12-16 01:30:01 -07:00
Alan Somers
28a74cb511 sysrc.get: be more quiet
sysrc.get is frequently used by states like sysrc.absent, where it is
expected that the variable will not be present.  So don't write errors
to the log file.
2023-12-16 01:28:09 -07:00
jeanluc
cd8cb61196 Make x509_v2 compound match detection use match runner 2023-12-16 01:27:15 -07:00
nicholasmhughes
099962909f add tests for file.serialize check_cmd usage 2023-12-16 01:19:19 -07:00
jeanluc
4ace69d13d Rewrite vault core, issue AppRoles to minions (#62684)
* Rewrite vault core, orchestrate AppRoles for minions

This commit represents a fundamental rewrite in how Salt interacts with
Vault. The master should still be compatible with minions running the
old code. There should be no breaking changes to public interfaces and
the old configuration format should still apply.

Core:
- Issue AppRoles to minions
- Manage entities with templatable metadata for minions
- Use inbuilt Salt cache
- Separate config cache from token cache
- Cache: introduce connection-scope vs global scope

Utility module:
- Support being imported (__utils__ deprecation)
- Raise exceptions on queries to simplify response handling
- Add classes to wrap complexity, especially regarding KV v2
- Lay some groundwork for renewing tokens

Execution module:
- Add patch_secret
- Add version support to delete_secret
- Allow returning listed keys only in list_secret
- Add policy_[fetch/write/delete] and policies_list
- Add query for arbitrary API queries

State module:
- Make use of execution module
- Change output format

Docs:
- Update for new configuration format
- Correct examples
- Add configuration examples
- Add required policies

* Fix linting for rewritten vault integration

* Add pytest unit tests for utils.vault, fix found issues

* Fix old vault runner tests

* Rewrite vault sdb tests, migrate to pytests

* Adapt vault ext_pillar tests

* Adapt vault execution module tests, migrate to pytests

* Add more vault execution module unit tests

* Support python <3.7 (vault util), time-independent tests

* Add/migrate vault runner unit tests (pytest)

* Add vault state module pytests

* Fix tests lint

* Refactor Vault container fixture, move to session scope

* Fix for existing vault execution/sdb module integration tests

* Improve existing vault runner integration tests

* Fix vault test support, add list policies

* Add more functional execution module tests, fix deprecated warning

* Refactor vault pytest support

* Add integration tests, improve/fix caching/issue_params

* Improve caching behavior, fix tests

* Always use session cache as well
* Also flush session cache when requested
* Make KV metadata caching behavior configurable
* Update tests to account for changes from prev commit

* Allow to autodiscover platform default CA bundle

* Remove runner approle param overrides

There is no simple way to ensure they are kept.

* Add clear_cache runner function

* Also manage token metadata for issued secret IDs

* Cleanup tests

* Cleanup code, pylint logging suggestions

* Do not always invalidate config when verify=default

* Ensure concatted metadata lists are sorted

* Add changelog (partly)

* Work with legacy peer_run configuration as well

* Consume a token use regardless of status code

* Correct verify semantics

* Refine token uses handling, add changelog/tests for old issues

* Add changelog for main features

* Add test for issue 58580

* Fix vault docs

* Provide all old make_request functionality, add tests

* Allow token use override, add docstrings to query funcs

* Simplify config_location merge

* Cleanup

* Fix make_request warning

* Attempt to fix memory issues during CI test run

* Increase documented version

* Improve lease handling

* Refine lease ttl handling/add token lifecycle management

* Fix docs build

* Adapt formatting

* assert what you get against what you expect
* drop empty parentheses after wrapper
* use `is` to compare against strictly boolean vars

* Fix issue param overrides

* during pillar rendering, they were always reset by the master (for
  AppRoles)
* overrides were only respected for some settings (AppRoles)
* old config syntax was using the old syntax internally (tech debt)

* Introduce session-scoped cache

* Tokens with a single use left are unrenewable

* Allow override of flushing of cached leases during lookup

* Refactor cache classes, save lease data

* Rename session token cache key

* Add lease management utility

* Fix runner integration tests

after renaming the token cache key

* Do not overwrite data of cached leases after renewal

* Pass token_lifecycle to minions

* Do not fail syncing multiple approles/entities with pillar templates

* Ensure config cache expiration can be disabled

* Rename changelog files (.md)

* Declare vaultpolicylexer as parallel read safe

* Correct meta[data] payload key

For tokens it is `meta`, but for secret IDs, `metadata`.

* Reuse TCP connection

* Refactor utils module

* Ensure client is recreated after clearing cache

* Always use unwrap_client config as expected server

This should fix the test failure in the runner integration test
TestAppRoleIssuance::test_server_switch_does_not_break_minion_auth

* Ensure client is recreated after clearing cache 2

* Simulate patch for KV v1 or missing `patch` capability

* Add `patch` option to Vault SDB driver

* Reduce lease validity when revocation fails

* Extract AppRole/Identity API from runner into utils

* Revoke tokens, fire events, improve cache/exception handling

* Tokens (and therefore associated leases) are revoked when cleared by default
* It's possible to disable clearing cache when a perfectly valid token
  is available, but a PermissionDeniedError is encountered.
* UnwrapExceptions always cause an event to be fired
* It's possible to enable sending of events when
    a) cache is cleared
    b) a lease is requested from cache, but it is/will be invalid
* A VaultAuthException does not immediately lead to clearing
  the connection cache
* get_authd_client and others: multiple small enhancements and fixes

* Allow updating cached config w/o closing session

* Homogenize funcs, update docs, cleanup

* Minor internal fixes

`is_valid_for` is present on all lease-like objects, while `is_valid`
specifically should account for more, e.g. the number of uses.

The Vault API does not return 404 when a lookup fails.

* Add release note

* Address review remarks

* Fix release notes

* Remove loading minion_mods from factory

* Address other review remarks

* Add inline specification of trusted CA root cert

* Small QoL additions

* Fix lint

* Fix lint for Python >=3.8 support

* Add missing fixes

* Fix unit tests

In some cases, the `spec` calls were failing because the underlying
object was already patched

---------

Co-authored-by: Thomas Phipps <tphipps@vmware.com>
2023-12-15 21:42:08 -07:00
Zhiwei Liang
4159a00c84 Expand Linode backup integration test to include backup schedule setting test 2023-12-15 21:20:14 -07:00
Zhiwei Liang
88eccfac6f Implement salt cloud function set_backup_schedule for Linode VMs 2023-12-15 21:20:14 -07:00
Daniel A. Wozniak
9e23be093d Make pillar timeout test less flaky 2023-12-15 16:58:56 -07:00
Felippe Burk
58774e9a98 update photon paths to use their $releasever string 2023-12-15 16:45:52 -07:00
Felippe Burk
e488ac1eec Revert "update photon paths to use their $releasever string string which includes .0"
This reverts commit 1d0b29c803.
2023-12-15 13:14:23 -07:00
Felippe Burk
1d0b29c803 update photon paths to use their $releasever string string which includes .0 2023-12-15 11:13:20 -07:00
Zhiwei Liang
de9dedd829 Implement integration test case for linode with backup enabled 2023-12-15 01:17:27 -07:00
Zhiwei Liang
0db0fb555b Add backups_enabled option; improve docs 2023-12-15 01:17:27 -07:00