← Back to team overview

touch-packages team mailing list archive

[Bug 1408317] Re: Config string parsing fails if value contains an '='

 

** Changed in: autopilot
       Status: Fix Committed => Fix Released

** Changed in: autopilot (Ubuntu)
       Status: New => Fix Released

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to autopilot in Ubuntu.
https://bugs.launchpad.net/bugs/1408317

Title:
  Config string parsing fails if value contains an '='

Status in Autopilot:
  Fix Released
Status in autopilot package in Ubuntu:
  Fix Released

Bug description:
  Config string parsing fails if the value of a parameter contains an
  '='.

  For example with ubuntu-sanity-tests if the WiFi passphrase contains an '=' it fails with:
  =====
  Traceback (most recent call last):
    File "/tmp/adt-run.YAwQfE/build.3M3/real-tree/ubuntu_sanity_tests/tests/test_settings_wizard.py", line 46, in setUp
      self._apply_default_config()
    File "/tmp/adt-run.YAwQfE/build.3M3/real-tree/ubuntu_sanity_tests/tests/test_settings_wizard.py", line 55, in _apply_default_config
      config = get_test_configuration()
    File "/tmp/adt-run.YAwQfE/deps/usr/lib/python3/dist-packages/autopilot/_config.py", line 67, in get_test_configuration
      return ConfigDict(_test_config_string)
    File "/tmp/adt-run.YAwQfE/deps/usr/lib/python3/dist-packages/autopilot/_config.py", line 84, in __init__
      "Invalid configuration string '{}'".format(config_string)
  ValueError: Invalid configuration string 'device_password=0000,output_dir=./results,sim_0_pin=0000,wifi_password=password_with_an_=_sign,wifi_ssid=MyAccessPoint'
  =====

  This is because the string key=value is split on '=' without limit. A possible patch is:
  ====
  === modified file 'autopilot/_config.py'
  --- autopilot/_config.py	2014-05-21 07:42:24 +0000
  +++ autopilot/_config.py	2015-01-07 14:05:34 +0000
  @@ -74,7 +74,7 @@
           for item in config_string.split(','):
               if not item:
                   continue
  -            parts = item.split('=')
  +            parts = item.split('=', 1)
               if len(parts) == 1:
                   self._data[parts[0].lstrip()] = '1'
               elif len(parts) == 2:
  ====

To manage notifications about this bug go to:
https://bugs.launchpad.net/autopilot/+bug/1408317/+subscriptions