BlueGit

projects-timfalken-com verhalenboek

Guard: genormaliseerd pad

timfa

Authored 2026-10-25 · 3 weeks ago

Hash
eb5f9f42676bcdfac0e7c6b13f1d4051e60fb935
Parent
d54b6820
Pipeline
Passed
2 files changed +2 −1
ci/deploy_guard.py +1 −1
@@ -65,7 +65,7 @@ def project_dir(environ):
65 65 f'dat zou de hele website overschrijven.')
66 66 if root and root not in ('/', '.') and norm.startswith('/') and not norm.startswith(root + '/'):
67 67 raise DeployGuardError(f'DEPLOY GEBLOKKEERD: {PROJECT_VAR} ligt niet onder {ROOT_VAR}.')
68 return value
68 return norm
69 69
70 70
71 71 def main(environ=None):
@@ -65,7 +65,7 @@ def project_dir(environ):
65 f'dat zou de hele website overschrijven.')
65 f'dat zou de hele website overschrijven.')
66 if root and root not in ('/', '.') and norm.startswith('/') and not norm.startswith(root + '/'):
66 if root and root not in ('/', '.') and norm.startswith('/') and not norm.startswith(root + '/'):
67 raise DeployGuardError(f'DEPLOY GEBLOKKEERD: {PROJECT_VAR} ligt niet onder {ROOT_VAR}.')
67 raise DeployGuardError(f'DEPLOY GEBLOKKEERD: {PROJECT_VAR} ligt niet onder {ROOT_VAR}.')
68 return value
68 return norm
69
69
70
70
71def main(environ=None):
71def main(environ=None):
ci/test_deploy.py +1 −0
@@ -105,6 +105,7 @@ class DeployGuardTests(unittest.TestCase):
105 105 self.assertEqual(project_dir(env),'/domains/projects.timfalken.com/public_html/verhaaltjesboek')
106 106 self.assertIn('cd "/domains/projects.timfalken.com/public_html/verhaaltjesboek"',deployment_commands(env,ROOT/'web'))
107 107 self.assertEqual(project_dir(dict(self.BASE,projectftp='verhaaltjesboek')),'verhaaltjesboek')
108 self.assertEqual(project_dir(dict(self.BASE,timftproot='/r/',projectftp='$timftproot/vb/')),'/r/vb')
108 109
109 110 def test_cli_exit_code_and_no_values(self):
110 111 import io,contextlib
@@ -105,6 +105,7 @@ class DeployGuardTests(unittest.TestCase):
105 self.assertEqual(project_dir(env),'/domains/projects.timfalken.com/public_html/verhaaltjesboek')
105 self.assertEqual(project_dir(env),'/domains/projects.timfalken.com/public_html/verhaaltjesboek')
106 self.assertIn('cd "/domains/projects.timfalken.com/public_html/verhaaltjesboek"',deployment_commands(env,ROOT/'web'))
106 self.assertIn('cd "/domains/projects.timfalken.com/public_html/verhaaltjesboek"',deployment_commands(env,ROOT/'web'))
107 self.assertEqual(project_dir(dict(self.BASE,projectftp='verhaaltjesboek')),'verhaaltjesboek')
107 self.assertEqual(project_dir(dict(self.BASE,projectftp='verhaaltjesboek')),'verhaaltjesboek')
108 self.assertEqual(project_dir(dict(self.BASE,timftproot='/r/',projectftp='$timftproot/vb/')),'/r/vb')
108
109
109 def test_cli_exit_code_and_no_values(self):
110 def test_cli_exit_code_and_no_values(self):
110 import io,contextlib
111 import io,contextlib