Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GoCD server's version can not be parsed #12

Open
madonius opened this issue Jul 9, 2019 · 4 comments · May be fixed by #13
Open

GoCD server's version can not be parsed #12

madonius opened this issue Jul 9, 2019 · 4 comments · May be fixed by #13

Comments

@madonius
Copy link
Collaborator

madonius commented Jul 9, 2019

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

@madonius
Copy link
Collaborator Author

madonius commented Jul 9, 2019

@madonius madonius linked a pull request Jul 9, 2019 that will close this issue
@artsilenkov
Copy link

Hello!
Is there any activity on this issue?

@madonius
Copy link
Collaborator Author

madonius commented Feb 10, 2020

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

@ghost
Copy link

ghost commented Apr 13, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants