Skip to content

Confusing 'conditional expression without else clause' error with a yaml error before the if statement #496

Open
@irbekrm

Description

@irbekrm

What steps did you take:

I attempted to template a yaml file with some invalid yttt syntax:

...
  - #@ "--webhook-port={}".format(webhook_port <-  MISSING PARENTHESIS
#@ if image_pull_secrets_enabled:
imagePullSecrets:
- name: #@ image_pull_secrets_name
#@ end

What happened:
An error that suggested that my if block was missing an else clause was thrown:

ytt: Error: 
- conditional expression without else clause
    deployment.yaml:48 |       #@ if image_pull_secrets_enabled:

What did you expect:
Ideally, an error that would point out the line that has the error.

Failing that, an error that would suggest that the issue might be before the if block as the current error seems to strongly suggest that the issue is with the if block.

Environment:

  • ytt version: v0.36.0

Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible"
👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help working on this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    carvel acceptedThis issue should be considered for future work and that the triage process has been completeddiscussionThis issue is not a bug or feature and a conversation is needed to find an appropriate resolutionhelping with an issueDebugging happening to identify the problempriority/unprioritized-backlogHigher priority than priority/awaiting-more-evidence but not planned. Contributions are welcome.surprising to users

    Type

    No type

    Projects

    • Status

      To Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions