Skip to content

Gitlab.from_config doesn't allow string ssl_verify #270

Closed
@mdhausman

Description

@mdhausman

For many users who are working with self-signed certs, ssl verification can be troublesome. I found that while I could use python-gitlab with our internal certs, I can't do it from a configuration file.

For instance, this works:

gitlab_dao = gitlab.Gitlab('https://our.gitlab.location', private_token='somethingprivate', ssl_verify='/our/companys/internal/certs/cert.crt')

But when I tried to set up a config file like

[global]
default = https://our.gitlab.location
ssl_verify = /our/companys/internal/certs/cert.crt
timeout = 5
api_version = 3

[somewhere]
url = https://our.gitlab.location
private_token = somethingprivate

And call it with gitlab_dao = gitlab.Gitlab.from_config('somewhere', ['my-config.cfg']), it would break on gitlab_dao.auth().

Some debugging led me to the reason: GitlabConfigParser line 66: self.ssl_verify = self._config.getboolean(self.gitlab_id, 'ssl_verify')

Because it's only looking for a boolean, it throws an exception here and sets ssl_verify to True. This kills the internal cert.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions