Skip to content

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

Merged
merged 3 commits into from
Oct 20, 2021
Merged

Conversation

skhomuti
Copy link
Contributor

Generate self-signed certs for each container
Add helpers for adcm parametrizing

Generate self-signed certs for each container
Add helpers for adcm parametrizing
@skhomuti skhomuti requested a review from a team as a code owner October 19, 2021 12:42
Sealwing
Sealwing previously approved these changes Oct 20, 2021
@@ -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:
Copy link
Contributor

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

Comment on lines 259 to 260
os.system(f"cat {tmpdir}/cert.pem {tmpdir}/key.pem > {tmpdir}/bundle.pem")
os.environ["REQUESTS_CA_BUNDLE"] = os.path.join(tmpdir, "bundle.pem")
Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

)
file = io.BytesIO()
with tarfile.open(mode="w:gz", fileobj=file) as tar:
tar.add(tmpdir, "")
Copy link
Contributor

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?

Copy link
Contributor Author

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

@skhomuti skhomuti merged commit 8a732ce into master Oct 20, 2021
@skhomuti skhomuti deleted the ADCM-2123 branch October 20, 2021 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants