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

create a reservation - value is invalid #1570

Open
idan4u opened this issue Jan 20, 2025 · 0 comments
Open

create a reservation - value is invalid #1570

idan4u opened this issue Jan 20, 2025 · 0 comments

Comments

@idan4u
Copy link

idan4u commented Jan 20, 2025

When I tried to create a reservation:

labgrid-client -p idan create
labgrid-client -p idan set-tags my_tag=15
labgrid-client reserve my_tag=15

I got the following exception:
labgrid-client: error: Value '15' in filter 'my_tag=15' is invalid

I think in order to fix it we just need to replace TAG_KEY.match(v) with TAG_VAL.match(v) in the create_reservation function:
/labgrid/remote/client.py

`
TAG_KEY = re.compile(r"[a-z][a-z0-9_]+")
TAG_VAL = re.compile(r"[a-z0-9_]?")
....
....

async def create_reservation(self):
    prio = self.args.prio

    fltr = {}
    for pair in self.args.filters:
        try:
            k, v = pair.split("=")
        except ValueError:
            raise UserError(f"'{pair}' is not a valid filter (must contain a '=')")
        if not TAG_KEY.match(k):
            raise UserError(f"Key '{k}' in filter '{pair}' is invalid")
        if not TAG_KEY.match(v):
            raise UserError(f"Value '{v}' in filter '{pair}' is invalid")
        fltr[k] = v

`

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

Successfully merging a pull request may close this issue.

1 participant