update proxy_pass regex
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
Max Erenberg 2021-12-18 12:59:48 -05:00
parent 1e30efda24
commit 3f7901d2db
2 changed files with 12 additions and 1 deletions

View File

@ -16,7 +16,7 @@ from ceo_common.logger_factory import logger_factory
from ceo_common.interfaces import IVHostManager, IConfig from ceo_common.interfaces import IVHostManager, IConfig
PROXY_PASS_IP_RE = re.compile( PROXY_PASS_IP_RE = re.compile(
r'^\s+proxy_pass\s+http://(?P<ip_address>[\d.]+(:\d{2,5})?);$' r'^\s+proxy_pass\s+http://(?P<ip_address>[\w.:-]+);$'
) )
VHOST_FILENAME_RE = re.compile(r'^(?P<username>[0-9a-z-]+)_(?P<domain>[0-9a-z.-]+)$') VHOST_FILENAME_RE = re.compile(r'^(?P<username>[0-9a-z-]+)_(?P<domain>[0-9a-z.-]+)$')
VALID_DOMAIN_RE = re.compile(r'^(?:[0-9a-z-]+\.)+[a-z]+$') VALID_DOMAIN_RE = re.compile(r'^(?:[0-9a-z-]+\.)+[a-z]+$')

View File

@ -36,6 +36,17 @@ def test_vhost_mgr(vhost_mgr):
assert vhost_mgr.get_num_vhosts(username) == 0 assert vhost_mgr.get_num_vhosts(username) == 0
os.unlink(rate_limit_file) os.unlink(rate_limit_file)
vhost_mgr.create_vhost(username, domain, ip_address + ':8000')
os.unlink(rate_limit_file)
domain3 = username + '.k8s.csclub.cloud'
vhost_mgr.create_vhost(username, domain3, 'k8s')
assert vhost_mgr.get_vhosts(username) == [
{'domain': domain, 'ip_address': ip_address + ':8000'},
{'domain': domain3, 'ip_address': 'k8s'},
]
vhost_mgr.delete_all_vhosts_for_user(username)
os.unlink(rate_limit_file)
@pytest.mark.parametrize('suffix', ['csclub.cloud', 'k8s.csclub.cloud']) @pytest.mark.parametrize('suffix', ['csclub.cloud', 'k8s.csclub.cloud'])