Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Targets command fails when using integration other than github-enterprise #40

Open
ebickle opened this issue Jan 21, 2022 · 0 comments
Open

Comments

@ebickle
Copy link

ebickle commented Jan 21, 2022

Running the command python cli.py --github-token <token here> --conf snyk-sync.yaml --snyk-orgs-file snyk-orgs.yaml --cache-dir cache targets results in an unhandled exception:

Traceback (most recent call last):
  File "C:\Users\username\documents\source\prodsec-snyk-config\snyk-sync\snyk_sync\cli.py", line 670, in <module>
    app()
  File "C:\Users\username\documents\source\prodsec-snyk-config\snyk-sync\.venv\lib\site-packages\typer\main.py", line 214, in __call__
    return get_command(self)(*args, **kwargs)
  File "C:\Users\username\documents\source\prodsec-snyk-config\snyk-sync\.venv\lib\site-packages\click\core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\username\documents\source\prodsec-snyk-config\snyk-sync\.venv\lib\site-packages\click\core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "C:\Users\username\documents\source\prodsec-snyk-config\snyk-sync\.venv\lib\site-packages\click\core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\username\documents\source\prodsec-snyk-config\snyk-sync\.venv\lib\site-packages\click\core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\username\documents\source\prodsec-snyk-config\snyk-sync\.venv\lib\site-packages\click\core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\username\documents\source\prodsec-snyk-config\snyk-sync\.venv\lib\site-packages\typer\main.py", line 500, in wrapper
    return callback(**use_params)  # type: ignore
  File "C:\Users\username\documents\source\prodsec-snyk-config\snyk-sync\snyk_sync\cli.py", line 439, in targets
    int_id = branch.integrations["github-enterprise"]
KeyError: 'github-enterprise'

The snyk-sync.yaml file has the following:

default:
   orgName: orgNameHere
   integrationName: github

Line 436 and 439 of cli.py appears to have a bug - the YAML key github-enterprise is hardcoded. For users who are using regular GitHub and not GitHub Enterprise, these lines will always crash with an error. They should be updated to select the proper integration from configuration rather than being hard-coded.

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

Successfully merging a pull request may close this issue.

1 participant