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

Add gracefully handling of undefined environment variables when parsing $(env ...) tags #467

Open
ChrisTimperley opened this issue Aug 17, 2021 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@ChrisTimperley
Copy link
Member

2021-08-16 21:54:35.493 | INFO     | roswire.ros1.launch.reader:_parse_file:150 - parsing launch file [/ros_ws/src/autorally/autorally_core/launch/hardware.machine]:
<launch>

  <group if="$(env ROSLAUNCH_SSH_UNKNOWN)">

    <machine name="autorally-master" address="$(env MASTER_HOSTNAME)" user="$(env MASTER_USER)" default="true"
      env-loader="/home/autorally/catkin_ws/devel/env.sh"/>

  </group>

  <group unless="$(env ROSLAUNCH_SSH_UNKNOWN)">
    <machine name="autorally-master" address="$(env MASTER_HOSTNAME)" default="true"/>
  </group>

  <machine name="autorally-ocs" address="$(env HOSTNAME)" />
</launch>

2021-08-16 21:54:35.493 | DEBUG    | roswire.ros1.launch.reader:wrapped:119 - parsing <group> tag
2021-08-16 21:54:35.494 | DEBUG    | roswire.ros1.launch.reader:_resolve_args:518 - resolve [$(env ROSLAUNCH_SSH_UNKNOWN)] with context: {}
2021-08-16 21:54:35.494 | DEBUG    | roswire.common.launch.substitution:_resolve_substitution_arg:43 - resolving substitution argument: $(env ROSLAUNCH_SSH_UNKNOWN)
2021-08-16 21:54:35.494 | DEBUG    | roswire.common.launch.substitution:_resolve_substitution_arg:45 - stripped delimiters: env ROSLAUNCH_SSH_UNKNOWN
2021-08-16 21:54:35.494 | DEBUG    | roswire.common.launch.substitution:_resolve_substitution_arg:47 - argument kind: env
2021-08-16 21:54:35.805 | DEBUG    | roswire.app.instance:close:157 - destroying app instance directory: /home/chris/.roswire/containers/tmprgx6ke62
2021-08-16 21:54:35.806 | DEBUG    | roswire.app.instance:close:159 - destroyed app instance directory: /home/chris/.roswire/containers/tmprgx6ke62
2021-08-16 21:54:36.119 | DEBUG    | roswire.app.instance:close:157 - destroying app instance directory: /home/chris/.roswire/containers/tmpzb2uthdn
2021-08-16 21:54:36.119 | DEBUG    | roswire.app.instance:close:159 - destroyed app instance directory: /home/chris/.roswire/containers/tmpzb2uthdn
Traceback (most recent call last):
  File "/home/chris/.local/share/virtualenvs/rosdiscover-39I1LD61/lib/python3.9/site-packages/dockerblade/shell.py", line 185, in environ
    return self._environment[var]
KeyError: 'ROSLAUNCH_SSH_UNKNOWN'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/chris/.local/share/virtualenvs/rosdiscover-39I1LD61/bin/rosdiscover", line 33, in <module>
    sys.exit(load_entry_point('rosdiscover', 'console_scripts', 'rosdiscover')())
  File "/home/chris/tools/rosdiscover/src/rosdiscover/cli.py", line 191, in main
    args.func(args)
  File "/home/chris/tools/rosdiscover/src/rosdiscover/cli.py", line 49, in launch
    summary = _launch_config(args)
  File "/home/chris/tools/rosdiscover/src/rosdiscover/cli.py", line 44, in _launch_config
    return _launch(config)
  File "/home/chris/tools/rosdiscover/src/rosdiscover/cli.py", line 38, in _launch
    interpreter.launch(fn_launch)
  File "/home/chris/tools/rosdiscover/src/rosdiscover/interpreter/interpreter.py", line 85, in launch
    config = reader.read(launch_description.filename, launch_description.get_argv())
  File "/home/chris/tools/roswire/src/roswire/ros1/launch/reader.py", line 546, in read
    ctx, cfg = self._load_tags(ctx, cfg, list(launch))
  File "/home/chris/tools/roswire/src/roswire/ros1/launch/reader.py", line 162, in _load_tags
    ctx, cfg = loader(self, ctx, cfg, tag)
  File "/home/chris/tools/roswire/src/roswire/ros1/launch/reader.py", line 128, in wrapped
    return loader(self, ctx, cfg, elem)
  File "/home/chris/tools/roswire/src/roswire/ros1/launch/reader.py", line 427, in _load_include_tag
    ctx_child, cfg = self._load_tags(ctx_child, cfg, list(launch))
  File "/home/chris/tools/roswire/src/roswire/ros1/launch/reader.py", line 162, in _load_tags
    ctx, cfg = loader(self, ctx, cfg, tag)
  File "/home/chris/tools/roswire/src/roswire/ros1/launch/reader.py", line 126, in wrapped
    if not self._ifunless_check(elem, ctx):
  File "/home/chris/tools/roswire/src/roswire/ros1/launch/reader.py", line 505, in _ifunless_check
    if_val = self._read_optional(elem, "if", ctx)
  File "/home/chris/tools/roswire/src/roswire/ros1/launch/reader.py", line 495, in _read_optional
    return self._read_required(elem, attrib, ctx)
  File "/home/chris/tools/roswire/src/roswire/ros1/launch/reader.py", line 501, in _read_required
    return self._resolve_args(elem.attrib[attrib], ctx)
  File "/home/chris/tools/roswire/src/roswire/ros1/launch/reader.py", line 523, in _resolve_args
    return resolver.resolve(s)
  File "/home/chris/tools/roswire/src/roswire/common/launch/substitution.py", line 238, in resolve
    s = R_ARG.sub(lambda m: self._resolve_substitution_arg(m.group(0)), s)
  File "/home/chris/tools/roswire/src/roswire/common/launch/substitution.py", line 238, in <lambda>
    s = R_ARG.sub(lambda m: self._resolve_substitution_arg(m.group(0)), s)
  File "/home/chris/tools/roswire/src/roswire/common/launch/substitution.py", line 54, in _resolve_substitution_arg
    return self._resolve_env(var)
  File "/home/chris/tools/roswire/src/roswire/common/launch/substitution.py", line 90, in _resolve_env
    return self.shell.environ(var)
  File "/home/chris/.local/share/virtualenvs/rosdiscover-39I1LD61/lib/python3.9/site-packages/dockerblade/shell.py", line 187, in environ
    raise EnvNotFoundError(var) from exc
dockerblade.exceptions.EnvNotFoundError: No environment variable found with name: ROSLAUNCH_SSH_UNKNOWN
@ChrisTimperley ChrisTimperley added the bug Something isn't working label Aug 17, 2021
@ChrisTimperley ChrisTimperley self-assigned this Aug 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant