Skip to content

Commit

Permalink
Fix _get_preboot
Browse files Browse the repository at this point in the history
  • Loading branch information
matyldv committed Aug 28, 2024
1 parent 138f49e commit 4c2e4f2
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/ralph/deployment/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from ralph.admin.helpers import get_client_ip
from ralph.assets.models import Ethernet
from ralph.deployment.models import Deployment
from ralph.deployment.models import Deployment, Preboot
from ralph.deployment.utils import _render_configuration

logger = logging.getLogger(__name__)
Expand All @@ -24,12 +24,13 @@ def get_object_or_404_with_message(model, msg, logger_args, **kwargs):
def _get_preboot(deployment_id):
error_msg = 'Deployment with UUID: %s doesn\'t exist'
try:
return get_object_or_404_with_message(
preboot_id = get_object_or_404_with_message(
model=Deployment,
msg=error_msg,
logger_args=[deployment_id],
id=deployment_id
).preboot
return Preboot.objects.get(id=preboot_id)
except ValueError:
logger.warning('Incorrect UUID: %s', deployment_id)
raise SuspiciousOperation('Malformed UUID')
Expand Down

0 comments on commit 4c2e4f2

Please sign in to comment.