Skip to content

Commit

Permalink
fix bug #71
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Rebischke committed Jan 3, 2020
1 parent abb5429 commit 031e245
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ packer_cache/
*.box
*.swp
output-*
.vscode
11 changes: 7 additions & 4 deletions controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
import os.path

API_URL = 'https://app.vagrantup.com/api/v1/box/archlinux/archlinux'
NOW = datetime.datetime.now()
THIS_MONTH = int(NOW.strftime("%m"))
NOW = datetime.date.today()
LEN_RELEASES = 2
CWD = '/srv/arch-boxes/arch-boxes'
ISO_PATH = '/srv/ftp/iso/latest/archlinux-' + NOW.strftime(
Expand Down Expand Up @@ -58,8 +57,12 @@ def determine_missing_release(release_providers):


def is_latest(release_version):
release_month = int(release_version.split(".")[1])
return THIS_MONTH <= release_month
# we need to use .date() here, otherwise the compare is going to fail
release = datetime.datetime.strptime(release_version, "%Y.%m.%d").date()
# set the day to 1, because we only want to check for month and year
release = release.replace(day=1)
current_release = NOW.replace(day=1)
return current_release <= release


def all_released(release_providers):
Expand Down

0 comments on commit 031e245

Please sign in to comment.