Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes job to fail if any plans are completed #593

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions nautobot_golden_config/nornir_plays/config_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,13 @@ def config_deployment(job_result, data, commit):

config_plan_qs = data["config_plan"]
if config_plan_qs.filter(status__slug="not-approved").exists():
logger.log_failure(
obj=None,
message="Cannot deploy configuration(s). One or more config plans are not approved.",
)
raise ValueError("Cannot deploy configuration(s). One or more config plans are not approved.")
message = "Cannot deploy configuration(s). One or more config plans are not approved."
logger.log_failure(obj=None, message=message)
raise ValueError(message)
if config_plan_qs.filter(status__slug="completed").exists():
message = "Cannot deploy configuration(s). One or more config plans are already completed."
logger.log_failure(obj=None, message=message)
raise ValueError(message)
device_qs = Device.objects.filter(config_plan__in=config_plan_qs).distinct()

try:
Expand Down