-
Notifications
You must be signed in to change notification settings - Fork 8
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
Docker config file defaults from environment #126
Conversation
Current coverage is 85.04%@@ master #126 diff @@
==========================================
Files 37 36 -1
Lines 1343 1344 +1
Methods 0 0
Messages 0 0
Branches 123 123
==========================================
+ Hits 1103 1143 +40
+ Misses 200 165 -35
+ Partials 40 36 -4
|
I like the fact that default values for tls parameters are extracted from |
Well, if you have the environment variables defined but the certificates are not there, you surely want an error to be raised. |
Isn't environment variables such as |
Imagine a scenario where the |
traitlet_name, | ||
d[traitlet_name]) | ||
dict_keys = d.keys() | ||
traitlet_names = traited_instance.traits().keys() |
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.
Same as traited_instance.trait_names()
Regarding the comment on the non-existence of cert/key/ca.pem files in the default cert path, whatever we decide the behaviour should be, I think there should be a test for such scenario. |
self.tls_verify = (env.get("DOCKER_TLS_VERIFY", "") != "") | ||
|
||
cert_path = env.get("DOCKER_CERT_PATH", "") | ||
if self.tls_verify or cert_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.
Should we set these defaults no matter what?
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.
No because otherwise it will enable the tls verification later on, when you generate the dict...
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.
when you generate the dict...
Can you point me to this dict please? Just wanted to understand it better.
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.
docker_config, although I noticed it creates a tls section only if you have tls_verify. It should also check for certificate paths. tls_verify == False does not imply that you don't perform tls.
Two last minor comments, good to merge then! Thanks @sbo! |
# This is docker behavior. | ||
if self.tls: | ||
params["tls"] = tls.TLSConfig( | ||
client_cert=(self.tls_cert, self.tls_key), |
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 tls
is True but tls_verify
is False, the default of tls_cert
and tls_key
are not set. Why do we need cert and key when tls
is True?
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.
Note that docker.Client(tls=True)
does completely different thing: https://github.com/docker/docker-py/blob/master/docker/client.py#L90
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.
ok, but we never have tls=True. we have it in the file config but our meaning is the same as the —tls and —tlsverify in docker as a result, we always pass a TLSConfig to the client or nothing, in that case it’s False
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 tls is True but tls_verify is False, the default of tls_cert and tls_key are not set. Why do we need cert and key when tls is True?
Yes they are. They are defined on the cert_path variable. Check the init
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 meant this:
In [1]: from remoteappmanager.file_config import FileConfig
In [2]: tmp = FileConfig(tls=True)
In [3]: tmp.tls_cert, tmp.tls_key
Out[3]: ('', '')
@sbo merge? |
Fixes #85