Skip to content
Permalink
Browse files

remote/client: support env variables in namespace

Previously both STATE and PLACE were not namespaced with the LG prefix.
Add support for both and prefer them over the old variables.
The old variables are still supported.

Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
  • Loading branch information...
Emantor authored and jluebbe committed May 14, 2019
1 parent 47f3031 commit 067461687e229c1549cf7274d4b26b977b518263
Showing with 9 additions and 6 deletions.
  1. +3 −0 labgrid/remote/client.py
  2. +2 −2 man/labgrid-client.1
  3. +4 −4 man/labgrid-client.rst
@@ -1036,8 +1036,11 @@ def main():
stream=sys.stderr,
)

# Support both legacy variables and properly namespaced ones
place = os.environ.get('PLACE', None)
place = os.environ.get('LG_PLACE', place)
state = os.environ.get('STATE', None)
state = os.environ.get('LG_STATE', state)

parser = argparse.ArgumentParser()
parser.add_argument(
@@ -76,10 +76,10 @@ The configuration file follows the description in \fBlabgrid\-device\-config\fP(
.SH ENVIRONMENT VARIABLES
.sp
Various labgrid\-client commands use the following environment variable:
.SS PLACE
.SS LG_PLACE
.sp
This variable can be used to specify a place without using the \fB\-p\fP option, the \fB\-p\fP option overrides it.
.SS STATE
.SS LG_STATE
.sp
This variable can be used to specify a state which the device transitions into
before executing a command. Requires a configuration file and a Strategy
@@ -60,12 +60,12 @@ ENVIRONMENT VARIABLES
---------------------
Various labgrid-client commands use the following environment variable:

PLACE
~~~~~
LG_PLACE
~~~~~~~~
This variable can be used to specify a place without using the ``-p`` option, the ``-p`` option overrides it.

STATE
~~~~~
LG_STATE
~~~~~~~~
This variable can be used to specify a state which the device transitions into
before executing a command. Requires a configuration file and a Strategy
specified for the device.

0 comments on commit 0674616

Please sign in to comment.
You can’t perform that action at this time.