Commit 156dab07 authored by BAIRE Anthony's avatar BAIRE Anthony
Browse files

missing replacements 'changelog' -> 'description'

parent 155d0036
Pipeline #39492 failed with stage
in 1 minute and 11 seconds
......@@ -805,22 +805,22 @@ exec /.toolbox/bin/sshd -D
# TODO: make 'sandbox' a reserved name
if error:
changelog = "pre-commit error: " + error
log.error("sandbox %r version id %r: %s", webapp.docker_name, recover, changelog)
description = "pre-commit error: " + error
log.error("sandbox %r version id %r: %s", webapp.docker_name, recover, description)
with ses.begin():
# put all candidates in 'error state'
if recover:
ses.execute('''UPDATE dj_webapp_versions
SET changelog=CONCAT(changelog, " [", :changelog, "]"), state=:state
WHERE id IN :ids''', dict(changelog=changelog, ids=recover,
SET description=CONCAT(description, " [", :description, "]"), state=:state
WHERE id IN :ids''', dict(description=description, ids=recover,
state=int(VersionState.ERROR)))
# create a recovery version
version = WebappVersion(
webapp_id = webapp.id,
number = time.strftime("recovery-%Y%m%d-%H%M%S"),
changelog = changelog,
description = description,
published = False,
state = int(VersionState.SANDBOX))
ses.add(version)
......@@ -855,7 +855,7 @@ exec /.toolbox/bin/sshd -D
next_state = VersionState.ERROR
image_size = 0
ses.execute('''UPDATE dj_webapp_versions
SET changelog=CONCAT(changelog, " [commit error: sandbox is down]")
SET description=CONCAT(description, " [commit error: sandbox is down]")
WHERE id=%d''' % version.id)
# here we do not propagate the error to allow starting/stopping the
......@@ -1619,7 +1619,7 @@ class PushManager(Manager):
version.state = int(VersionState.READY)
else:
# overwrite an existing version
for key in "updated_at", "changelog", "published":
for key in "updated_at", "description", "published":
setattr(prev, key, getattr(version, key))
# mark this version as replaced
......
......@@ -79,7 +79,7 @@ class WebappVersion(Base):
created_at = Column(DateTime, default=datetime.datetime.now)
updated_at = Column(DateTime, default=datetime.datetime.now)
number = Column(String)
changelog = Column(String)
description = Column(String)
published = Column(Boolean)
state = Column(Integer)
......
......@@ -414,7 +414,7 @@ class ControllerTestCase(unittest.TestCase):
def add_dummy_version(self, app, number, *, append="", **kw):
update_default(kw,
state = V.READY,
changelog = "dummy version",
description = "dummy version",
published = False)
ses = self.session
......@@ -469,11 +469,11 @@ class ControllerTestCase(unittest.TestCase):
with self.session.begin():
app.sandbox_state = S.IDLE
def commit_sandbox(self, app, number, *, wait=True, stop=False, published=False, changelog="commit-sandbox", error=None, recovery=True, **kw):
def commit_sandbox(self, app, number, *, wait=True, stop=False, published=False, description="commit-sandbox", error=None, recovery=True, **kw):
ses = self.session
with ses.begin():
ver = WebappVersion(number=number, published=published, state=V.SANDBOX, changelog=changelog, **kw)
ver = WebappVersion(number=number, published=published, state=V.SANDBOX, description=description, **kw)
app.versions.append(ver)
if stop:
app.sandbox_state = S.STOPPING
......@@ -485,7 +485,7 @@ class ControllerTestCase(unittest.TestCase):
timeout=10):
self.notify()
self.assertEqual(ver.changelog, "%s [%s]" % (changelog, error))
self.assertEqual(ver.description, "%s [%s]" % (description, error))
# find the recovery version
with ses.begin():
......@@ -508,7 +508,7 @@ class ControllerTestCase(unittest.TestCase):
timeout=10):
self.notify()
self.assertEqual(ver.changelog, changelog)
self.assertEqual(ver.description, description)
return ver
......@@ -516,7 +516,7 @@ class ControllerTestCase(unittest.TestCase):
self.assertRegex(ver.number, r"\Arecovery-\d{8}-\d{6}\Z")
self.assertNotEqual(ver.number, orig.number)
self.assertEqual(ver.changelog, error)
self.assertEqual(ver.description, error)
self.assertFalse(ver.published)
self.assertIn(ver.state, (V.COMMITTED, V.READY))
......@@ -801,7 +801,7 @@ class ControllerTestCase(unittest.TestCase):
with self.check_sandbox_events(app, """
pause commit unpause
"""):
self.commit_sandbox(app, "1.0", changelog="pouet pouet")
self.commit_sandbox(app, "1.0", description="pouet pouet")
self.check_sandbox_running({app: "factory/test-busybox:latest"})
......@@ -811,7 +811,7 @@ class ControllerTestCase(unittest.TestCase):
self.assertEqual(len(app.versions), 1)
ver = app.versions[0]
self.assertEqual(ver.number, "1.0")
self.assertEqual(ver.changelog, "pouet pouet")
self.assertEqual(ver.description, "pouet pouet")
self.assertFalse(ver.published)
self.assertIn(ver.state, (V.COMMITTED, V.READY))
......@@ -828,7 +828,7 @@ class ControllerTestCase(unittest.TestCase):
with self.check_sandbox_events(app, """
kill die stop commit destroy
"""):
self.commit_sandbox(app, "1.1", changelog="blah", published=True)
self.commit_sandbox(app, "1.1", description="blah", published=True)
self.check_sandbox_running({app: False})
......@@ -838,7 +838,7 @@ class ControllerTestCase(unittest.TestCase):
self.assertEqual(len(app.versions), 1)
ver = app.versions[0]
self.assertEqual(ver.number, "1.1")
self.assertEqual(ver.changelog, "blah")
self.assertEqual(ver.description, "blah")
self.assertTrue(ver.published)
self.assertIn(ver.state, (V.COMMITTED, V.READY))
......@@ -856,7 +856,7 @@ class ControllerTestCase(unittest.TestCase):
"kill die stop commit destroy " # previous version committed
"create start die destroy create start"): # new sandbox started)
self.commit_sandbox(app, "1.1", changelog="blah", published=True)
self.commit_sandbox(app, "1.1", description="blah", published=True)
time.sleep(1)
self.check_sandbox_running({app: True})
......@@ -867,7 +867,7 @@ class ControllerTestCase(unittest.TestCase):
self.assertEqual(len(app.versions), 1)
ver = app.versions[0]
self.assertEqual(ver.number, "1.1")
self.assertEqual(ver.changelog, "blah")
self.assertEqual(ver.description, "blah")
self.assertTrue(ver.published)
self.assertIn(ver.state, (V.COMMITTED, V.READY))
......@@ -895,7 +895,7 @@ class ControllerTestCase(unittest.TestCase):
ver = app.versions[0]
self.assertRegex(ver.number, r"\Arecovery-\d{8}-\d{6}\Z")
self.assertEqual(ver.changelog, "pre-commit error: dangling sandbox")
self.assertEqual(ver.description, "pre-commit error: dangling sandbox")
self.assertFalse(ver.published)
self.assertIn(ver.state, (V.COMMITTED, V.READY))
......@@ -927,9 +927,9 @@ class ControllerTestCase(unittest.TestCase):
with ses.begin():
# add bogus versions
ses.add(WebappVersion(webapp=app, number="1.1", changelog="foo", published=True, state=V.SANDBOX))
ses.add(WebappVersion(webapp=app, number="1.2", changelog="bar", published=False, state=V.SANDBOX))
ses.add(WebappVersion(webapp=app, number="1.2", changelog="baz", published=True, state=V.SANDBOX))
ses.add(WebappVersion(webapp=app, number="1.1", description="foo", published=True, state=V.SANDBOX))
ses.add(WebappVersion(webapp=app, number="1.2", description="bar", published=False, state=V.SANDBOX))
ses.add(WebappVersion(webapp=app, number="1.2", description="baz", published=True, state=V.SANDBOX))
error = "pre-commit error: multiple candidate versions ('1.0', '1.1', '1.2', '1.2')"
......@@ -969,7 +969,7 @@ class ControllerTestCase(unittest.TestCase):
with self.check_sandbox_events(app, ""), \
mock.patch("docker.Client.commit", side_effect=DockerError):
self.commit_sandbox(app, "1.0", changelog="unchanged", wait=False)
self.commit_sandbox(app, "1.0", description="unchanged", wait=False)
self.notify()
time.sleep(1)
......@@ -984,7 +984,7 @@ class ControllerTestCase(unittest.TestCase):
# sandbox kept in same state
self.assertEqual(ver.number, "1.0")
self.assertEqual(ver.changelog, "unchanged")
self.assertEqual(ver.description, "unchanged")
self.assertEqual(ver.state, V.SANDBOX)
# try again
......@@ -1002,7 +1002,7 @@ class ControllerTestCase(unittest.TestCase):
with self.check_sandbox_events(app, "kill die stop"), \
mock.patch("docker.Client.commit", side_effect=DockerError):
self.commit_sandbox(app, "1.0", changelog="unchanged", wait=False, stop=True)
self.commit_sandbox(app, "1.0", description="unchanged", wait=False, stop=True)
self.notify()
time.sleep(1)
......@@ -1017,7 +1017,7 @@ class ControllerTestCase(unittest.TestCase):
# sandbox kept in same state
self.assertEqual(ver.number, "1.0")
self.assertEqual(ver.changelog, "unchanged")
self.assertEqual(ver.description, "unchanged")
self.assertEqual(ver.state, V.SANDBOX)
# try again
......
......@@ -368,7 +368,7 @@ class WebappSandboxPanel(LoginRequiredMixin, TemplateView):
number=number,
state=WebappVersion.SANDBOX,
published=True,
changelog=request.POST["changelog"],
description=request.POST["description"],
url="http://WTF")
webapp.sandbox_state = Webapp.STOPPING;
webapp.save()
......
......@@ -82,7 +82,7 @@ INSERT INTO dj_webapps
-- Migrate webapps version data
--
INSERT INTO dj_webapp_versions
(id, created_at, updated_at, number, changelog, docker_image_size, state, published, webapp_id)
(id, created_at, updated_at, number, description, docker_image_size, state, published, webapp_id)
SELECT *
FROM webapp_versions;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment