← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1710932] Re: Doesn't configure landscape client on py3

 

Updated decription and re-opened. Rharper found that it's a py3 issue. I
manually validated this works in py2.7.

http://paste.ubuntu.com/25320461/

** Summary changed:

- Doesn't configure landscape client
+ Doesn't configure landscape client on py3

** Description changed:

- ubuntu@withkvm:/var/log$ cat cloud-init.log | grep landscape
- 2017-08-15 17:17:28,660 - stages.py[DEBUG]: Running module landscape (<module 'cloudinit.config.cc_landscape' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_landscape.py'>) with frequency once-per-instance
- 2017-08-15 17:17:28,660 - handlers.py[DEBUG]: start: modules-final/config-landscape: running config-landscape with frequency once-per-instance
- 2017-08-15 17:17:28,664 - util.py[DEBUG]: Writing to /var/lib/cloud/instances/yar6cr/sem/config_landscape - wb: [420] 25 bytes
- 2017-08-15 17:17:28,665 - helpers.py[DEBUG]: Running config-landscape using lock (<FileLock using file '/var/lib/cloud/instances/yar6cr/sem/config_landscape'>)
- 2017-08-15 17:17:28,665 - handlers.py[DEBUG]: finish: modules-final/config-landscape: SUCCESS: config-landscape ran successfully
+ Attempting to configure landscape-client on a py3 system falls over due
+ to string/byte-string conversion issues
  
- ubuntu@withkvm:/var/log$ cat /etc/cloud/cloud.cfg.d/99_landscape_client 
+ Here's a sample run from MAAS:
+ 
+ 2017-08-15 17:58:11,883 - util.py[DEBUG]: Running module landscape (<module 'cloudinit.config.cc_landscape' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_landscape.py'>) failed
+ Traceback (most recent call last):
+   File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 793, in _run_modules
+     freq=freq)
+   File "/usr/lib/python3/dist-packages/cloudinit/cloud.py", line 54, in run
+     return self._runners.run(name, functor, args, freq, clear_on_fail)
+   File "/usr/lib/python3/dist-packages/cloudinit/helpers.py", line 187, in run
+     results = functor(*args)
+   File "/usr/lib/python3/dist-packages/cloudinit/config/cc_landscape.py", line 113, in handle
+     merged.write(contents)
+   File "/usr/lib/python3/dist-packages/configobj.py", line 2126, in write
+     outfile.write(output_bytes)
+ TypeError: string argument expected, got 'bytes'
+ 
+ 
+ ubuntu@withkvm:/etc/landscape$ cat /etc/cloud/cloud.cfg.d/99_landscape_client.cfg 
  landscape:
    client:
      url: "https://192.168.122.1/message-system";
      ping_url: "http://192.168.122.1/ping";
      data_path: "/var/lib/landscape/client"
      #http_proxy: "http://my.proxy.com/foobar";
      tags: "maas"
      computer_title: withkvm
      #https_proxy: fooproxy
      registration_key: test
      account_name: standalone
  
- ubuntu@withkvm:/var/log$ dpkg -l | grep landscape-client
- ubuntu@withkvm:/var/log$ cat /etc/landscape/client.conf
- cat: /etc/landscape/client.conf: No such file or directory
+ 
+ Ryan validated py3 falling over just on basic ConfigObj.write() attempts:
+ (foudres) ~ % python3
+ Python 3.5.2 (default, Nov 17 2016, 17:05:23) 
+ [GCC 5.4.0 20160609] on linux
+ Type "help", "copyright", "credits" or "license" for more information.
+ >>> import confi
+ KeyboardInterrupt
+ >>> from configobj import ConfigObj
+ >>> from six import StringIO
+ >>> contents = StringIO()
+ >>> merged = cfg = ConfigObj({})
+ >>> merged
+ ConfigObj({})
+ >>> cfg.merge({'a': 1})
+ >>> cfg
+ ConfigObj({'a': 1})
+ >>> type(contents)
+ <class '_io.StringIO'>
+ >>> merged.write(contents)
+ Traceback (most recent call last):
+   File "<stdin>", line 1, in <module>
+   File "/usr/lib/python3/dist-packages/configobj.py", line 2126, in write
+     outfile.write(output_bytes)
+ TypeError: string argument expected, got 'bytes'

** Description changed:

  Attempting to configure landscape-client on a py3 system falls over due
  to string/byte-string conversion issues
  
  Here's a sample run from MAAS:
  
  2017-08-15 17:58:11,883 - util.py[DEBUG]: Running module landscape (<module 'cloudinit.config.cc_landscape' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_landscape.py'>) failed
  Traceback (most recent call last):
-   File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 793, in _run_modules
-     freq=freq)
-   File "/usr/lib/python3/dist-packages/cloudinit/cloud.py", line 54, in run
-     return self._runners.run(name, functor, args, freq, clear_on_fail)
-   File "/usr/lib/python3/dist-packages/cloudinit/helpers.py", line 187, in run
-     results = functor(*args)
-   File "/usr/lib/python3/dist-packages/cloudinit/config/cc_landscape.py", line 113, in handle
-     merged.write(contents)
-   File "/usr/lib/python3/dist-packages/configobj.py", line 2126, in write
-     outfile.write(output_bytes)
+   File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 793, in _run_modules
+     freq=freq)
+   File "/usr/lib/python3/dist-packages/cloudinit/cloud.py", line 54, in run
+     return self._runners.run(name, functor, args, freq, clear_on_fail)
+   File "/usr/lib/python3/dist-packages/cloudinit/helpers.py", line 187, in run
+     results = functor(*args)
+   File "/usr/lib/python3/dist-packages/cloudinit/config/cc_landscape.py", line 113, in handle
+     merged.write(contents)
+   File "/usr/lib/python3/dist-packages/configobj.py", line 2126, in write
+     outfile.write(output_bytes)
  TypeError: string argument expected, got 'bytes'
  
- 
- ubuntu@withkvm:/etc/landscape$ cat /etc/cloud/cloud.cfg.d/99_landscape_client.cfg 
+ ubuntu@withkvm:/etc/landscape$ cat /etc/cloud/cloud.cfg.d/99_landscape_client.cfg
  landscape:
-   client:
-     url: "https://192.168.122.1/message-system";
-     ping_url: "http://192.168.122.1/ping";
-     data_path: "/var/lib/landscape/client"
-     #http_proxy: "http://my.proxy.com/foobar";
-     tags: "maas"
-     computer_title: withkvm
-     #https_proxy: fooproxy
-     registration_key: test
-     account_name: standalone
- 
+   client:
+     url: "https://192.168.122.1/message-system";
+     ping_url: "http://192.168.122.1/ping";
+     data_path: "/var/lib/landscape/client"
+     #http_proxy: "http://my.proxy.com/foobar";
+     tags: "maas"
+     computer_title: withkvm
+     #https_proxy: fooproxy
+     registration_key: test
+     account_name: standalone
  
  Ryan validated py3 falling over just on basic ConfigObj.write() attempts:
  (foudres) ~ % python3
- Python 3.5.2 (default, Nov 17 2016, 17:05:23) 
+ Python 3.5.2 (default, Nov 17 2016, 17:05:23)
  [GCC 5.4.0 20160609] on linux
  Type "help", "copyright", "credits" or "license" for more information.
- >>> import confi
- KeyboardInterrupt
  >>> from configobj import ConfigObj
  >>> from six import StringIO
  >>> contents = StringIO()
  >>> merged = cfg = ConfigObj({})
  >>> merged
  ConfigObj({})
  >>> cfg.merge({'a': 1})
  >>> cfg
  ConfigObj({'a': 1})
  >>> type(contents)
  <class '_io.StringIO'>
  >>> merged.write(contents)
  Traceback (most recent call last):
-   File "<stdin>", line 1, in <module>
-   File "/usr/lib/python3/dist-packages/configobj.py", line 2126, in write
-     outfile.write(output_bytes)
+   File "<stdin>", line 1, in <module>
+   File "/usr/lib/python3/dist-packages/configobj.py", line 2126, in write
+     outfile.write(output_bytes)
  TypeError: string argument expected, got 'bytes'

** Changed in: cloud-init
       Status: Invalid => Confirmed

** Changed in: cloud-init
   Importance: Undecided => High

** Changed in: cloud-init
     Assignee: (unassigned) => Chad Smith (chad.smith)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1710932

Title:
  Doesn't configure landscape client on py3

Status in cloud-init:
  Confirmed

Bug description:
  Attempting to configure landscape-client on a py3 system falls over
  due to string/byte-string conversion issues

  Here's a sample run from MAAS:

  2017-08-15 17:58:11,883 - util.py[DEBUG]: Running module landscape (<module 'cloudinit.config.cc_landscape' from '/usr/lib/python3/dist-packages/cloudinit/config/cc_landscape.py'>) failed
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/cloudinit/stages.py", line 793, in _run_modules
      freq=freq)
    File "/usr/lib/python3/dist-packages/cloudinit/cloud.py", line 54, in run
      return self._runners.run(name, functor, args, freq, clear_on_fail)
    File "/usr/lib/python3/dist-packages/cloudinit/helpers.py", line 187, in run
      results = functor(*args)
    File "/usr/lib/python3/dist-packages/cloudinit/config/cc_landscape.py", line 113, in handle
      merged.write(contents)
    File "/usr/lib/python3/dist-packages/configobj.py", line 2126, in write
      outfile.write(output_bytes)
  TypeError: string argument expected, got 'bytes'

  ubuntu@withkvm:/etc/landscape$ cat /etc/cloud/cloud.cfg.d/99_landscape_client.cfg
  landscape:
    client:
      url: "https://192.168.122.1/message-system";
      ping_url: "http://192.168.122.1/ping";
      data_path: "/var/lib/landscape/client"
      #http_proxy: "http://my.proxy.com/foobar";
      tags: "maas"
      computer_title: withkvm
      #https_proxy: fooproxy
      registration_key: test
      account_name: standalone

  Ryan validated py3 falling over just on basic ConfigObj.write() attempts:
  (foudres) ~ % python3
  Python 3.5.2 (default, Nov 17 2016, 17:05:23)
  [GCC 5.4.0 20160609] on linux
  Type "help", "copyright", "credits" or "license" for more information.
  >>> from configobj import ConfigObj
  >>> from six import StringIO
  >>> contents = StringIO()
  >>> merged = cfg = ConfigObj({})
  >>> merged
  ConfigObj({})
  >>> cfg.merge({'a': 1})
  >>> cfg
  ConfigObj({'a': 1})
  >>> type(contents)
  <class '_io.StringIO'>
  >>> merged.write(contents)
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/usr/lib/python3/dist-packages/configobj.py", line 2126, in write
      outfile.write(output_bytes)
  TypeError: string argument expected, got 'bytes'

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1710932/+subscriptions


References