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 2021-09-08 05:35:52 -07:00 committed by James Valleroy
parent ae541ca752
commit 0e22eb6c6e
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

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):