[2.0RC2] Unable to add a public SSH Key due to lp1604147

Bug #1604128 reported by Lee Trager on 2016-07-18
46
This bug affects 9 people
Affects Status Importance Assigned to Milestone
MAAS
Critical
Gavin Panella
2.0
Critical
Unassigned
Trunk
Critical
Gavin Panella
maas (Ubuntu)
Critical
Unassigned
Xenial
Critical
Unassigned
Yakkety
Critical
Unassigned

Bug Description

[Impact]
With a recent update of python from 3.5.1 to 3.5.2, the pathlib.Path.path property is gone. This impacts MAAS as it will cause it to fail importing SSH keys, which prevents users from deploying.

[Test Case]
1. Install MAAS
2. Import SSH Key (example, maas maas sshkeys create key="$(ssh-add -L | grep <email address hidden>)")

With fix - The key will be imported correctly.
Without fix - The key will fail to import.

Work around sudden loss of pathlib.Path.path property in Python 3.5.2 release.

[Regression Potential]
None. Tested and proved that using the different path fixes the issue.

== Original bug report ==
When I add a public SSH key over the API or in the UI I get the following error

$ maas maas sshkeys create key="$(ssh-add -L | grep <email address hidden>)"
{"key": ["Invalid SSH public key: 'PosixPath' object has no attribute 'path'"]}

This was introduced in 5118 in the validation code of SSH keys but appears to be exposing a bigger bug. If you run ./bin/test.rack src/provisioningserver/utils/tests/test_sshkey.py the tests fail. I'm guessing that something is mocking check_output in a previous test and not unmocking it.

Related branches

summary: - [2.0RC3] Unable to add a public SSH Key
+ [2.0RC2] Unable to add a public SSH Key
Lee Trager (ltrager) on 2016-07-18
description: updated
Chris Gregan (cgregan) on 2016-07-18
tags: added: cdo-qa-blocker

This appears to be a result of a Python 3.5.1 -> 3.5.2 update in Xenial. Filed as bug 1604147.

no longer affects: python3.5 (Ubuntu)
Gavin Panella (allenap) on 2016-07-18
Changed in maas:
assignee: nobody → Gavin Panella (allenap)
status: Triaged → In Progress
John George (jog) on 2016-07-18
tags: added: cdoqa-blocker
removed: cdo-qa-blocker
summary: - [2.0RC2] Unable to add a public SSH Key
+ [2.0RC2] Unable to add a public SSH Key due to lp1604147
Changed in maas (Ubuntu Xenial):
importance: Undecided → Critical
description: updated
Changed in maas (Ubuntu Yakkety):
importance: Undecided → Critical

Hello Lee, or anyone else affected,

Accepted maas into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/maas/2.0.0~rc2+bzr5156-0ubuntu1~16.04.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

description: updated
Changed in maas (Ubuntu Xenial):
status: New → Fix Committed
tags: added: verification-needed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package maas - 2.0.0~rc2+bzr5156-0ubuntu2

---------------
maas (2.0.0~rc2+bzr5156-0ubuntu2) yakkety; urgency=medium

  * debian/patches/lp1604128_workaround_python_lp1604147: Work around a
    regression in the recent update to Python 3.5.2 that lost the
    pathlib.Path.path property. (LP: #1604128)

 -- Andres Rodriguez <email address hidden> Mon, 18 Jul 2016 17:10:55 -0400

Changed in maas (Ubuntu Yakkety):
status: New → Fix Released
tags: added: verification-done
removed: verification-needed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package maas - 2.0.0~rc2+bzr5156-0ubuntu1~16.04.2

---------------
maas (2.0.0~rc2+bzr5156-0ubuntu1~16.04.2) xenial-proposed; urgency=medium

  * debian/patches/lp1604128_workaround_python_lp1604147: Work around a
    regression in the recent update to Python 3.5.2 that lost the
    pathlib.Path.path property. (LP: #1604128)

 -- Andres Rodriguez <email address hidden> Mon, 18 Jul 2016 16:56:26 -0400

Changed in maas (Ubuntu Xenial):
status: Fix Committed → Fix Released

The verification of the Stable Release Update for maas has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

John George (jog) wrote :

I still get the same failure:
cdoqa@maas-node-1:~$ maas maas sshkeys create key='ssh-rsa PUB_KEY_TEXT'
{"key": ["Invalid SSH public key: 'PosixPath' object has no attribute 'path'"]}

Looking at the installed code it appears one use of keypath.path was changed (i.e. line 139) but a second was not (i.e. line 149):

cdoqa@maas-node-1:~$ egrep -nre str[\(]keypath /usr/lib/python3/dist-packages/provisioningserver
/usr/lib/python3/dist-packages/provisioningserver/utils/sshkey.py:139: ("setsid", "-w", "ssh-keygen", "-e", "-f", str(keypath)),
/usr/lib/python3/dist-packages/provisioningserver/utils/sshkey.py:149: ("setsid", "-w", "ssh-keygen", "-i", "-f", str(keypath.path)),

The following maas packages were installed from xenial-updates:
cdoqa@maas-node-1:~$ dpkg -l | grep maas
ii maas 2.0.0~rc2+bzr5156-0ubuntu1~16.04.2 all "Metal as a Service" is a physical cloud and IPAM
ii maas-cli 2.0.0~rc2+bzr5156-0ubuntu1~16.04.2 all MAAS client and command-line interface
ii maas-common 2.0.0~rc2+bzr5156-0ubuntu1~16.04.2 all MAAS server common files
ii maas-dhcp 2.0.0~rc2+bzr5156-0ubuntu1~16.04.2 all MAAS DHCP server
ii maas-dns 2.0.0~rc2+bzr5156-0ubuntu1~16.04.2 all MAAS DNS server
ii maas-proxy 2.0.0~rc2+bzr5156-0ubuntu1~16.04.2 all MAAS Caching Proxy
ii maas-rack-controller 2.0.0~rc2+bzr5156-0ubuntu1~16.04.2 all Rack Controller for MAAS
ii maas-region-api 2.0.0~rc2+bzr5156-0ubuntu1~16.04.2 all Region controller API service for MAAS
ii maas-region-controller 2.0.0~rc2+bzr5156-0ubuntu1~16.04.2 all Region Controller for MAAS
ii python3-django-maas 2.0.0~rc2+bzr5156-0ubuntu1~16.04.2 all MAAS server Django web framework (Python 3)
ii python3-maas-client 2.0.0~rc2+bzr5156-0ubuntu1~16.04.2 all MAAS python API client (Python 3)
ii python3-maas-provisioningserver 2.0.0~rc2+bzr5156-0ubuntu1~16.04.2 all MAAS server provisioning libraries (Python 3)

Trent Lloyd (lathiat) wrote :

Also still seeing this issue

Changed in maas (Ubuntu Xenial):
status: Fix Released → Confirmed
james lee (lisartgun) wrote :

solved like this.
/usr/lib/python3/dist-packages/provisioningserver/utils/sshkey.py:149:
("setsid", "-w", "ssh-keygen", "-i", "-f", str(keypath)),

james lee (lisartgun) on 2016-07-22
Changed in maas (Ubuntu Xenial):
status: Confirmed → Fix Committed
status: Fix Committed → Confirmed
Changed in maas (Ubuntu Xenial):
milestone: none → xenial-updates
Michael Reed (mreed8855) wrote :

I am also still seeing this error. The workaround in comment #8 does work.

Gavin Panella (allenap) wrote :

> solved like this.
> /usr/lib/python3/dist-packages/provisioningserver/utils/sshkey.py:149:
> ("setsid", "-w", "ssh-keygen", "-i", "-f", str(keypath)),

FWIW, this exact fix is in ppa:maas/next. Not sure where else it's meant
to be right now.

FanFan (fkpwolf) wrote :

MAAS Version 2.0.0 (rc2+bzr5156) still need workaround in comment #8.

Brandon B. Jozsa (bjozsa) wrote :

the change that @allenap suggested worked perfectly for me. thank you for the workaround!

MAAS RC3 is available in ppa:MAAS/next

On Saturday, August 6, 2016, Brandon B. Jozsa <email address hidden> wrote:

> the change that @allenap suggested worked perfectly for me. thank you
> for the workaround!
>
> --
> You received this bug notification because you are subscribed to MAAS.
> https://bugs.launchpad.net/bugs/1604128
>
> Title:
> [2.0RC2] Unable to add a public SSH Key due to lp1604147
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/maas/+bug/1604128/+subscriptions
>

--
Andres Rodriguez (RoAkSoAx)
Ubuntu Server Developer
MSc. Telecom & Networking
Systems Engineer

Victor Tapia (vtapia) on 2016-08-09
tags: added: sts

after to add the maas/next and made the upgrade the situation is always the same, in attached the error when added the ssh key.

Alexander Gabert (alzxander) wrote :

root@maas:~# dpkg -l | egrep 'python3.5|maas'
ii libpython3.5:amd64 3.5.2-2~16.01 amd64 Shared Python runtime library (version 3.5)
ii libpython3.5-minimal:amd64 3.5.2-2~16.01 amd64 Minimal subset of the Python language (version 3.5)
ii libpython3.5-stdlib:amd64 3.5.2-2~16.01 amd64 Interactive high-level object-oriented language (standard library, version 3.5)
ii maas 2.0.0~rc2+bzr5156-0ubuntu1~16.04.2 all "Metal as a Service" is a physical cloud and IPAM
ii maas-cli 2.0.0~rc2+bzr5156-0ubuntu1~16.04.2 all MAAS client and command-line interface
rc maas-cluster-controller 1.9.4+bzr4592-0ubuntu1~14.04.1 all MAAS server cluster controller
ii maas-common 2.0.0~rc2+bzr5156-0ubuntu1~16.04.2 all MAAS server common files
ii maas-dhcp 2.0.0~rc2+bzr5156-0ubuntu1~16.04.2 all MAAS DHCP server
ii maas-dns 2.0.0~rc2+bzr5156-0ubuntu1~16.04.2 all MAAS DNS server
ii maas-proxy 2.0.0~rc2+bzr5156-0ubuntu1~16.04.2 all MAAS Caching Proxy
ii maas-rack-controller 2.0.0~rc2+bzr5156-0ubuntu1~16.04.2 all Rack Controller for MAAS
ii maas-region-api 2.0.0~rc2+bzr5156-0ubuntu1~16.04.2 all Region controller API service for MAAS
ii maas-region-controller 2.0.0~rc2+bzr5156-0ubuntu1~16.04.2 all Region Controller for MAAS
rc maas-region-controller-min 1.9.4+bzr4592-0ubuntu1~14.04.1 all MAAS Server minimum region controller
ii python3-django-maas 2.0.0~rc2+bzr5156-0ubuntu1~16.04.2 all MAAS server Django web framework (Python 3)
ii python3-maas-client 2.0.0~rc2+bzr5156-0ubuntu1~16.04.2 all MAAS python API client (Python 3)
ii python3-maas-provisioningserver 2.0.0~rc2+bzr5156-0ubuntu1~16.04.2 all MAAS server provisioning libraries (Python 3)
ii python3.5 3.5.2-2~16.01 amd64 Interactive high-level object-oriented language (version 3.5)
ii python3.5-minimal 3.5.2-2~16.01 amd64 Minimal subset of the Python language (version 3.5)

this machine went through do-release-upgrade from trusty to xenial after a fresh MAAS installation on 14.04 boot media.

Alexander Gabert (alzxander) wrote :

maas/next and a reboot fixes this for me.

root@maas:~# dpkg -l | grep maas
ii maas 2.0.0~rc4+bzr5187-0ubuntu1~xenial1 all "Metal as a Service" is a physical cloud and IPAM
ii maas-cli 2.0.0~rc4+bzr5187-0ubuntu1~xenial1 all MAAS client and command-line interface
rc maas-cluster-controller 1.9.4+bzr4592-0ubuntu1~14.04.1 all MAAS server cluster controller
ii maas-common 2.0.0~rc4+bzr5187-0ubuntu1~xenial1 all MAAS server common files
ii maas-dhcp 2.0.0~rc4+bzr5187-0ubuntu1~xenial1 all MAAS DHCP server
ii maas-dns 2.0.0~rc4+bzr5187-0ubuntu1~xenial1 all MAAS DNS server
ii maas-proxy 2.0.0~rc4+bzr5187-0ubuntu1~xenial1 all MAAS Caching Proxy
ii maas-rack-controller 2.0.0~rc4+bzr5187-0ubuntu1~xenial1 all Rack Controller for MAAS
ii maas-region-api 2.0.0~rc4+bzr5187-0ubuntu1~xenial1 all Region controller API service for MAAS
ii maas-region-controller 2.0.0~rc4+bzr5187-0ubuntu1~xenial1 all Region Controller for MAAS
rc maas-region-controller-min 1.9.4+bzr4592-0ubuntu1~14.04.1 all MAAS Server minimum region controller
ii python3-django-maas 2.0.0~rc4+bzr5187-0ubuntu1~xenial1 all MAAS server Django web framework (Python 3)
ii python3-maas-client 2.0.0~rc4+bzr5187-0ubuntu1~xenial1 all MAAS python API client (Python 3)
ii python3-maas-provisioningserver 2.0.0~rc4+bzr5187-0ubuntu1~xenial1 all MAAS server provisioning libraries (Python 3)
root@maas:~# cat /etc/apt/sources.list.d/maas-ubuntu-next-xenial.list
deb http://ppa.launchpad.net/maas/next/ubuntu xenial main
# deb-src http://ppa.launchpad.net/maas/next/ubuntu xenial main

Changed in maas:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers