Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…lab-sortinghat'

Merges #737
Closes #737
  • Loading branch information
sduenas committed Feb 9, 2023
2 parents 370f220 + fd2e443 commit 0106435
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 21 deletions.
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Releases

## sortinghat 0.8.1 - (2023-02-03)

* Update Poetry's package dependencies

## sortinghat 0.8.0 - (2023-02-01)

**New features:**
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ $ apt install libmysqlclient-dev
* **MariaDB**

```
$ apt install libmariadbclient-dev
$ apt install libmariadbclient-dev-compat
```

#### Installation and configuration
Expand Down Expand Up @@ -128,7 +128,7 @@ $ yarn install

Run SortingHat frontend Vue app:
```
$ yarn serve
$ yarn serve --api_url=http://localhost:8000/api/
```


Expand All @@ -155,6 +155,12 @@ In order to run the service for the first time, you need to execute the next com
Build the UI interface:
```
$ cd ui
$ yarn install
$ yarn build --mode development
```
If you want to run the UI at `/identities` run (you need to use the server
behind a proxy server):
```
$ yarn build
```

Expand Down
16 changes: 8 additions & 8 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "sortinghat"
version = "0.8.0"
version = "0.8.1"
description = "A tool to manage identities."
authors = [
"GrimoireLab Developers"
Expand Down Expand Up @@ -54,7 +54,7 @@ click = "7.1.1"
Django = "^3.2"
django-graphql-jwt = "^0.3.0"
graphene-django = "^2.15"
sgqlc = "^10.1"
sgqlc = "^16.1"
mysqlclient = "2.0.3"
python-dateutil = "^2.8.2"
requests = "^2.7.0"
Expand Down
3 changes: 3 additions & 0 deletions releases/0.8.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## sortinghat 0.8.1 - (2023-02-03)

* Update Poetry's package dependencies
8 changes: 8 additions & 0 deletions releases/unreleased/verify-ssl-option-for-client.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: Verify SSL option for client
category: added
author: Jose Javier Merchante <[email protected]>
issue: null
notes: |
Include an option for the client to verify if the certificate is
valid. By default it is verified.
4 changes: 2 additions & 2 deletions sortinghat/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# File auto-generated by semverup on 2023-02-01 10:59:30.391457
__version__ = "0.8.0"
# File auto-generated by semverup on 2023-02-03 08:30:48.949189
__version__ = "0.8.1"
12 changes: 8 additions & 4 deletions sortinghat/cli/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import requests
import urllib.parse

from sgqlc.endpoint.http import HTTPEndpoint
from sgqlc.endpoint.requests import RequestsEndpoint
from sgqlc.operation import Operation
from sgqlc.types import Scalar

Expand Down Expand Up @@ -70,10 +70,11 @@ class SortingHatClient:
:raises ValueError: when any of the given parameters is invalid
"""
def __init__(self, host, port=9314, path=None, user=None, password=None, ssl=True):
def __init__(self, host, port=9314, path=None, user=None, password=None, ssl=True, verify_ssl=True):
self.gqlc = None
self.host = host
self.port = port
self.verify_ssl = verify_ssl

scheme = 'https' if ssl else 'http'
netloc = self.host + ':' + str(self.port) if self.port else self.host
Expand Down Expand Up @@ -101,8 +102,11 @@ def __init__(self, host, port=9314, path=None, user=None, password=None, ssl=Tru
def connect(self):
"""Establish a connection to the server."""

session = requests.Session()
session.verify = self.verify_ssl

try:
result = requests.get(self.url, headers={'Accept': 'text/html'})
result = session.get(self.url, headers={'Accept': 'text/html'})
result.raise_for_status()
except requests.exceptions.RequestException as exc:
if result.status_code != 400:
Expand All @@ -116,7 +120,7 @@ def connect(self):
'Referer': self.url
}

self.gqlc = HTTPEndpoint(self.url, headers)
self.gqlc = RequestsEndpoint(self.url, headers, session=session)

if self.user and self.password:
op = Operation(sh_schema.SortingHatMutation)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import unittest

import httpretty
import sgqlc.endpoint.http
import sgqlc.endpoint.requests

from sgqlc.operation import Operation

Expand Down Expand Up @@ -135,7 +135,7 @@ def test_connect(self):
client = SortingHatClient('localhost', ssl=False)
client.connect()

self.assertIsInstance(client.gqlc, sgqlc.endpoint.http.HTTPEndpoint)
self.assertIsInstance(client.gqlc, sgqlc.endpoint.requests.RequestsEndpoint)

latest_requests = httpretty.latest_requests()
self.assertEqual(len(latest_requests), 1)
Expand Down Expand Up @@ -186,7 +186,7 @@ def test_authentication(self):
client = SortingHatClient('localhost', user='admin', password='admin', ssl=False)
client.connect()

self.assertIsInstance(client.gqlc, sgqlc.endpoint.http.HTTPEndpoint)
self.assertIsInstance(client.gqlc, sgqlc.endpoint.requests.RequestsEndpoint)

latest_requests = httpretty.latest_requests()
self.assertEqual(len(latest_requests), 3)
Expand Down

0 comments on commit 0106435

Please sign in to comment.