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

Refactor scriptlet loader and improve checks #1507

Merged
merged 2 commits into from
Dec 13, 2024
Merged

Conversation

bensmrs
Copy link
Contributor

@bensmrs bensmrs commented Dec 13, 2024

The error generation function is pretty heavy, but I think the error messages are way nicer this way.

root@test-incus:~# incus config set authorization.scriptlet - <<EOF
def get_project_access(project):
  return ['ben']

get_instance_access = 3
EOF
Error: cannot set 'authorization.scriptlet' to 'def get_project_access(project):
  return ['ben']

get_instance_access = 3
': the function "authorize" is required but has not been found in the scriptlet; additionally, "get_instance_access" should define the scriptlet’s optional function of the same name (found a value of type int instead); finally, the optional function "get_project_access" defines arguments ["project"] (expected ["project_name"])

@bensmrs bensmrs requested a review from stgraber as a code owner December 13, 2024 10:58
@stgraber stgraber merged commit c280784 into lxc:main Dec 13, 2024
30 checks passed
@stgraber
Copy link
Member

The optional function handling will be quite convenient :)

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

Successfully merging this pull request may close these issues.

2 participants