dgzlopes / cloud-detect

Module that determines a host's cloud provider.
https://pypi.org/project/cloud-detect/
MIT License
35 stars 13 forks source link

Doesn't work + key error for aws #8

Closed artemisart closed 3 years ago

artemisart commented 3 years ago

Hello, the example in the readme does not work (cloud-detect 0.0.5)

import cloud_detect
cloud_detect.provider()

gives

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/tmp/ipykernel_7506/1274223439.py in <module>
----> 1 cloud_detect.provider()

~/anaconda3/envs/monk-mathis/lib/python3.8/site-packages/cloud_detect/__init__.py in provider(excluded)
     10 
     11 def provider(excluded=[]):
---> 12     if 'alibaba' not in excluded and AlibabaProvider.identify():
     13         logging.debug('Cloud_detect result is alibaba')
     14         return 'alibaba'

TypeError: identify() missing 1 required positional argument: 'self'

AlibabaProvider should be instanced as identify() is not a class method.

AWSProvider is broken too (cloud_detect.AWSProvider().identify()), check_metadata_server() checks the value of instanceID but it should be instanceId. I will make a PR.

EDIT: the tests are completely broken

dgzlopes commented 3 years ago

Thanks! I'll cut a new release.