Skip to content

Commit

Permalink
Restore original TANGO_HOST variable if it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
tfarago committed Jun 10, 2015
1 parent bfd15fe commit f41d381
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions concert/networking/base.py
Expand Up @@ -67,7 +67,10 @@ def get_tango_device(uri, peer=None):
"""
import PyTango
# TODO: check if there is a way to adjust the host in PyTango.
old = os.environ['TANGO_HOST'] if 'TANGO_HOST' in os.environ else None
if peer is not None:
os.environ["TANGO_HOST"] = peer
if old:
os.environ['TANGO_HOST'] = old

return PyTango.DeviceProxy(uri)

2 comments on commit f41d381

@matze
Copy link
Contributor

@matze matze commented on f41d381 Jun 10, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first line can be simplified to

old = os.environ.get('TANGO_HOST')

and in together the whole section to

os.environ['TANGO_HOST'] = peer or os.environ.get('TANGO_HOST')

@tfarago
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's nice but the bigger problem is that the change doesn't actually do anything unless we move the PyTango.DeviceProxy(uri) in between the host settings...
The biggest problem is, however, that the TANGO_HOST setting doesn't have any effect, it seems to me that it reads the env variable in the beginning but then it doesn't pick up the changes. I found a multi tango host option but that doesn't seem to work either, I will write to Tango guys, until then I will revert this because it's useless...

Please sign in to comment.