juju-deployer breaks when "env python" is python2.7

Bug #1644574 reported by Junien Fridrick
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
juju-deployer
New
Undecided
Unassigned

Bug Description

Hi,

We have a trusty server where "env python" resolves to python2.7.

We have the following juju-deployer packages installed :

ii juju-deployer 1:0.9.2~bzr203~60~2.IS.14.04 amd64 A transitional package which depends on python-juju-deployer.
ii python-juju-deployer 1:0.9.2~bzr203~60~2.IS.14.04 amd64 A tool to deploy complex stacks of services using juju.
ii python3-juju-deployer 1:0.9.2~bzr203~60~2.IS.14.04 amd64 A tool to deploy complex stacks of services using juju.

However, when one runs /usr/bin/juju-deployer (which is python3), it complains about TLS stuff, because it's actually running the 2.7 version underneath. Example trace :

/usr/lib/python2.7/dist-packages/jujuclient/connector.py:18: RuntimeWarning: This version of Python does not support TLSv1.2. Please use Python 2.7.9+ or 3.4+ instead. Attempting to use TLSv1 - may not work with all versions of Juju.
  'all versions of Juju.', RuntimeWarning)
/usr/lib/python2.7/dist-packages/jujuclient/connector.py:18: RuntimeWarning: This version of Python does not support TLSv1.2. Please use Python 2.7.9+ or 3.4+ instead. Attempting to use TLSv1 - may not work with all versions of Juju.
  'all versions of Juju.', RuntimeWarning)
Traceback (most recent call last):
  File "/usr/bin/juju-deployer", line 9, in <module>
    load_entry_point('juju-deployer==0.9.2', 'console_scripts', 'juju-deployer')()
  File "/usr/lib/python2.7/dist-packages/deployer/cli.py", line 140, in main
    run()
  File "/usr/lib/python2.7/dist-packages/deployer/cli.py", line 245, in run
    diff.Diff(env, deployment, options).run()
  File "/usr/lib/python2.7/dist-packages/deployer/action/diff.py", line 158, in run
    diff = self.do_diff()
  File "/usr/lib/python2.7/dist-packages/deployer/action/diff.py", line 152, in do_diff
    self.env.connect()
  File "/usr/lib/python2.7/dist-packages/deployer/env/go.py", line 78, in connect
    self.client = self.client_class.connect(self.name)
  File "/usr/lib/python2.7/dist-packages/jujuclient/environment.py", line 87, in connect
    return connector().run(cls, env_name)
  File "/usr/lib/python2.7/dist-packages/jujuclient/connector.py", line 51, in run
    cert_path, data.get('environ-uuid'))
  File "/usr/lib/python2.7/dist-packages/jujuclient/connector.py", line 59, in connect_env
    env = cls(endpoint, name=name, ca_cert=cert_path, env_uuid=env_uuid)
  File "/usr/lib/python2.7/dist-packages/jujuclient/juju2/environment.py", line 15, in __init__
    super(Environment, self).__init__(*args, **kw)
  File "/usr/lib/python2.7/dist-packages/jujuclient/environment.py", line 41, in __init__
    endpoint, self._ca_cert)
  File "/usr/lib/python2.7/dist-packages/jujuclient/connector.py", line 71, in connect_socket
    endpoint, origin=endpoint, sslopt=sslopt)
  File "/usr/lib/python2.7/dist-packages/websocket/_core.py", line 219, in create_connection
    websock.connect(url, **options)
  File "/usr/lib/python2.7/dist-packages/websocket/_core.py", line 463, in connect
    self.sock = ssl.wrap_socket(self.sock, **sslopt)
  File "/usr/lib/python2.7/ssl.py", line 487, in wrap_socket
    ciphers=ciphers)
  File "/usr/lib/python2.7/ssl.py", line 243, in __init__
    self.do_handshake()
  File "/usr/lib/python2.7/ssl.py", line 405, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [Errno 1] _ssl.c:510: error:1409442E:SSL routines:SSL3_READ_BYTES:tlsv1 alert protocol version
2016-11-24 13:11:35 [ERROR] Error calling external process

From the first few lines, you can see that python2.7 is called :
Traceback (most recent call last):
  File "/usr/bin/juju-deployer", line 9, in <module>
    load_entry_point('juju-deployer==0.9.2', 'console_scripts', 'juju-deployer')()
  File "/usr/lib/python2.7/dist-packages/deployer/cli.py", line 140, in main
    run()

even though :
$ head -n1 /usr/bin/juju-deployer
#!/usr/bin/python3

Thanks

Tags: landscape
Revision history for this message
Junien Fridrick (axino) wrote :

A workaround is to have a "python" symlink to python3 in your PATH.

David Britton (dpb)
tags: added: landscape
Revision history for this message
Felipe Reyes (freyes) wrote :

I'm marking this bug as duplicate of bug 1644331 , if you disagree please feel free reopen this bug.

Revision history for this message
Junien Fridrick (axino) wrote :

Hi,

This is not a duplicate. This is for python3-juju-deployer, which doesn't have the TLS issue from 1644331, except when it's juju-deployer (the python2.7 version).

python3-juju-deployer should always use python3.

Thanks

Revision history for this message
Nick Moffitt (nick-moffitt) wrote :

This appears to be a bug in mojo, in that it's running `python /path/to/juju-deployer` which by default is still python2. The juju-deployer script should be executable and have a #! line, so this is just a bug in mojo/phase.py

Revision history for this message
Nick Moffitt (nick-moffitt) wrote :

Possibly a duplicate of bug#1644331

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.