rhpit/paws

AttributeError: 'module' object has no attribute 'GSSException'

abraverm opened this issue · 3 comments

Hi, I've installed paws on Fedora 27 with pip without virtaulenv and tried running
paws provision but it fails on AttributeError: 'module' object has no attribute 'GSSException':

# paws provision
Traceback (most recent call last):
  File "/usr/bin/paws", line 11, in <module>
    load_entry_point('paws-cli==0.3.9', 'console_scripts', 'paws')()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 572, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2755, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2408, in load
    return self.resolve()
  File "/usr/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2414, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/python2.7/site-packages/paws/cli.py", line 32, in <module>
    from paws.helpers import file_mgmt
  File "/usr/lib/python2.7/site-packages/paws/helpers.py", line 30, in <module>
    from paramiko import AutoAddPolicy, SSHClient
  File "/usr/lib/python2.7/site-packages/paramiko/__init__.py", line 22, in <module>
    from paramiko.transport import SecurityOptions, Transport
  File "/usr/lib/python2.7/site-packages/paramiko/transport.py", line 38, in <module>
    from paramiko.auth_handler import AuthHandler
  File "/usr/lib/python2.7/site-packages/paramiko/auth_handler.py", line 48, in <module>
    from paramiko.ssh_gss import GSSAuth, GSS_EXCEPTIONS
  File "/usr/lib/python2.7/site-packages/paramiko/ssh_gss.py", line 54, in <module>
    GSS_EXCEPTIONS = (gssapi.GSSException,)
AttributeError: 'module' object has no attribute 'GSSException'

When I tried it in a virtualenv, it didn't show that error. After a bit of poking, it seems having 'gssapi' library install causing the issue.

Pip freeze:

ansible==2.4.3.0
appdirs==1.4.3
asn1crypto==0.24.0
Babel==2.5.3
bcrypt==3.1.4
certifi==2018.1.18
cffi==1.11.4
chardet==3.0.4
click==6.7
cryptography==2.1.4
debtcollector==1.19.0
decorator==4.2.1
dogpile.cache==0.6.4
enum34==1.1.6
funcsigs==1.0.2
functools32==3.2.3.post2
futures==3.2.0
gssapi==1.3.0
idna==2.6
ipaddress==1.0.19
iso8601==0.1.12
Jinja2==2.10
jmespath==0.9.3
jsonpatch==1.21
jsonpointer==2.0
jsonschema==2.6.0
keystoneauth1==3.4.0
MarkupSafe==1.0
monotonic==1.4
msgpack==0.5.4
munch==2.2.0
netaddr==0.7.19
netifaces==0.10.6
ntlm-auth==1.0.6
os-client-config==1.29.0
oslo.config==5.2.0
oslo.i18n==3.19.0
oslo.serialization==2.24.0
oslo.utils==3.35.0
paramiko==2.4.0
paws-cli==0.3.9
pbr==3.1.1
prettytable==0.7.2
pyasn1==0.4.2
pycparser==2.18
PyNaCl==1.2.1
pyOpenSSL==17.5.0
pyparsing==2.2.0
python-glanceclient==2.9.1
python-keystoneclient==3.15.0
python-novaclient==10.1.0
pytz==2018.3
pywinrm==0.3.0
PyYAML==3.12
requests==2.18.4
requests-ntlm==1.1.0
requestsexceptions==1.4.0
rfc3986==1.1.0
shade==1.26.0
simplejson==3.13.2
six==1.11.0
stevedore==1.28.0
urllib3==1.22
warlock==1.3.0
wrapt==1.10.11
xmltodict==0.11.0

Looks like its a known issue:
paramiko/paramiko#1068
paramiko/paramiko#1069

@abraverm I am assuming you have the gssapi library installed in your global system site packages?

Is there a preferred way you need to run paws in your environment: within a virtual environment or not?

I did see a comment in the issues, if you install python-gssapi library you should be able to run paws successfully. If you installed this package in your global system site packages would that effect anything on your end?

Another potential way to have paws work with gssapi library installed would be to downgrade paramiko to the last working version until they have any open PR's to resolve this exception in a new version.

I'm not sure when did I install gssapi and for what purpose, probably it was dependency of other package. I personally keep tools such as paws in the global system environment and this how I stumbled on this issue. Maybe python-gssapi will fix it, but I think downgrading paramiko in this case will make paws less depended on user choices.

This issue is resolved and will be available in the next release of paws.