Skip to content

-p/--place is silently ignored by acquire/release when -c env.yaml is also given #1868

@hornmich

Description

@hornmich

Issue: -p/--place is silently ignored by acquire/release when -c env.yaml is also given

Summary

Since commit a9b59e4e ("remote/client: make acquire/release operate on all RemotePlaces in env"), invoking labgrid-client with both -c env.yaml and -p NAME silently ignores -p and operates on every RemotePlace in the env config. There is no way for the user to opt out of the env-wide behavior without dropping -c entirely.

Affected version

  • master at commit a9b59e4e and later.

Reproducer

Coordinator with three empty places test-place-1, test-place-2, test-place-3.

multi.yaml:

targets:
  main:
    resources:
      RemotePlace:
        name: test-place-1
  second:
    resources:
      RemotePlace:
        name: test-place-2
  third:
    resources:
      RemotePlace:
        name: test-place-3
$ labgrid-client -c multi.yaml -p test-place-2 acquire
Selected role second from configuration file
acquired place test-place-1
acquired place test-place-2
acquired place test-place-3

$ labgrid-client who
User     Host     Place         Changed
labgrid  labgrid  test-place-1  ...
labgrid  labgrid  test-place-2  ...
labgrid  labgrid  test-place-3  ...

Expected: only test-place-2 acquired.
Actual: all three places acquired; the -p test-place-2 argument has no effect on which places are touched. release exhibits the same behavior.

Root cause

labgrid/remote/client.py:

async def acquire(self):
    errors = []
    places = self.get_place_names_from_env() if self.env else [self.args.place]
    for place in places:
        ...

Impact

  • CI pipelines and ad-hoc users that historically used labgrid-client -c env.yaml -p NAME acquire (a documented and idiomatic combination prior to a9b59e4e) silently acquire every place in the env, contending with other users / pipelines and locking resources that should remain free.
  • The behavior change is silent: -p is parsed and even printed (Selected role second from configuration file), suggesting it took effect. There is no warning or error.

Expected behavior

When the user explicitly supplies a place via -p/--place, LG_PLACE, or the legacy PLACE env var, acquire/release should operate on that single place only, even if -c env.yaml is also provided.

Proposed fix

Patch attached.

0001-remote-client-let-p-restrict-env-wide-acquire-releas.patch

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions