-
Notifications
You must be signed in to change notification settings - Fork 1
ADCM-2123 add https fixture for adcm container #71
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
Conversation
Generate self-signed certs for each container Add helpers for adcm parametrizing
@@ -234,6 +241,29 @@ def _init_adcm_cli(self): | |||
if not self._adcm_cli: | |||
self._adcm_cli = ADCMClient(url=self._adcm.url, **self.adcm_api_credentials) | |||
|
|||
def _generate_certs(self): | |||
if self.generate_certs: |
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.
If nothing blocks it, I suggest early return
os.system(f"cat {tmpdir}/cert.pem {tmpdir}/key.pem > {tmpdir}/bundle.pem") | ||
os.environ["REQUESTS_CA_BUNDLE"] = os.path.join(tmpdir, "bundle.pem") |
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.
I suggest creating a separate variable (e.g. bundle_path
). It'll be easier to understand that we want to pass exactly the same path
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 is a special requests
variable
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.
I mean make smt like
bundle_path = os.path.join(tmpdir, "bundle.pem")
os.system(f"cat {tmpdir}/cert.pem {tmpdir}/key.pem > {bundle_path}")
os.environ["REQUESTS_CA_BUNDLE"] = bundle_path
or I got you wrong?
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.
got it
Kudos, SonarCloud Quality Gate passed!
|
) | ||
file = io.BytesIO() | ||
with tarfile.open(mode="w:gz", fileobj=file) as tar: | ||
tar.add(tmpdir, "") |
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.
Why do you specify the second argument?
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.
the default value is a filename:
archive.tar/
tmpdir/
key.pem
cert.pem
empty string allows adding file in root archive directory
archive.tar/
key.pem
cert.pem
Generate self-signed certs for each container
Add helpers for adcm parametrizing