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

Zkg should fail quicker if features conflict #167

Closed
pauldokas opened this issue Jul 5, 2023 · 2 comments
Closed

Zkg should fail quicker if features conflict #167

pauldokas opened this issue Jul 5, 2023 · 2 comments

Comments

@pauldokas
Copy link

Zkg should fail quicker if features conflict. For example, the following use case should fail before asking me a bunch of questions instead of making me enter a bunch of information and then failing.

% zkg create --packagedir foobar --features license plugin spicy-file-analyzer spicy-packet-analyzer spicy-protocol-analyzer
"package-template" requires a "name" value (the name of the package, e.g. "FooBar" or "spicy-http"):
name: FooBar
"package-template" requires a "namespace" value (a namespace for the package, e.g. "MyOrg"):
namespace: MyOrg
"package-template" requires a "analyzer" value (name of the Spicy analyzer, which typically corresponds to the protocol/format being parsed (e.g. "HTTP", "PNG")):
analyzer: HTTP
"package-template" requires a "protocol" value (transport protocol for the analyzer to use: TCP or UDP):
protocol: TCP
"package-template" requires a "unit" value (name of the top-level Spicy parsing unit for the file/packet format (e.g. "File" or "Packet")):
unit: File
"package-template" requires a "unit_orig" value (name of the top-level Spicy parsing unit for the originator side of the connection (e.g. "Request")):
unit_orig: Request
"package-template" requires a "unit_resp" value (name of the top-level Spicy parsing unit for the responder side of the connection (e.g. "Reply"); may be the same as originator side):
unit_resp: Reply
"package-template" requires a "author" value (your name and email address):
author: user@example.com
"package-template" requires a "license" value (one of apache, bsd-2, bsd-3, mit, mpl-2):
license: bsd-3
error: template input invalid, the "plugin" and "spicy-protocol-analyzer" features are mutually exclusive
@pauldokas
Copy link
Author

And while I'm here. Dropping spicy-protocol-analyzer from the list of selected features doesn't seem to have any effect. Zkg is still complaining of a mutual exclusion conflict for spicy-protocol-analyzer even though it was not selected. Perhaps it was pulled in through a dependency?

% zkg create --packagedir foobar --features license plugin spicy-file-analyzer spicy-packet-analyzer
"package-template" requires a "name" value (the name of the package, e.g. "FooBar" or "spicy-http"):
name: FooBar
"package-template" requires a "namespace" value (a namespace for the package, e.g. "MyOrg"):
namespace: MyOrg
"package-template" requires a "analyzer" value (name of the Spicy analyzer, which typically corresponds to the protocol/format being parsed (e.g. "HTTP", "PNG")):
analyzer: HTTP
"package-template" requires a "unit" value (name of the top-level Spicy parsing unit for the file/packet format (e.g. "File" or "Packet")):
unit: File
"package-template" requires a "author" value (your name and email address):
author: user@example.com
"package-template" requires a "license" value (one of apache, bsd-2, bsd-3, mit, mpl-2):
license: bsd-3
error: template input invalid, the "plugin" and "spicy-protocol-analyzer" features are mutually exclusive

@bbannier
Copy link
Contributor

bbannier commented Jul 6, 2023

I opened #22 to fix the incorrect error message.

As for triggering validation errors earlier, this is not a quick and easy fix as template validation only runs after all parameters have been collected.

awelzel added a commit to zeek/package-template that referenced this issue Nov 6, 2023
This is a bit noisy as zkg doesn't catch the exception, but can fix
on the zkg side to squelch that more nicely.

Closes zeek/package-manager#167
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants