-
-
Notifications
You must be signed in to change notification settings - Fork 746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename [database].ssl*
options to [database].tls*
to support pymongo 4
#6250
Conversation
…l_certfile pymongo 4 will ignore the ssl_keyfile/ssl_certfile options. For consistency in st2.conf, this uses snake_case not the mongo camelCase option name. This also adds tls_certificate_key_file_password. We did not support ssl_pem_passphrase before, so there was nothing to migrate.
This needed to be a different option (instead of just renaming) because the option type is changing from str+choices to a bool. For consistency in st2.conf, this uses snake_case not the mongo camelCase option name.
For consistency in st2.conf, this uses snake_case not the mongo camelCase option name.
…tname For consistency in st2.conf, this uses snake_case not the mongo camelCase option name.
Not sure if this wasn't available before, or why it wasn't used. Try and see.
And use fix the sample default for python_binary to use python3.
@@ -64,7 +64,7 @@ async def generate_sample_conf_via_fmt( | |||
pex = await Get(VenvPex, PexFromTargetsRequest, subsystem.pex_request()) | |||
|
|||
result = await Get( | |||
FallibleProcessResult, | |||
ProcessResult, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change prevents the conf/st2.conf.sample
from being replaced if tools/config_gen.py
exits with an error. It also makes pants report the error by printing stdout from the process, which includes the traceback.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job!
pymongo 4 removes deprecated names for database connection options that were renamed some time ago. We even have a TODO about updating our usage of the deprecated names in the code:
st2/st2common/st2common/models/db/__init__.py
Lines 445 to 447 in 7d70498
One change in particular could not be supported without breaking backwards compatibility: The files for
ssl_keyfile
andssl_certfile
must be concatenated and passed as one file in the newtls_certificate_key_file
option.Why update to pymongo 4 (in a follow-up PR)? We need to update pymongo to ensure we're using a version that tests with and officially supports our target MongoDB version(s) (we are planning on using MongoDB 7; see #6246 and #6236). The pymongo4 upgrade guide has details on the option naming migration.
Each commit touches one option or aspect of this migration, so it will be useful to review each commit.
Since we're using newer
oslo.config
now, we can also be more explicit about deprecations when defining the options. So, a few of the commits make use of those newer features to improve ourst2.conf.sample
file.In summary, these options were migrated:
ssl
->tls
ssl_keyfile
+ssl_certfile
->tls_certificate_key_file
(files must be concatenated)tls_certificate_key_file_password
ssl_cert_reqs
->tls_allow_invalid_certificates
(from a string opt to a bool opt)ssl_ca_certs
->tls_ca_file
ssl_match_hostnames
->tls_allow_invalid_hostnames
(inverted meaning)Note: In #6246, I initially developed this using mongo's camelCase naming convention in st2.conf. After discussing with @nzlosh I went back to using snake_case to be consistent with the rest of the st2.conf options.