-
Notifications
You must be signed in to change notification settings - Fork 215
Description
Hi,
I am trying to use vsts installed from pip in an Azure Automation python 2 runbook.
The funfact is, msrest is installed on a machine which runs the runbook but vsts is not. So I apply a horrific hack executing
subprocess.call([sys.executable, "-u", "-m", "pip", "install", "vsts", "--no-deps"])
which actually installs this module:
Downloading https://files.pythonhosted.org/packages/8d/f0/97266a8d2f321285829ef13f3236b842e76fd7f58775e4873a99fff8faaf/vsts-0.1.9.tar.gz (819kB)
So far good.
I get to the part of getting the client:
from vsts.vss_connection import VssConnection
from msrest.authentication import BasicTokenAuthentication
vsts_instance = get_config(key="vsts_instance")
vsts_token = get_config(key="VstsAuthToken")
client_version = get_config(key="client_version")
credentials = BasicTokenAuthentication(token={"access_token": vsts_token})
connection = VssConnection(base_url=vsts_instance, creds=credentials)
core_client = connection.get_client(client_type=client_version)
The last line raises the following exception:
ImportError('No module named "vsts.core.v4_0.core_client',)
Traceback (most recent call last):
File "C:\Temp\eqtl2m0n.xsn\881221a4-9ba3-4c4b-8ba0-61bcced3f6ea", line 112, in <module>
core_client = connection.get_client(client_type=client_version)
File "C:\Python27\lib\site-packages\vsts\vss_connection.py", line 34, in get_client
client_class = self._get_class(client_type)
File "C:\Python27\lib\site-packages\vsts\vss_connection.py", line 42, in _get_class
imported = __import__(module_name)
ImportError: No module named "vsts.core.v4_0.core_client
Even funnier thing is, I was able to get past the import magic performed in vss_connection with the very same config parameters while testing on my machine locally (but fail due to authorization, however that's another problem, not this scope).
I am yet to do a recursive printing of the contents of the installed vsts module but I feel something deeper is the issue. Can you throw me some pointers, please?