-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
avoid unnecessary breakage by leaving old names available with deprecation warnings
- Loading branch information
Showing
7 changed files
with
164 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
from traitlets import Unicode | ||
from .fileprovider import TraefikFileProviderProxy | ||
|
||
|
||
class TraefikTomlProxy(TraefikFileProviderProxy): | ||
"""Deprecated alias for file provider""" | ||
toml_dynamic_config_file = Unicode( | ||
config=True, | ||
).tag( | ||
deprecated_in="0.4", | ||
deprecated_for="TraefikFileProvider.dynamic_config_file", | ||
) | ||
def __init__(self, **kwargs): | ||
super().__init__(**kwargs) | ||
self.log.warning("TraefikTomlProxy is deprecated in jupyterhub-traefik-proxy 0.4. Use `c.JupyterHub.proxy_class = 'traefik_file'") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
from traitlets.config import Config | ||
|
||
from jupyterhub_traefik_proxy.toml import TraefikTomlProxy | ||
from jupyterhub_traefik_proxy.etcd import TraefikEtcdProxy | ||
from jupyterhub_traefik_proxy.consul import TraefikConsulProxy | ||
|
||
def test_toml_deprecation(caplog): | ||
cfg = Config() | ||
cfg.TraefikTomlProxy.toml_static_config_file = 'deprecated-static.toml' | ||
cfg.TraefikTomlProxy.toml_dynamic_config_file = 'deprecated-dynamic.toml' | ||
p = TraefikTomlProxy(config=cfg) | ||
assert p.static_config_file == 'deprecated-static.toml' | ||
|
||
assert p.dynamic_config_file == 'deprecated-dynamic.toml' | ||
|
||
log = '\n'.join([ | ||
record.msg | ||
for record in caplog.records | ||
]) | ||
assert 'TraefikFileProvider.dynamic_config_file instead' in log | ||
assert 'static_config_file instead' in log | ||
|
||
def test_etcd_deprecation(caplog): | ||
cfg = Config() | ||
cfg.TraefikEtcdProxy.kv_url = "http://1.2.3.4:12345" | ||
cfg.TraefikEtcdProxy.kv_username = "user" | ||
cfg.TraefikEtcdProxy.kv_password = "pass" | ||
|
||
p = TraefikEtcdProxy(config=cfg) | ||
assert p.etcd_url=="http://1.2.3.4:12345" | ||
assert p.etcd_username == "user" | ||
assert p.etcd_password == "pass" | ||
|
||
log = '\n'.join([ | ||
record.msg | ||
for record in caplog.records | ||
]) | ||
assert 'TraefikEtcdProxy.etcd_url instead' in log | ||
assert 'TraefikEtcdProxy.etcd_username instead' in log | ||
assert 'TraefikEtcdProxy.etcd_password instead' in log | ||
|
||
|
||
def test_consul_deprecation(caplog): | ||
cfg = Config() | ||
cfg.TraefikConsulProxy.kv_url = "http://1.2.3.4:12345" | ||
cfg.TraefikConsulProxy.kv_username = "user" | ||
cfg.TraefikConsulProxy.kv_password = "pass" | ||
|
||
p = TraefikConsulProxy(config=cfg) | ||
assert p.consul_url=="http://1.2.3.4:12345" | ||
assert p.consul_username == "user" | ||
assert p.consul_password == "pass" | ||
|
||
log = '\n'.join([ | ||
record.msg | ||
for record in caplog.records | ||
]) | ||
assert 'TraefikConsulProxy.consul_url instead' in log | ||
assert 'TraefikConsulProxy.consul_username instead' in log | ||
assert 'TraefikConsulProxy.consul_password instead' in log |