Skip to content

Commit

Permalink
[SDAAP-24] fix ability to run single data updates from planning.
Browse files Browse the repository at this point in the history
  • Loading branch information
marwoodandrew committed Oct 20, 2022
1 parent ffbe50b commit 4aba0ca
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion superdesk/commands/data_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ class DataUpdateCommand(superdesk.Command):
"-i",
dest="data_update_id",
required=False,
choices=get_data_updates_files(strip_file_extension=True),
help="Data update id to run last",
),
superdesk.Option(
Expand Down Expand Up @@ -181,6 +180,10 @@ class Upgrade(DataUpdateCommand):
"""

def run(self, data_update_id=None, fake=False, dry=False):
if data_update_id and data_update_id not in get_data_updates_files(strip_file_extension=True):
print("Error argument --id/-i: invalid choice: '{}'"
" (choose from {})".format(data_update_id, get_data_updates_files(strip_file_extension=True)))
return
super().run(data_update_id, fake, dry)
data_updates_files = self.data_updates_files
# drops updates that already have been applied
Expand Down Expand Up @@ -218,6 +221,10 @@ class Downgrade(DataUpdateCommand):
"""

def run(self, data_update_id=None, fake=False, dry=False):
if data_update_id and data_update_id not in get_data_updates_files(strip_file_extension=True):
print("Error argument --id/-i: invalid choice: '{}'"
" (choose from {})".format(data_update_id, get_data_updates_files(strip_file_extension=True)))
return
super().run(data_update_id, fake, dry)
data_updates_files = self.data_updates_files
# check if there is something to downgrade
Expand Down

0 comments on commit 4aba0ca

Please sign in to comment.