diff --git a/src/devcenter/HISTORY.rst b/src/devcenter/HISTORY.rst index ceee452deee..804912f6300 100644 --- a/src/devcenter/HISTORY.rst +++ b/src/devcenter/HISTORY.rst @@ -2,6 +2,10 @@ Release History =============== +6.2.2 +++++++ +* Fix delay all and delay dev box/environment action if no next scheduled time + 6.2.1 ++++++ * Fix environment data plane command examples diff --git a/src/devcenter/azext_devcenter/custom.py b/src/devcenter/azext_devcenter/custom.py index 347931493b8..3379259a9d2 100644 --- a/src/devcenter/azext_devcenter/custom.py +++ b/src/devcenter/azext_devcenter/custom.py @@ -1299,7 +1299,9 @@ def devcenter_dev_box_delay_action( "action_name": action_name }) - upcoming_action_time = upcoming_action["next"]["scheduledTime"] + upcoming_action_time = upcoming_action.get("next", {}).get("scheduledTime") + if not upcoming_action_time: + raise ResourceNotFoundError("There are no upcoming scheduled times for this action.") action_time = datetime.strptime(upcoming_action_time, "%Y-%m-%dT%H:%M:%S.%fZ") delayed_time = get_delayed_time(delay_time, action_time) @@ -1673,7 +1675,9 @@ def devcenter_environment_delay_action( "action_name": action_name }) - upcoming_action_time = upcoming_action["next"]["scheduledTime"] + upcoming_action_time = upcoming_action.get("next", {}).get("scheduledTime") + if not upcoming_action_time: + raise ResourceNotFoundError("There are no upcoming scheduled times for this action.") action_time = datetime.strptime(upcoming_action_time, "%Y-%m-%dT%H:%M:%S.%fZ") delayed_time = get_delayed_time(delay_time, action_time) diff --git a/src/devcenter/azext_devcenter/utils.py b/src/devcenter/azext_devcenter/utils.py index 663cd19d5ad..6418a5e5d97 100644 --- a/src/devcenter/azext_devcenter/utils.py +++ b/src/devcenter/azext_devcenter/utils.py @@ -83,8 +83,8 @@ def get_project_data(cli_ctx, dev_center_name, project_name=None): def get_earliest_time(action_iterator): earliest_time = None for action in action_iterator: - if action["next"] is not None: - action_string = action["next"]["scheduledTime"] + action_string = action.get("next", {}).get("scheduledTime") + if action_string: action_time = datetime.strptime(action_string, "%Y-%m-%dT%H:%M:%S.%fZ") if earliest_time is None or action_time < earliest_time: earliest_time = action_time diff --git a/src/devcenter/setup.py b/src/devcenter/setup.py index 3360c0cf89b..e4d2be47c6a 100644 --- a/src/devcenter/setup.py +++ b/src/devcenter/setup.py @@ -10,7 +10,7 @@ from setuptools import setup, find_packages # HISTORY.rst entry. -VERSION = '6.2.1' +VERSION = '6.2.2' try: from azext_devcenter.manual.version import VERSION except ImportError: