container: Fix the update command for new web server

Closes: #2109.

We moved from Nginx to Apache on ftp.freedombox.org. This changed the datetime
format in the index pages we were relying on to find the difference with local
image. Update this datetime format.

Tests:

- Run ./container update with an old image already in the .container directory.
New image will be downloaded and verified.

- Run ./container update immediately after downloading the latest image. No new
download is done.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2021-09-11 20:41:16 -04:00
1 parent ae541ca752
commit 0e22eb6c6e
1 file changed
+2 -3
+2 -3
View File
@@ -928,9 +928,8 @@ def _get_latest_image_timestamp(distribution):
url = URLS[distribution]
response = urlopen(url[0:url.rindex('/')])
page_contents = response.read().decode()
str_time = re.findall(r'\d{2}-[A-Z][a-z]{2}-\d{4} \d{2}:\d{2}',
page_contents)[0]
return datetime.datetime.strptime(str_time, '%d-%b-%Y %H:%M').timestamp()
str_time = re.findall(r'\d{4}-\d{2}-\d{2} \d{2}:\d{2}', page_contents)[0]
return datetime.datetime.strptime(str_time, '%Y-%m-%d %H:%M').timestamp()
def _is_update_required(distribution):