Skip to content

Commit 147a569

Browse files
author
Gauvain Pocentek
committed
cli: support ssl_verify config option
1 parent bb7ba7a commit 147a569

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Here's an example of the syntax:
6969
`````
7070
[global]
7171
default = local
72+
ssl_verify = true
7273
7374
[local]
7475
url = http://10.0.3.2:8080
@@ -77,12 +78,16 @@ private_token = vTbFeqJYCY3sibBP7BZM
7778
[distant]
7879
url = https://some.whe.re
7980
private_token = thisisaprivatetoken
81+
ssl_verify = false
8082
`````
8183

8284
The [global] section define which server is accesed by default.
8385
Each other section defines how to access a server. Only private token
8486
authentication is supported (not user/password).
8587

88+
The `ssl_verify` option defines if the server SSL certificate should be
89+
validated (use false for self signed certificates, only useful with https).
90+
8691
Choosing a different server than the default one can be done at run time:
8792

8893
`````

gitlab

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def usage():
126126

127127
def do_auth():
128128
try:
129-
gl = gitlab.Gitlab(gitlab_url, private_token=gitlab_token)
129+
gl = gitlab.Gitlab(gitlab_url, private_token=gitlab_token, ssl_verify=ssl_verify)
130130
gl.auth()
131131
except:
132132
die("Could not connect to GitLab (%s)" % gitlab_url)
@@ -204,6 +204,7 @@ def do_update(cls, d):
204204
return o
205205

206206

207+
ssl_verify = True
207208
gitlab_id = None
208209
verbose = False
209210

@@ -272,6 +273,15 @@ try:
272273
except:
273274
die("Impossible to get gitlab informations from configuration (%s)" % gitlab_id)
274275

276+
try:
277+
ssl_verify = config.getboolean('global', 'ssl_verify')
278+
except:
279+
pass
280+
try:
281+
ssl_verify = config.getboolean(gitlab_id, 'ssl_verify')
282+
except:
283+
pass
284+
275285
try:
276286
what = args.pop(0)
277287
action = args.pop(0)

0 commit comments

Comments
 (0)