GoCD server's version can not be parsed
Opened this issue · 4 comments
GoCD's about page changed layout and is thus no longer parsable by the InfoManager
class.
Which leads to an error when trying to connect to a GOCD-Server v19.5.0
Change was introduced in https://github.com/gocd/gocd/tree/8a306c2f65d72fcaea50ad31cfd05470e0df7844
Hello!
Is there any activity on this issue?
No, the issue are still the tests, did not have time to revisit them. PRs are welcome.
We use my branch in production and it seems to be doing what it is supposed to
I am getting the following error. Is it a symptom of this issue?
>>> client.pipelines[$PIPELINE]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "$PYTHON_HOME/.virtualenv/$ENV/lib/python3.6/site-packages/yagocd/resources/pipeline.py", line 74, in __getitem__
return self.find(name=name)
File "$PYTHON_HOME/.virtualenv/$ENV/lib/python3.6/site-packages/yagocd/util.py", line 89, in decorated
if LooseVersion(server_version) < self._since_version:
File "/usr/lib/python3.6/distutils/version.py", line 52, in __lt__
c = self._cmp(other)
File "/usr/lib/python3.6/distutils/version.py", line 335, in _cmp
if self.version == other.version:
AttributeError: 'LooseVersion' object has no attribute 'version'
My current workaround is to simply comment out lines 89 through 98 in yagocd/util.py
like so:
def __call__(self, entity):
@functools.wraps(entity)
def decorated(*args, **kwargs):
if self.ENABLED:
this = args[0]
server_version = this._session.server_version
'''
if LooseVersion(server_version) < self._since_version:
name = "{}.{}".format(this.__class__.__name__, entity.__name__)
raise RuntimeError(
"Method `{name}` is not supported on '{server_version}' "
"version of GoCD, it has been added only in '{since_version}' version!".format(
name=name,
server_version=server_version,
since_version=self._since_version
)
)
'''
return entity(*args, **kwargs)
Everything else seems to work okay when I do this, but this obviously shouldn't be a long term solution. I wanted to make sure I'm not opening a new issue if this issue is what my problem is.
EDIT:
You can actually just set this rather than commenting out:
class Since(object):
# Parameter for controlling version compatibility checks.
# Setting this to `False` will skip checking the server
# version on each function call.
ENABLED = False