batou 2.6.2__tar.gz → 2.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {batou-2.6.2/src/batou.egg-info → batou-2.7.0}/PKG-INFO +19 -6
- {batou-2.6.2 → batou-2.7.0}/pyproject.toml +1 -1
- batou-2.7.0/requirements-dev.txt +40 -0
- {batou-2.6.2 → batou-2.7.0}/setup.py +4 -4
- {batou-2.6.2 → batou-2.7.0}/src/batou/deploy.py +36 -14
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/file.py +7 -9
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/mysql.py +2 -2
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/tests/test_file.py +8 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/main.py +8 -4
- {batou-2.6.2 → batou-2.7.0}/src/batou/provision.py +15 -2
- {batou-2.6.2 → batou-2.7.0}/src/batou/secrets/__init__.py +40 -8
- {batou-2.6.2 → batou-2.7.0}/src/batou/secrets/encryption.py +119 -1
- {batou-2.6.2 → batou-2.7.0}/src/batou/secrets/manage.py +3 -2
- {batou-2.6.2 → batou-2.7.0}/src/batou/secrets/tests/test_manage.py +63 -4
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/test_endtoend.py +3 -5
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/test_provision.py +14 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/test_utils.py +34 -21
- {batou-2.6.2 → batou-2.7.0}/src/batou/utils.py +0 -1
- batou-2.7.0/src/batou/version.txt +1 -0
- {batou-2.6.2 → batou-2.7.0/src/batou.egg-info}/PKG-INFO +19 -6
- batou-2.6.2/requirements-dev.txt +0 -20
- batou-2.6.2/src/batou/version.txt +0 -1
- {batou-2.6.2 → batou-2.7.0}/CHANGES.history.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/LICENSE.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/MANIFEST.in +0 -0
- {batou-2.6.2 → batou-2.7.0}/README.md +0 -0
- {batou-2.6.2 → batou-2.7.0}/doc/source/api/component.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/doc/source/api/environment.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/doc/source/api/templates.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/doc/source/api/utilities.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/doc/source/cli/index.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/doc/source/components/cmmi.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/doc/source/components/downloads-vcs.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/doc/source/components/files.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/doc/source/components/python.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/doc/source/components/services.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/doc/source/dev/authors.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/doc/source/dev/contributing.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/doc/source/dev/testing.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/doc/source/dev/todo.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/doc/source/index.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/doc/source/upgrading.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/doc/source/user/advanced.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/doc/source/user/install.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/doc/source/user/installation-deb.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/doc/source/user/installation-rpm.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/doc/source/user/intro.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/doc/source/user/quickstart.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/examples/api/index.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/examples/api/requirements.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/examples/django/requirements.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/examples/durations/requirements.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/examples/errors/requirements.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/examples/errors2/requirements.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/examples/errorsnohost/requirements.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/examples/ignores/requirements.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/examples/largetempl/requirements.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/examples/package/requirements.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/examples/sensitive-values/environments/local/age_keys.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/examples/sensitive-values/requirements.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/examples/sync_async/requirements.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/examples/tutorial-buildout/requirements.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/examples/tutorial-component/requirements.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/examples/tutorial-helloworld/requirements.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/examples/tutorial-parallelize/requirements.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/examples/tutorial-provision-container/requirements.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/examples/tutorial-secrets/environments/age/age_keys.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/examples/tutorial-secrets/environments/age-diffable/age_keys.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/examples/tutorial-secrets/requirements.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/examples/vagrant/requirements.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/examples/vagrant-multi/requirements.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/examples/venvs/environments/requirements.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/examples/venvs/requirements.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/setup.cfg +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/__init__.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/_output.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/agent.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/c.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/component.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/conftest.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/environment.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/fixtures.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/host.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/init-template/.hgignore +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/init-template/components/example/component.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/init-template/environments/dev.cfg +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/insecure-private.key +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/__init__.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/appenv.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/archive.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/buildout.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/cmmi.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/cron.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/debian.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/download.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/git.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/goceptnet.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/logrotate.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/mercurial.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/nagios.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/package.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/python.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/resources/check_supervisor.py.in +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/resources/crontab +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/resources/init.sh +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/resources/logrotate.in +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/resources/nagios.cfg +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/resources/nrpe.cfg +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/resources/supervisor.buildout.cfg +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/resources/supervisor.conf +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/service.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/supervisor.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/svn.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/tests/__init__.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/tests/test_appenv.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/tests/test_archive.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/tests/test_buildout.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/tests/test_cmmi.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/tests/test_cron.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/tests/test_debian.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/tests/test_download.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/tests/test_git.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/tests/test_mercurial.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/tests/test_mysql.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/tests/test_nagios.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/tests/test_python.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/tests/test_service.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/tests/test_supervisor.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/lib/tests/test_svn.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/migrate/__init__.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/migrate/migrations/2300.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/migrate/migrations/2301.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/migrate/migrations/2302.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/migrate/migrations/2303.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/migrate/migrations/2400.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/migrate/migrations/__init__.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/migrate/tests/__init__.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/migrate/tests/test_migrate.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/remote_core.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/repository.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/resources.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/secrets/edit.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/secrets/tests/__init__.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/secrets/tests/test_editor.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/secrets/tests/test_secrets.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/template.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/__init__.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/conftest.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/ellipsis.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/basic_service/.batou.json +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/basic_service/components/zeo/component.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/basic_service/components/zope/component.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/basic_service/environments/dev/environment.cfg +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/basic_service/environments/production/environment.cfg +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/component/haproxy.cfg +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/sample_service/.batou.json +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/sample_service/components/hello/component.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/sample_service/environments/test-multiple-components/environment.cfg +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/sample_service/environments/test-multiple-hosts/environment.cfg +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/sample_service/environments/test-overlapping-components/environment.cfg +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/sample_service/environments/test-resolver/environment.cfg +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/sample_service/environments/test-resolver-invalid/environment.cfg +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/sample_service/environments/test-resources-host/environment.cfg +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/sample_service/environments/test-unused/environment.cfg +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/sample_service/environments/test-with-check-local/environment.cfg +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/sample_service/environments/test-with-env-config/environment.cfg +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/sample_service/environments/test-with-overrides/environment.cfg +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/sample_service/environments/test-with-provide-require/environment.cfg +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/sample_service/environments/test-with-vfs-sandbox/environment.cfg +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/sample_service/environments/test-without-env-config/environment.cfg +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/service_early_resource/.batou.json +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/service_early_resource/components/zeo/component.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/service_early_resource/components/zope/component.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/service_early_resource/environments/dev/environment.cfg +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/template/haproxy.cfg +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/fixture/template/haproxy.cfg.jinja2 +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/test_bootstrap.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/test_component.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/test_config.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/test_dependencies.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/test_deploy.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/test_environment.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/test_exceptions.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/test_host.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/test_main.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/test_remote.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/test_remote_core.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/test_repository.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/test_resources.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/test_template.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/tests/test_vfs.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou/vfs.py +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou.egg-info/SOURCES.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou.egg-info/dependency_links.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou.egg-info/entry_points.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou.egg-info/not-zip-safe +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou.egg-info/requires.txt +0 -0
- {batou-2.6.2 → batou-2.7.0}/src/batou.egg-info/top_level.txt +0 -0
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: batou
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.7.0
|
|
4
4
|
Summary: A utility for automating multi-host, multi-environment software builds and deployments.
|
|
5
5
|
Home-page: https://batou.readthedocs.io/en/latest/
|
|
6
6
|
Author: Christian Theune
|
|
7
7
|
Author-email: ct@flyingcircus.io
|
|
8
|
-
License: BSD
|
|
8
|
+
License: BSD-2-Clause
|
|
9
9
|
Keywords: deployment
|
|
10
|
-
Classifier: License :: OSI Approved :: BSD License
|
|
11
10
|
Classifier: Programming Language :: Python
|
|
12
11
|
Classifier: Programming Language :: Python :: 3
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.6
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
15
12
|
Classifier: Programming Language :: Python :: 3.8
|
|
16
13
|
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
17
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
18
|
Requires-Python: >=3.6
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
@@ -34,6 +34,19 @@ Requires-Dist: pytest; extra == "test"
|
|
|
34
34
|
Requires-Dist: pytest-coverage; extra == "test"
|
|
35
35
|
Requires-Dist: pytest-instafail; extra == "test"
|
|
36
36
|
Requires-Dist: pytest-timeout; extra == "test"
|
|
37
|
+
Dynamic: author
|
|
38
|
+
Dynamic: author-email
|
|
39
|
+
Dynamic: classifier
|
|
40
|
+
Dynamic: description
|
|
41
|
+
Dynamic: description-content-type
|
|
42
|
+
Dynamic: home-page
|
|
43
|
+
Dynamic: keywords
|
|
44
|
+
Dynamic: license
|
|
45
|
+
Dynamic: license-file
|
|
46
|
+
Dynamic: provides-extra
|
|
47
|
+
Dynamic: requires-dist
|
|
48
|
+
Dynamic: requires-python
|
|
49
|
+
Dynamic: summary
|
|
37
50
|
|
|
38
51
|
<img width="150" src="https://batou.readthedocs.io/en/latest/_static/batou.png">
|
|
39
52
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
-e .[test]
|
|
2
|
+
|
|
3
|
+
# batou runtime dependencies (pinned from examples/*/requirements.lock)
|
|
4
|
+
ConfigUpdater==3.2
|
|
5
|
+
Jinja2==3.1.4
|
|
6
|
+
MarkupSafe==2.1.5
|
|
7
|
+
PyYAML==6.0.1
|
|
8
|
+
certifi==2024.7.4
|
|
9
|
+
chardet==5.2.0
|
|
10
|
+
charset-normalizer==3.3.2
|
|
11
|
+
execnet==2.0.2
|
|
12
|
+
idna==3.7
|
|
13
|
+
importlib-metadata==6.7.0
|
|
14
|
+
importlib-resources==5.12.0
|
|
15
|
+
py==1.11.0
|
|
16
|
+
remote-pdb==2.1.0
|
|
17
|
+
requests==2.31.0
|
|
18
|
+
setuptools==68.0.0
|
|
19
|
+
typing_extensions==4.7.1
|
|
20
|
+
urllib3==2.0.7
|
|
21
|
+
zipp==3.15.0
|
|
22
|
+
|
|
23
|
+
# dev tools
|
|
24
|
+
appdirs==1.4.4
|
|
25
|
+
cfgv==3.2.0
|
|
26
|
+
distlib==0.3.8
|
|
27
|
+
filelock==3.12.2
|
|
28
|
+
identify==1.5.9
|
|
29
|
+
nodeenv==1.5.0
|
|
30
|
+
packaging==24.0
|
|
31
|
+
pluggy==1.2.0
|
|
32
|
+
pre-commit==2.15.0
|
|
33
|
+
pyparsing==2.4.7
|
|
34
|
+
pyproject-api==1.5.3
|
|
35
|
+
six==1.15.0
|
|
36
|
+
toml==0.10.2
|
|
37
|
+
tox==4.7.0
|
|
38
|
+
virtualenv==20.26.6
|
|
39
|
+
sphinx==5.3.0
|
|
40
|
+
recommonmark==0.7.1
|
|
@@ -44,17 +44,17 @@ setup(
|
|
|
44
44
|
""",
|
|
45
45
|
author="Christian Theune",
|
|
46
46
|
author_email="ct@flyingcircus.io",
|
|
47
|
-
license="BSD
|
|
47
|
+
license="BSD-2-Clause",
|
|
48
48
|
url="https://batou.readthedocs.io/en/latest/",
|
|
49
49
|
keywords="deployment",
|
|
50
50
|
classifiers="""\
|
|
51
|
-
License :: OSI Approved :: BSD License
|
|
52
51
|
Programming Language :: Python
|
|
53
52
|
Programming Language :: Python :: 3
|
|
54
|
-
Programming Language :: Python :: 3.6
|
|
55
|
-
Programming Language :: Python :: 3.7
|
|
56
53
|
Programming Language :: Python :: 3.8
|
|
57
54
|
Programming Language :: Python :: 3.9
|
|
55
|
+
Programming Language :: Python :: 3.10
|
|
56
|
+
Programming Language :: Python :: 3.11
|
|
57
|
+
Programming Language :: Python :: 3.12
|
|
58
58
|
Programming Language :: Python :: 3 :: Only
|
|
59
59
|
"""[
|
|
60
60
|
:-1
|
|
@@ -111,6 +111,7 @@ class Deployment(object):
|
|
|
111
111
|
timeout,
|
|
112
112
|
dirty,
|
|
113
113
|
jobs,
|
|
114
|
+
consistency_only=False,
|
|
114
115
|
predict_only=False,
|
|
115
116
|
check_and_predict_local=False,
|
|
116
117
|
provision_rebuild=False,
|
|
@@ -125,11 +126,18 @@ class Deployment(object):
|
|
|
125
126
|
self.environment.deployment = self
|
|
126
127
|
|
|
127
128
|
self.dirty = dirty
|
|
129
|
+
self.consistency_only = consistency_only
|
|
128
130
|
self.predict_only = predict_only
|
|
129
131
|
self.jobs = jobs
|
|
130
132
|
|
|
131
133
|
self.timer = Timer("deployment")
|
|
132
134
|
|
|
135
|
+
@property
|
|
136
|
+
def local_consistency_check(self):
|
|
137
|
+
return (
|
|
138
|
+
self.consistency_only and self.environment.check_and_predict_local
|
|
139
|
+
)
|
|
140
|
+
|
|
133
141
|
def load(self):
|
|
134
142
|
output.section("Preparing")
|
|
135
143
|
|
|
@@ -176,7 +184,10 @@ class Deployment(object):
|
|
|
176
184
|
|
|
177
185
|
def _connections(self):
|
|
178
186
|
self.environment.prepare_connect()
|
|
179
|
-
|
|
187
|
+
if self.local_consistency_check:
|
|
188
|
+
hosts = sorted(self.environment.hosts)[:1]
|
|
189
|
+
else:
|
|
190
|
+
hosts = sorted(self.environment.hosts)
|
|
180
191
|
sem = threading.Semaphore(5)
|
|
181
192
|
for i, hostname in enumerate(hosts, 1):
|
|
182
193
|
host = self.environment.hosts[hostname]
|
|
@@ -191,21 +202,25 @@ class Deployment(object):
|
|
|
191
202
|
icon="⏭️",
|
|
192
203
|
)
|
|
193
204
|
continue
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
205
|
+
if not self.local_consistency_check:
|
|
206
|
+
output.step(
|
|
207
|
+
hostname,
|
|
208
|
+
"Connecting via {} ({}/{})".format(
|
|
209
|
+
self.environment.connect_method,
|
|
210
|
+
i,
|
|
211
|
+
len(hosts),
|
|
212
|
+
),
|
|
213
|
+
icon="🌐",
|
|
214
|
+
)
|
|
203
215
|
c = Connector(host, sem)
|
|
204
216
|
c.start()
|
|
205
217
|
yield c
|
|
206
218
|
|
|
207
219
|
def connect(self):
|
|
208
|
-
|
|
220
|
+
if self.consistency_only and self.environment.check_and_predict_local:
|
|
221
|
+
output.section("LOCAL CONSISTENCY CHECK")
|
|
222
|
+
else:
|
|
223
|
+
output.section("Connecting hosts and configuring model ...")
|
|
209
224
|
# Consume the connection iterator to start all remaining connections
|
|
210
225
|
# but do not wait for them to be joined.
|
|
211
226
|
with self.timer.step("connect"):
|
|
@@ -344,9 +359,15 @@ class Deployment(object):
|
|
|
344
359
|
output.section("Summary")
|
|
345
360
|
for node in list(self.environment.hosts.values()):
|
|
346
361
|
node.summarize()
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
362
|
+
|
|
363
|
+
if self.consistency_only:
|
|
364
|
+
output.annotate(
|
|
365
|
+
f"Consistency check took {self.timer.humanize('total')}"
|
|
366
|
+
)
|
|
367
|
+
else:
|
|
368
|
+
output.annotate(
|
|
369
|
+
f"Deployment took {self.timer.humanize('total', 'connect', 'deploy')}"
|
|
370
|
+
)
|
|
350
371
|
|
|
351
372
|
def disconnect(self):
|
|
352
373
|
output.step("main", "Disconnecting from nodes ...", debug=True)
|
|
@@ -393,6 +414,7 @@ def main(
|
|
|
393
414
|
timeout,
|
|
394
415
|
dirty,
|
|
395
416
|
jobs,
|
|
417
|
+
consistency_only,
|
|
396
418
|
predict_only,
|
|
397
419
|
check_and_predict_local,
|
|
398
420
|
provision_rebuild,
|
|
@@ -351,26 +351,24 @@ def limited_buffer(iterator, limit, lead, separator="...", logdir="/tmp"):
|
|
|
351
351
|
# This is a memory optimization: don't ever keep the whole iterator in
|
|
352
352
|
# memory!
|
|
353
353
|
end_buffer = []
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
354
|
+
with tempfile.NamedTemporaryFile(
|
|
355
|
+
"a+", suffix=".diff", dir=logdir, delete=False
|
|
356
|
+
) as diff_log_file:
|
|
357
|
+
for line in start_buffer:
|
|
358
|
+
diff_log_file.write(line + "\n")
|
|
359
359
|
for line in iterator:
|
|
360
360
|
line = line.rstrip()
|
|
361
361
|
diff_log_file.write(line + "\n")
|
|
362
362
|
end_buffer.append(line)
|
|
363
363
|
if len(end_buffer) > lead:
|
|
364
364
|
end_buffer.pop(0)
|
|
365
|
-
finally:
|
|
366
|
-
diff_log_file.close()
|
|
367
365
|
# If we ended up with output in the end buffer, we need to merge the
|
|
368
366
|
# output.
|
|
369
367
|
if end_buffer:
|
|
370
368
|
start_buffer = start_buffer[:lead] + [separator] + end_buffer
|
|
371
369
|
limit_triggered = True
|
|
372
370
|
|
|
373
|
-
return start_buffer, limit_triggered,
|
|
371
|
+
return start_buffer, limit_triggered, diff_log_file.name
|
|
374
372
|
|
|
375
373
|
|
|
376
374
|
class ManagedContentBase(FileComponent):
|
|
@@ -757,7 +755,7 @@ class Purge(Component):
|
|
|
757
755
|
|
|
758
756
|
def update(self):
|
|
759
757
|
for filename in glob.glob(self.pattern):
|
|
760
|
-
if os.path.isdir(filename):
|
|
758
|
+
if os.path.isdir(filename) and not os.path.islink(filename):
|
|
761
759
|
shutil.rmtree(filename)
|
|
762
760
|
else:
|
|
763
761
|
os.remove(filename)
|
|
@@ -28,8 +28,8 @@ class Command(Component):
|
|
|
28
28
|
self.unless = self.expand(self.unless)
|
|
29
29
|
|
|
30
30
|
def _mysql(self, cmd):
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
with tempfile.NamedTemporaryFile("w", suffix="sql", delete=False) as f:
|
|
32
|
+
self.tmp = f.name
|
|
33
33
|
f.write(cmd + "\n")
|
|
34
34
|
|
|
35
35
|
command = []
|
|
@@ -1147,6 +1147,14 @@ def test_purge_globs_and_deletes_files(root):
|
|
|
1147
1147
|
assert sorted(os.listdir("work/mycomponent")) == []
|
|
1148
1148
|
|
|
1149
1149
|
|
|
1150
|
+
def test_purge_deletes_symlink_to_directory(root):
|
|
1151
|
+
os.mkdir("work/mycomponent/somedir")
|
|
1152
|
+
os.symlink("work/mycomponent/somedir", "work/mycomponent/mylink")
|
|
1153
|
+
root.component += Purge("mylink")
|
|
1154
|
+
root.component.deploy()
|
|
1155
|
+
assert sorted(os.listdir("work/mycomponent")) == ["somedir"]
|
|
1156
|
+
|
|
1157
|
+
|
|
1150
1158
|
def test_syncdirectory_needs_update_on_nonexisting_target(root):
|
|
1151
1159
|
os.mkdir("work/mycomponent/existing_dir")
|
|
1152
1160
|
open("work/mycomponent/existing_dir/test_file", "w").close()
|
|
@@ -26,8 +26,7 @@ def main(args: Optional[list] = None) -> None:
|
|
|
26
26
|
)
|
|
27
27
|
parser = argparse.ArgumentParser(
|
|
28
28
|
description=(
|
|
29
|
-
"batou v{}: multi-(host|component|environment|version|platform)"
|
|
30
|
-
" deployment"
|
|
29
|
+
"batou v{}: multi-(host|component|environment|version|platform) deployment"
|
|
31
30
|
).format(version),
|
|
32
31
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
|
|
33
32
|
)
|
|
@@ -73,8 +72,7 @@ def main(args: Optional[list] = None) -> None:
|
|
|
73
72
|
"-P",
|
|
74
73
|
"--predict-only",
|
|
75
74
|
action="store_true",
|
|
76
|
-
help="Only predict what updates would happen. "
|
|
77
|
-
"Do not change anything.",
|
|
75
|
+
help="Only predict what updates would happen. Do not change anything.",
|
|
78
76
|
)
|
|
79
77
|
p.add_argument(
|
|
80
78
|
"-L",
|
|
@@ -189,6 +187,12 @@ def main(args: Optional[list] = None) -> None:
|
|
|
189
187
|
default="",
|
|
190
188
|
help="The environments to update. Update all if not specified.",
|
|
191
189
|
)
|
|
190
|
+
p.add_argument(
|
|
191
|
+
"-f",
|
|
192
|
+
"--force",
|
|
193
|
+
action="store_true",
|
|
194
|
+
help="Force re-encryption even if keys have not changed.",
|
|
195
|
+
)
|
|
192
196
|
p.set_defaults(func=batou.secrets.manage.reencrypt)
|
|
193
197
|
|
|
194
198
|
p = sp.add_parser(
|
|
@@ -4,6 +4,7 @@ import os.path
|
|
|
4
4
|
import tempfile
|
|
5
5
|
import textwrap
|
|
6
6
|
import uuid
|
|
7
|
+
from configparser import RawConfigParser
|
|
7
8
|
|
|
8
9
|
import requests
|
|
9
10
|
|
|
@@ -12,6 +13,11 @@ from batou import output
|
|
|
12
13
|
from batou.utils import cmd
|
|
13
14
|
|
|
14
15
|
|
|
16
|
+
def bool_arg(arg: str, state: bool) -> str:
|
|
17
|
+
toggle = "no-" if not state else ""
|
|
18
|
+
return f"--{toggle}{arg}"
|
|
19
|
+
|
|
20
|
+
|
|
15
21
|
class Provisioner(object):
|
|
16
22
|
rebuild = False
|
|
17
23
|
|
|
@@ -30,7 +36,6 @@ class Provisioner(object):
|
|
|
30
36
|
|
|
31
37
|
|
|
32
38
|
class FCDevVM(Provisioner):
|
|
33
|
-
|
|
34
39
|
target_host = None
|
|
35
40
|
aliases = ()
|
|
36
41
|
memory = None
|
|
@@ -39,6 +44,7 @@ class FCDevVM(Provisioner):
|
|
|
39
44
|
|
|
40
45
|
hydra_eval = "" # deprecated
|
|
41
46
|
channel_url = ""
|
|
47
|
+
update_channel: bool = True
|
|
42
48
|
image_url = ""
|
|
43
49
|
|
|
44
50
|
SEED_TEMPLATE = """\
|
|
@@ -81,7 +87,7 @@ fi
|
|
|
81
87
|
if [ -n "$PROVISION_HYDRA_EVAL" ]; then
|
|
82
88
|
cli_args="${{cli_args}} --hydra-eval $PROVISION_HYDRA_EVAL"
|
|
83
89
|
else
|
|
84
|
-
cli_args="${{cli_args}} --image-url $PROVISION_IMAGE --channel-url $PROVISION_CHANNEL"
|
|
90
|
+
cli_args="${{cli_args}} --image-url $PROVISION_IMAGE --channel-url $PROVISION_CHANNEL $PROVISION_UPDATE_CHANNEL"
|
|
85
91
|
fi
|
|
86
92
|
|
|
87
93
|
ssh $PROVISION_HOST sudo fc-devhost ensure \\
|
|
@@ -232,6 +238,9 @@ Host {hostname} {aliases}
|
|
|
232
238
|
"PROVISION_ALIASES": " ".join(host.aliases.keys()),
|
|
233
239
|
"PROVISION_HYDRA_EVAL": self.hydra_eval,
|
|
234
240
|
"PROVISION_CHANNEL": self.channel_url,
|
|
241
|
+
"PROVISION_UPDATE_CHANNEL": bool_arg(
|
|
242
|
+
"update-channel", self.update_channel
|
|
243
|
+
),
|
|
235
244
|
"PROVISION_IMAGE": self.image_url,
|
|
236
245
|
"PROVISION_VM_MEMORY": self.memory,
|
|
237
246
|
"PROVISION_VM_CORES": self.cores,
|
|
@@ -399,6 +408,10 @@ Host {hostname} {aliases}
|
|
|
399
408
|
instance.memory = section["memory"]
|
|
400
409
|
instance.cores = section["cores"]
|
|
401
410
|
instance.disk_size = section.get("disk_size", None)
|
|
411
|
+
c = RawConfigParser()
|
|
412
|
+
instance.update_channel = c._convert_to_boolean(
|
|
413
|
+
section.get("update_channel", "true")
|
|
414
|
+
)
|
|
402
415
|
|
|
403
416
|
if "release" in section:
|
|
404
417
|
resp = requests.get(section["release"])
|
|
@@ -335,10 +335,12 @@ class ConfigFileSecretProvider(SecretProvider):
|
|
|
335
335
|
secret_files[filename] = file.decrypted
|
|
336
336
|
return secret_files
|
|
337
337
|
|
|
338
|
-
def write_secret_files(
|
|
338
|
+
def write_secret_files(
|
|
339
|
+
self, secret_files: Dict[str, bytes], reencrypt: bool = False
|
|
340
|
+
):
|
|
339
341
|
for name, content in secret_files.items():
|
|
340
342
|
with self._get_file(name, writeable=True) as file:
|
|
341
|
-
self.write_file(file, content)
|
|
343
|
+
self.write_file(file, content, reencrypt)
|
|
342
344
|
|
|
343
345
|
def purge(self, except_files: Dict[str, EncryptedFile] = {}):
|
|
344
346
|
for name, file in self.iter_secret_files(writeable=True).items():
|
|
@@ -379,14 +381,16 @@ class ConfigFileSecretProvider(SecretProvider):
|
|
|
379
381
|
def _get_file(self, name: str, writeable: bool) -> EncryptedFile:
|
|
380
382
|
raise NotImplementedError("_get_file() not implemented.")
|
|
381
383
|
|
|
382
|
-
def write_file(
|
|
384
|
+
def write_file(
|
|
385
|
+
self, file: EncryptedFile, content: bytes, reencrypt: bool = False
|
|
386
|
+
):
|
|
383
387
|
recipients = self._get_recipients_for_encryption()
|
|
384
388
|
if not recipients:
|
|
385
389
|
raise ValueError(
|
|
386
390
|
"No recipients found for environment. "
|
|
387
391
|
"Please add a 'batou.members' section to the secrets file."
|
|
388
392
|
)
|
|
389
|
-
file.write(content, recipients)
|
|
393
|
+
file.write(content, recipients, reencrypt)
|
|
390
394
|
|
|
391
395
|
def write_config_new(self, content: bytes):
|
|
392
396
|
self.config_file.writeable = True
|
|
@@ -443,6 +447,29 @@ class GPGSecretProvider(ConfigFileSecretProvider):
|
|
|
443
447
|
def _get_recipients_for_encryption(self) -> List[str]:
|
|
444
448
|
return self._get_recipients()
|
|
445
449
|
|
|
450
|
+
def _check_keys_changed(self, recipients: List[str]) -> bool:
|
|
451
|
+
"""Check if the recipients have changed compared to the encrypted file.
|
|
452
|
+
|
|
453
|
+
Returns True if keys have changed or if we cannot determine.
|
|
454
|
+
"""
|
|
455
|
+
if not self.config_file.path.exists():
|
|
456
|
+
return True
|
|
457
|
+
|
|
458
|
+
old_recipients = self.config_file._extract_recipients()
|
|
459
|
+
if old_recipients is None:
|
|
460
|
+
return True
|
|
461
|
+
|
|
462
|
+
old_keyids = set(old_recipients)
|
|
463
|
+
new_keyids = set()
|
|
464
|
+
|
|
465
|
+
for recipient in recipients:
|
|
466
|
+
keyid = self.config_file._recipient_to_keyid(recipient)
|
|
467
|
+
if not keyid:
|
|
468
|
+
return True
|
|
469
|
+
new_keyids.add(keyid)
|
|
470
|
+
|
|
471
|
+
return old_keyids != new_keyids
|
|
472
|
+
|
|
446
473
|
def write_config(self, content: bytes, force_reencrypt: bool = False):
|
|
447
474
|
config = ConfigUpdater().read_string(content.decode("utf-8"))
|
|
448
475
|
secret_provider = config.get("batou", "secret_provider", fallback=None)
|
|
@@ -464,12 +491,16 @@ class GPGSecretProvider(ConfigFileSecretProvider):
|
|
|
464
491
|
raise ValueError(
|
|
465
492
|
"Please add at least one recipient to the secrets file."
|
|
466
493
|
)
|
|
494
|
+
keys_changed = self._check_keys_changed(recipients)
|
|
467
495
|
self.config_file.write(
|
|
468
496
|
str(config).encode("utf-8"),
|
|
469
497
|
recipients,
|
|
470
|
-
reencrypt=force_reencrypt,
|
|
498
|
+
reencrypt=keys_changed or force_reencrypt,
|
|
499
|
+
)
|
|
500
|
+
|
|
501
|
+
self.write_secret_files(
|
|
502
|
+
self.read_secret_files(), reencrypt=keys_changed or force_reencrypt
|
|
471
503
|
)
|
|
472
|
-
self.write_secret_files(self.read_secret_files())
|
|
473
504
|
|
|
474
505
|
|
|
475
506
|
def process_age_recipients(members, environment_path):
|
|
@@ -627,8 +658,9 @@ class AGESecretProvider(ConfigFileSecretProvider):
|
|
|
627
658
|
recipients,
|
|
628
659
|
reencrypt=keys_changed or force_reencrypt,
|
|
629
660
|
)
|
|
630
|
-
|
|
631
|
-
self.
|
|
661
|
+
self.write_secret_files(
|
|
662
|
+
self.read_secret_files(), reencrypt=keys_changed or force_reencrypt
|
|
663
|
+
)
|
|
632
664
|
|
|
633
665
|
|
|
634
666
|
class DiffableAGESecretProvider(AGESecretProvider):
|
|
@@ -156,6 +156,87 @@ class GPGEncryptedFile(EncryptedFile):
|
|
|
156
156
|
) from e
|
|
157
157
|
return p.stdout
|
|
158
158
|
|
|
159
|
+
def _extract_recipients(self) -> Optional[List[str]]:
|
|
160
|
+
"""Extract recipient keyids from the encrypted file.
|
|
161
|
+
|
|
162
|
+
Returns list of 8-char keyids, or None if extraction fails.
|
|
163
|
+
"""
|
|
164
|
+
if not self.path.exists() or self.path.stat().st_size == 0:
|
|
165
|
+
return None
|
|
166
|
+
|
|
167
|
+
try:
|
|
168
|
+
result = subprocess.run(
|
|
169
|
+
[
|
|
170
|
+
self.gpg(),
|
|
171
|
+
"--list-packets",
|
|
172
|
+
"--list-options",
|
|
173
|
+
"show-unusable-subkeys",
|
|
174
|
+
str(self.path),
|
|
175
|
+
],
|
|
176
|
+
stdout=subprocess.PIPE,
|
|
177
|
+
stderr=subprocess.PIPE,
|
|
178
|
+
check=False,
|
|
179
|
+
)
|
|
180
|
+
output = result.stdout.decode("utf-8")
|
|
181
|
+
recipients = []
|
|
182
|
+
for line in output.splitlines():
|
|
183
|
+
if "keyid" in line:
|
|
184
|
+
keyid = line.split("keyid")[-1].strip()
|
|
185
|
+
if keyid and len(keyid) >= 8:
|
|
186
|
+
# Extract the last 8 characters (keyid is at least 8 chars)
|
|
187
|
+
recipients.append(keyid[-8:])
|
|
188
|
+
return recipients if recipients else None
|
|
189
|
+
except Exception:
|
|
190
|
+
return None
|
|
191
|
+
|
|
192
|
+
def _recipient_to_keyid(self, recipient: str) -> Optional[str]:
|
|
193
|
+
"""Convert a recipient (email, keyid, or fingerprint) to 8-char keyid.
|
|
194
|
+
|
|
195
|
+
Returns None if recipient cannot be found in keyring.
|
|
196
|
+
"""
|
|
197
|
+
recipient = recipient.strip()
|
|
198
|
+
# If it's already a short keyid (8 chars), return it
|
|
199
|
+
if len(recipient) == 8 and recipient.isalnum():
|
|
200
|
+
return recipient
|
|
201
|
+
# If it's a longer keyid or fingerprint, extract the last 8 chars
|
|
202
|
+
if len(recipient) >= 8 and recipient.replace(" ", "").isalnum():
|
|
203
|
+
return recipient[-8:]
|
|
204
|
+
|
|
205
|
+
# For email addresses or other formats, look up in GPG keyring
|
|
206
|
+
try:
|
|
207
|
+
result = subprocess.run(
|
|
208
|
+
[self.gpg(), "--list-keys", "--with-colons", recipient],
|
|
209
|
+
stdout=subprocess.PIPE,
|
|
210
|
+
stderr=subprocess.PIPE,
|
|
211
|
+
check=False,
|
|
212
|
+
)
|
|
213
|
+
output = result.stdout.decode("utf-8")
|
|
214
|
+
for line in output.splitlines():
|
|
215
|
+
# Look for fingerprint field (fpr:) and extract last 8 chars
|
|
216
|
+
if line.startswith("fpr:"):
|
|
217
|
+
parts = line.split(":")
|
|
218
|
+
if len(parts) > 9:
|
|
219
|
+
fpr = parts[9]
|
|
220
|
+
if fpr and len(fpr) >= 8:
|
|
221
|
+
keyid = fpr[-8:]
|
|
222
|
+
# If this keyid matches our recipient (in case it's a short keyid),
|
|
223
|
+
# return it to handle the case where a short keyid is used in config
|
|
224
|
+
# but the actual full keyid/fingerprint is in the keyring
|
|
225
|
+
if keyid == recipient:
|
|
226
|
+
return keyid
|
|
227
|
+
# Return the last fingerprint's keyid if no exact match found
|
|
228
|
+
for line in reversed(output.splitlines()):
|
|
229
|
+
if line.startswith("fpr:"):
|
|
230
|
+
parts = line.split(":")
|
|
231
|
+
if len(parts) > 9:
|
|
232
|
+
fpr = parts[9]
|
|
233
|
+
if fpr and len(fpr) >= 8:
|
|
234
|
+
return fpr[-8:]
|
|
235
|
+
except Exception:
|
|
236
|
+
pass
|
|
237
|
+
|
|
238
|
+
return None
|
|
239
|
+
|
|
159
240
|
def _write(
|
|
160
241
|
self, content: bytes, recipients: List[str], reencrypt: bool = False
|
|
161
242
|
):
|
|
@@ -163,6 +244,27 @@ class GPGEncryptedFile(EncryptedFile):
|
|
|
163
244
|
raise RuntimeError("File not locked")
|
|
164
245
|
if not self.writeable:
|
|
165
246
|
raise RuntimeError("File not writeable")
|
|
247
|
+
|
|
248
|
+
# If not forcing reencrypt, check if content has changed
|
|
249
|
+
if not reencrypt and self.path.exists():
|
|
250
|
+
try:
|
|
251
|
+
# Use the cached decrypted content if available
|
|
252
|
+
old_content = self._decrypted
|
|
253
|
+
if old_content is None:
|
|
254
|
+
# If not cached, try to decrypt
|
|
255
|
+
self._decrypted = self.decrypt()
|
|
256
|
+
old_content = self._decrypted
|
|
257
|
+
if old_content == content:
|
|
258
|
+
if debug:
|
|
259
|
+
print(
|
|
260
|
+
f"Content unchanged, skipping re-encryption of `{self.path}`",
|
|
261
|
+
file=sys.stderr,
|
|
262
|
+
)
|
|
263
|
+
return
|
|
264
|
+
except Exception:
|
|
265
|
+
# If we can't decrypt or compare, proceed with reencryption
|
|
266
|
+
pass
|
|
267
|
+
|
|
166
268
|
self.path.rename(str(self.path) + ".old")
|
|
167
269
|
old_path = pathlib.Path(str(self.path) + ".old")
|
|
168
270
|
# starting with python 3.8, pathlib.Path's rename() method
|
|
@@ -405,7 +507,23 @@ class AGEEncryptedFile(EncryptedFile):
|
|
|
405
507
|
if not self.locked:
|
|
406
508
|
raise ValueError("File is not locked")
|
|
407
509
|
if not self.writeable:
|
|
408
|
-
raise ValueError("File is not
|
|
510
|
+
raise ValueError("File is not writable")
|
|
511
|
+
|
|
512
|
+
# If not forcing reencrypt, check if content has changed
|
|
513
|
+
if not reencrypt:
|
|
514
|
+
try:
|
|
515
|
+
old_content = self.decrypted
|
|
516
|
+
if old_content == content:
|
|
517
|
+
if debug:
|
|
518
|
+
print(
|
|
519
|
+
f"Content unchanged, skipping re-encryption of `{self.path}`",
|
|
520
|
+
file=sys.stderr,
|
|
521
|
+
)
|
|
522
|
+
return
|
|
523
|
+
except Exception:
|
|
524
|
+
# If we can't decrypt or compare, proceed with reencryption
|
|
525
|
+
pass
|
|
526
|
+
|
|
409
527
|
args = [self.age(), "-e"]
|
|
410
528
|
for recipient in recipients:
|
|
411
529
|
args.extend(["-r", recipient])
|
|
@@ -69,10 +69,11 @@ def remove_user(keyid, environments, **kw):
|
|
|
69
69
|
)
|
|
70
70
|
|
|
71
71
|
|
|
72
|
-
def reencrypt(environments, **kw):
|
|
72
|
+
def reencrypt(environments, force=False, **kw):
|
|
73
73
|
"""Re-encrypt all secrets in given environments.
|
|
74
74
|
|
|
75
75
|
If environments is not given, all secrets are re-encrypted.
|
|
76
|
+
Only re-encrypts if keys have changed, unless force=True.
|
|
76
77
|
|
|
77
78
|
"""
|
|
78
79
|
environments_ = Environment.filter(environments)
|
|
@@ -82,7 +83,7 @@ def reencrypt(environments, **kw):
|
|
|
82
83
|
with environment.secret_provider.edit():
|
|
83
84
|
config = environment.secret_provider.config
|
|
84
85
|
environment.secret_provider.write_config(
|
|
85
|
-
str(config).encode("utf-8"), force_reencrypt=
|
|
86
|
+
str(config).encode("utf-8"), force_reencrypt=force
|
|
86
87
|
)
|
|
87
88
|
|
|
88
89
|
|