Gusto / it-cpe-opensource

Tools used by the CPE team at Gusto to manage our endpoints and software deployment systems.
Other
59 stars 29 forks source link

ERROR:autopromote:exceptions must derive from BaseException #60

Open MScottBlake opened 2 years ago

MScottBlake commented 2 years ago

While testing the new allowlist and denylist functionality in autopromote, I encountered an error.

I had this in my json:

"denylist": {
    "Zoom": "5.7.4.898"
},
"allowlist": {
    "Zoom": "5\\..*"
},

In this test, the goal is to only promote Zoom 5.x except for 5.7.4.898.

The script output looks like this:

[ snip ]
INFO:autopromote:Considering package Zoom 5.7.1.499
INFO:autopromote:Considering package Zoom 5.7.6.1320
INFO:autopromote:Considering package Zoom 5.7.4.898
ERROR:autopromote:exceptions must derive from BaseException
Traceback (most recent call last):
  File "autopromote.py", line 473, in <module>
    main()
  File "autopromote.py", line 465, in main
    raise e
  File "autopromote.py", line 455, in main
    promotions = promote_pkgs(PKGINFOS_PATHS)
  File "autopromote.py", line 389, in promote_pkgs
    promoted, result = promote_pkg(plist, path)
  File "autopromote.py", line 299, in promote_pkg
    if not permitted(name, version):
  File "autopromote.py", line 266, in permitted
    raise f"{name} is in both allow and deny lists!"
TypeError: exceptions must derive from BaseException
MScottBlake commented 2 years ago

I'm not sure how to best handle it, but I sort of assume that lines 265-266 were intended to be this instead.

    if allowed and denied:
        logger.warning(f"{name} is in both allow and deny lists!")