Skip to content

Policy import should check if a file exists first #773

@sozercan

Description

@sozercan

Is your feature request related to a problem?

It would be better to fast fail if a trust policy file doesn't exist

For example:

$ notation policy import trustpolicy.json                                                                     
Existing trust policy configuration found, do you want to overwrite it? [y/N] y
Error: failed to read trust policy file: open trustpolicy.json: no such file or directory

If this is not actionable anyway, no point asking the user the question in the first place

What solution do you propose?

If file doesn't exist:

$ notation policy import trustpolicy.json                                                                     
Error: failed to read trust policy file: open trustpolicy.json: no such file or directory

If file exists:

$ notation policy import trustpolicy.json                                                                     
Existing trust policy configuration found, do you want to overwrite it? [y/N] y
...

What alternatives have you considered?

n/a

Any additional context?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions