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

Overriden ZKG_DEFAULT_TEMPLATE ignored if also using --configfile #144

Open
bbannier opened this issue Oct 31, 2022 · 2 comments
Open

Overriden ZKG_DEFAULT_TEMPLATE ignored if also using --configfile #144

bbannier opened this issue Oct 31, 2022 · 2 comments
Assignees

Comments

@bbannier
Copy link
Contributor

One should be able to override a configured templates by setting ZKG_DEFAULT_TEMPLATE. This seems not to work when also using --configfile.

Reproducer in zeekurity/zeek:5.0.2 image:

  • create a config file

    $ zkg config > /tmp/config
    $ cat /tmp/config
    [sources]
    zeek = https://github.com/zeek/packages
    
    [templates]
    default = https://github.com/zeek/package-template
    
    [paths]
    state_dir = /Users/bbannier/.zkg
    script_dir = /usr/local/Cellar/zeek/4.2.2/share/zeek/site
    plugin_dir = /usr/local/Cellar/zeek/4.2.2/lib/zeek/plugins
    bin_dir = /usr/local/Cellar/zeek/4.2.2/bin
  • when not using --configfile the value of ZKG_DEFAULT_TEMPLATE is successfully picked up; demonstrated here by passing a path to a non-existing template

    $ ZKG_DEFAULT_TEMPLATE=/tmp/foo zkg create --packagedir=/tmp/bla
    error: problem while loading template /tmp/foo: failed to update template "/tmp/foo": Cmd('git') failed due to: exit code(128)
      cmdline: git clone --recursive /tmp/foo /usr/local/zeek/var/lib/zkg/clones/templates/foo
      stderr: 'fatal: repository '/tmp/foo' does not exist'
  • when using --configfile the value of ZKG_DEFAULT_TEMPLATE is not picked up; execution continues with default configured template

    $ ZKG_DEFAULT_TEMPLATE=/tmp/foo zkg --configfile=/tmp/config create --packagedir=/tmp/bla
    "package-template" requires a "name" value (the name of the package, e.g., "FooBar" or "spicy-http"):
    name:
@ckreibich
Copy link
Member

Good catch, yep! This is a simple logic bug in zkg's setup. Fix forthcoming.

@ckreibich
Copy link
Member

This does not just affect ZKG_DEFAULT_TEMPLATE ... a related problem applies to ZKG_DEFAULT_SOURCE: it just gets ignored:

$ export ZKG_DEFAULT_SOURCE=nonsense
$ zkg refresh
Refresh package source: zeek
        No membership changes
Refresh installed packages
        No new outdated packages

So here it doesn't even matter whether you explicitly provide a config. I'm not sure when this happened, but these are clearly holes in the testsuite. I'll take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants