diff --git a/grimoire_elk/elk.py b/grimoire_elk/elk.py index fa4ffa615..cf65d914b 100755 --- a/grimoire_elk/elk.py +++ b/grimoire_elk/elk.py @@ -490,7 +490,8 @@ def enrich_backend(url, clean, backend_name, backend_params, cfg_section_name, github_token=None, studies=False, only_studies=False, url_enrich=None, events_enrich=False, db_user=None, db_password=None, db_host=None, - db_port=None, db_path=None, db_ssl=False, db_verify_ssl=True, + db_port=None, db_path=None, db_ssl=False, + db_verify_ssl=True, db_tenant=None, do_refresh_projects=False, do_refresh_identities=False, author_id=None, author_uuid=None, filter_raw=None, jenkins_rename_file=None, @@ -539,7 +540,8 @@ def enrich_backend(url, clean, backend_name, backend_params, cfg_section_name, db_port=db_port, db_path=db_path, db_ssl=db_ssl, - db_verify_ssl=db_verify_ssl) + db_verify_ssl=db_verify_ssl, + db_tenant=db_tenant) enrich_backend.set_params(backend_params) # store the cfg section name in the enrich backend to recover the corresponding project name in projects.json enrich_backend.set_cfg_section_name(cfg_section_name) diff --git a/grimoire_elk/enriched/cocom.py b/grimoire_elk/enriched/cocom.py index 412d66203..550d07c8e 100644 --- a/grimoire_elk/enriched/cocom.py +++ b/grimoire_elk/enriched/cocom.py @@ -150,10 +150,11 @@ class CocomEnrich(Enrich): def __init__(self, db_sortinghat=None, json_projects_map=None, db_user='', db_password='', db_host='', db_path=None, - db_port=None, db_ssl=False, db_verify_ssl=True): + db_port=None, db_ssl=False, db_verify_ssl=True, db_tenant=None): super().__init__(db_sortinghat=db_sortinghat, json_projects_map=json_projects_map, db_user=db_user, db_password=db_password, db_host=db_host, - db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl) + db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl, + db_tenant=db_tenant) self.studies = [] self.studies.append(self.enrich_cocom_analysis) diff --git a/grimoire_elk/enriched/colic.py b/grimoire_elk/enriched/colic.py index ac142f825..16c7c7bf2 100644 --- a/grimoire_elk/enriched/colic.py +++ b/grimoire_elk/enriched/colic.py @@ -86,10 +86,11 @@ class ColicEnrich(Enrich): def __init__(self, db_sortinghat=None, json_projects_map=None, db_user='', db_password='', db_host='', db_path=None, - db_port=None, db_ssl=False, db_verify_ssl=True): + db_port=None, db_ssl=False, db_verify_ssl=True, db_tenant=None): super().__init__(db_sortinghat=db_sortinghat, json_projects_map=json_projects_map, db_user=db_user, db_password=db_password, db_host=db_host, - db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl) + db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl, + db_tenant=db_tenant) self.studies = [] self.studies.append(self.enrich_colic_analysis) diff --git a/grimoire_elk/enriched/discourse.py b/grimoire_elk/enriched/discourse.py index bdb9639dd..d52a43fc4 100644 --- a/grimoire_elk/enriched/discourse.py +++ b/grimoire_elk/enriched/discourse.py @@ -64,10 +64,11 @@ class DiscourseEnrich(Enrich): def __init__(self, db_sortinghat=None, json_projects_map=None, db_user='', db_password='', db_host='', db_path=None, - db_port=None, db_ssl=False, db_verify_ssl=True): + db_port=None, db_ssl=False, db_verify_ssl=True, db_tenant=None): super().__init__(db_sortinghat=db_sortinghat, json_projects_map=json_projects_map, db_user=db_user, db_password=db_password, db_host=db_host, - db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl) + db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl, + db_tenant=db_tenant) self.categories = {} # Map from category_id to category_name self.categories_tree = {} # Categories with subcategories diff --git a/grimoire_elk/enriched/dockerdeps.py b/grimoire_elk/enriched/dockerdeps.py index 94d73bf92..933fe808c 100644 --- a/grimoire_elk/enriched/dockerdeps.py +++ b/grimoire_elk/enriched/dockerdeps.py @@ -74,10 +74,11 @@ class Dockerdeps(Enrich): def __init__(self, db_sortinghat=None, json_projects_map=None, db_user='', db_password='', db_host='', db_path=None, - db_port=None, db_ssl=False, db_verify_ssl=True): + db_port=None, db_ssl=False, db_verify_ssl=True, db_tenant=None): super().__init__(db_sortinghat=db_sortinghat, json_projects_map=json_projects_map, db_user=db_user, db_password=db_password, db_host=db_host, - db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl) + db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl, + db_tenant=db_tenant) self.studies = [] diff --git a/grimoire_elk/enriched/dockersmells.py b/grimoire_elk/enriched/dockersmells.py index 45b71c565..134fc88bf 100644 --- a/grimoire_elk/enriched/dockersmells.py +++ b/grimoire_elk/enriched/dockersmells.py @@ -74,10 +74,11 @@ class Dockersmells(Enrich): def __init__(self, db_sortinghat=None, json_projects_map=None, db_user='', db_password='', db_host='', db_path=None, - db_port=None, db_ssl=False, db_verify_ssl=True): + db_port=None, db_ssl=False, db_verify_ssl=True, db_tenant=None): super().__init__(db_sortinghat=db_sortinghat, json_projects_map=json_projects_map, db_user=db_user, db_password=db_password, db_host=db_host, - db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl) + db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl, + db_tenant=db_tenant) self.studies = [] diff --git a/grimoire_elk/enriched/enrich.py b/grimoire_elk/enriched/enrich.py index 600400d39..d0f94b7c5 100644 --- a/grimoire_elk/enriched/enrich.py +++ b/grimoire_elk/enriched/enrich.py @@ -117,7 +117,7 @@ class Enrich(ElasticItems): def __init__(self, db_sortinghat=None, json_projects_map=None, db_user='', db_password='', db_host='', insecure=True, db_port=None, db_path=None, - db_ssl=False, db_verify_ssl=True): + db_ssl=False, db_verify_ssl=True, db_tenant=None): perceval_backend = None super().__init__(perceval_backend, insecure=insecure) @@ -132,7 +132,8 @@ def __init__(self, db_sortinghat=None, json_projects_map=None, db_user='', client = SortingHatClient(host=db_host, port=db_port, path=db_path, ssl=db_ssl, verify_ssl=db_verify_ssl, - user=db_user, password=db_password) + user=db_user, password=db_password, + tenant=db_tenant) client.connect() client.gqlc.logger.setLevel(logging.CRITICAL) Enrich.sh_db = client diff --git a/grimoire_elk/enriched/gerrit.py b/grimoire_elk/enriched/gerrit.py index 753fa9e76..ee63dd6e0 100644 --- a/grimoire_elk/enriched/gerrit.py +++ b/grimoire_elk/enriched/gerrit.py @@ -89,10 +89,11 @@ class GerritEnrich(Enrich): def __init__(self, db_sortinghat=None, json_projects_map=None, db_user='', db_password='', db_host='', db_path=None, - db_port=None, db_ssl=False, db_verify_ssl=True): + db_port=None, db_ssl=False, db_verify_ssl=True, db_tenant=None): super().__init__(db_sortinghat=db_sortinghat, json_projects_map=json_projects_map, db_user=db_user, db_password=db_password, db_host=db_host, - db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl) + db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl, + db_tenant=db_tenant) self.studies = [] self.studies.append(self.enrich_demography) diff --git a/grimoire_elk/enriched/git.py b/grimoire_elk/enriched/git.py index fb2dfcdbe..a191acee4 100644 --- a/grimoire_elk/enriched/git.py +++ b/grimoire_elk/enriched/git.py @@ -94,10 +94,12 @@ class GitEnrich(Enrich): def __init__(self, db_sortinghat=None, json_projects_map=None, db_user='', db_password='', db_host='', db_path=None, - db_port=None, db_ssl=False, db_verify_ssl=True, pair_programming=False): + db_port=None, db_ssl=False, db_verify_ssl=True, db_tenant=None, + pair_programming=False): super().__init__(db_sortinghat=db_sortinghat, json_projects_map=json_projects_map, db_user=db_user, db_password=db_password, db_host=db_host, - db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl) + db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl, + db_tenant=db_tenant) self.studies = [] self.studies.append(self.enrich_demography) diff --git a/grimoire_elk/enriched/github.py b/grimoire_elk/enriched/github.py index 1eef2df48..3e4d9c308 100644 --- a/grimoire_elk/enriched/github.py +++ b/grimoire_elk/enriched/github.py @@ -106,10 +106,11 @@ class GitHubEnrich(Enrich): def __init__(self, db_sortinghat=None, json_projects_map=None, db_user='', db_password='', db_host='', db_path=None, - db_port=None, db_ssl=False, db_verify_ssl=True): + db_port=None, db_ssl=False, db_verify_ssl=True, db_tenant=None): super().__init__(db_sortinghat=db_sortinghat, json_projects_map=json_projects_map, db_user=db_user, db_password=db_password, db_host=db_host, - db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl) + db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl, + db_tenant=db_tenant) self.studies = [] self.studies.append(self.enrich_onion) diff --git a/grimoire_elk/enriched/github2.py b/grimoire_elk/enriched/github2.py index c9400b2c0..fd7751fdc 100644 --- a/grimoire_elk/enriched/github2.py +++ b/grimoire_elk/enriched/github2.py @@ -107,10 +107,11 @@ class GitHubEnrich2(Enrich): def __init__(self, db_sortinghat=None, json_projects_map=None, db_user='', db_password='', db_host='', db_path=None, - db_port=None, db_ssl=False, db_verify_ssl=True): + db_port=None, db_ssl=False, db_verify_ssl=True, db_tenant=None): super().__init__(db_sortinghat=db_sortinghat, json_projects_map=json_projects_map, db_user=db_user, db_password=db_password, db_host=db_host, - db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl) + db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl, + db_tenant=db_tenant) self.studies = [] self.studies.append(self.enrich_geolocation) diff --git a/grimoire_elk/enriched/githubql.py b/grimoire_elk/enriched/githubql.py index 63399e75c..c6545c492 100644 --- a/grimoire_elk/enriched/githubql.py +++ b/grimoire_elk/enriched/githubql.py @@ -78,10 +78,11 @@ class GitHubQLEnrich(Enrich): def __init__(self, db_sortinghat=None, json_projects_map=None, db_user='', db_password='', db_host='', db_path=None, - db_port=None, db_ssl=False, db_verify_ssl=True): + db_port=None, db_ssl=False, db_verify_ssl=True, db_tenant=None): super().__init__(db_sortinghat=db_sortinghat, json_projects_map=json_projects_map, db_user=db_user, db_password=db_password, db_host=db_host, - db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl) + db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl, + db_tenant=db_tenant) self.studies = [self.enrich_duration_analysis, self.enrich_reference_analysis] diff --git a/grimoire_elk/enriched/gitlab.py b/grimoire_elk/enriched/gitlab.py index f59f017ce..92e7b900a 100644 --- a/grimoire_elk/enriched/gitlab.py +++ b/grimoire_elk/enriched/gitlab.py @@ -76,10 +76,11 @@ class GitLabEnrich(Enrich): def __init__(self, db_sortinghat=None, json_projects_map=None, db_user='', db_password='', db_host='', db_path=None, - db_port=None, db_ssl=False, db_verify_ssl=True): + db_port=None, db_ssl=False, db_verify_ssl=True, db_tenant=None): super().__init__(db_sortinghat=db_sortinghat, json_projects_map=json_projects_map, db_user=db_user, db_password=db_password, db_host=db_host, - db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl) + db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl, + db_tenant=db_tenant) self.users = {} # cache users self.studies = [] diff --git a/grimoire_elk/enriched/gitter.py b/grimoire_elk/enriched/gitter.py index f45f9127d..3956d91e2 100644 --- a/grimoire_elk/enriched/gitter.py +++ b/grimoire_elk/enriched/gitter.py @@ -65,10 +65,11 @@ class GitterEnrich(Enrich): def __init__(self, db_sortinghat=None, json_projects_map=None, db_user='', db_password='', db_host='', db_path=None, - db_port=None, db_ssl=False, db_verify_ssl=True): + db_port=None, db_ssl=False, db_verify_ssl=True, db_tenant=None): super().__init__(db_sortinghat=db_sortinghat, json_projects_map=json_projects_map, db_user=db_user, db_password=db_password, db_host=db_host, - db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl) + db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl, + db_tenant=db_tenant) def get_field_author(self): return "fromUser" diff --git a/grimoire_elk/enriched/jenkins.py b/grimoire_elk/enriched/jenkins.py index be90695dd..d97dfcdab 100644 --- a/grimoire_elk/enriched/jenkins.py +++ b/grimoire_elk/enriched/jenkins.py @@ -61,10 +61,12 @@ class JenkinsEnrich(Enrich): def __init__(self, db_sortinghat=None, json_projects_map=None, db_user='', db_password='', db_host='', db_path=None, - db_port=None, db_ssl=False, db_verify_ssl=True, node_regex=None): + db_port=None, db_ssl=False, db_verify_ssl=True, db_tenant=None, + node_regex=None): super().__init__(db_sortinghat=db_sortinghat, json_projects_map=json_projects_map, db_user=db_user, db_password=db_password, db_host=db_host, - db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl) + db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl, + db_tenant=db_tenant) self.nodes_rename_file = None self.nodes_rename = {} self.node_regex = node_regex diff --git a/grimoire_elk/enriched/launchpad.py b/grimoire_elk/enriched/launchpad.py index 151b7e646..122103d03 100644 --- a/grimoire_elk/enriched/launchpad.py +++ b/grimoire_elk/enriched/launchpad.py @@ -63,10 +63,11 @@ class LaunchpadEnrich(Enrich): def __init__(self, db_sortinghat=None, json_projects_map=None, db_user='', db_password='', db_host='', db_path=None, - db_port=None, db_ssl=False, db_verify_ssl=True): + db_port=None, db_ssl=False, db_verify_ssl=True, db_tenant=None): super().__init__(db_sortinghat=db_sortinghat, json_projects_map=json_projects_map, db_user=db_user, db_password=db_password, db_host=db_host, - db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl) + db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl, + db_tenant=db_tenant) def get_field_author(self): return "owner_data" diff --git a/grimoire_elk/enriched/mattermost.py b/grimoire_elk/enriched/mattermost.py index 3c5cf8bdc..149bdc77a 100644 --- a/grimoire_elk/enriched/mattermost.py +++ b/grimoire_elk/enriched/mattermost.py @@ -60,10 +60,11 @@ class MattermostEnrich(Enrich): def __init__(self, db_sortinghat=None, json_projects_map=None, db_user='', db_password='', db_host='', db_path=None, - db_port=None, db_ssl=False, db_verify_ssl=True): + db_port=None, db_ssl=False, db_verify_ssl=True, db_tenant=None): super().__init__(db_sortinghat=db_sortinghat, json_projects_map=json_projects_map, db_user=db_user, db_password=db_password, db_host=db_host, - db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl) + db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl, + db_tenant=db_tenant) self.studies = [] self.studies.append(self.enrich_demography) diff --git a/grimoire_elk/enriched/mbox.py b/grimoire_elk/enriched/mbox.py index 702bf748d..a4cb25417 100644 --- a/grimoire_elk/enriched/mbox.py +++ b/grimoire_elk/enriched/mbox.py @@ -67,10 +67,11 @@ class MBoxEnrich(Enrich): def __init__(self, db_sortinghat=None, json_projects_map=None, db_user='', db_password='', db_host='', db_path=None, - db_port=None, db_ssl=False, db_verify_ssl=True): + db_port=None, db_ssl=False, db_verify_ssl=True, db_tenant=None): super().__init__(db_sortinghat=db_sortinghat, json_projects_map=json_projects_map, db_user=db_user, db_password=db_password, db_host=db_host, - db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl) + db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl, + db_tenant=db_tenant) self.studies = [self.kafka_kip] diff --git a/grimoire_elk/enriched/pagure.py b/grimoire_elk/enriched/pagure.py index b7115f1b0..49c1e9b45 100644 --- a/grimoire_elk/enriched/pagure.py +++ b/grimoire_elk/enriched/pagure.py @@ -74,10 +74,11 @@ class PagureEnrich(Enrich): def __init__(self, db_sortinghat=None, json_projects_map=None, db_user='', db_password='', db_host='', db_path=None, - db_port=None, db_ssl=False, db_verify_ssl=True): + db_port=None, db_ssl=False, db_verify_ssl=True, db_tenant=None): super().__init__(db_sortinghat=db_sortinghat, json_projects_map=json_projects_map, db_user=db_user, db_password=db_password, db_host=db_host, - db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl) + db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl, + db_tenant=db_tenant) def set_elastic(self, elastic): self.elastic = elastic diff --git a/grimoire_elk/enriched/phabricator.py b/grimoire_elk/enriched/phabricator.py index 2c33a0fe3..604cc22e2 100644 --- a/grimoire_elk/enriched/phabricator.py +++ b/grimoire_elk/enriched/phabricator.py @@ -77,10 +77,11 @@ class PhabricatorEnrich(Enrich): def __init__(self, db_sortinghat=None, json_projects_map=None, db_user='', db_password='', db_host='', db_path=None, - db_port=None, db_ssl=False, db_verify_ssl=True): + db_port=None, db_ssl=False, db_verify_ssl=True, db_tenant=None): super().__init__(db_sortinghat=db_sortinghat, json_projects_map=json_projects_map, db_user=db_user, db_password=db_password, db_host=db_host, - db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl) + db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl, + db_tenant=db_tenant) self.phab_ids_names = {} # To convert from phab ids to phab names diff --git a/grimoire_elk/enriched/remo.py b/grimoire_elk/enriched/remo.py index c76dbe2c2..3bbb9b728 100644 --- a/grimoire_elk/enriched/remo.py +++ b/grimoire_elk/enriched/remo.py @@ -60,10 +60,11 @@ class ReMoEnrich(Enrich): def __init__(self, db_sortinghat=None, json_projects_map=None, db_user='', db_password='', db_host='', db_path=None, - db_port=None, db_ssl=False, db_verify_ssl=True): + db_port=None, db_ssl=False, db_verify_ssl=True, db_tenant=None): super().__init__(db_sortinghat=db_sortinghat, json_projects_map=json_projects_map, db_user=db_user, db_password=db_password, db_host=db_host, - db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl) + db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl, + db_tenant=db_tenant) self.author = "user" # changes if we are generating events def get_field_author(self): diff --git a/grimoire_elk/enriched/weblate.py b/grimoire_elk/enriched/weblate.py index 91efd832a..ce65c3ba2 100644 --- a/grimoire_elk/enriched/weblate.py +++ b/grimoire_elk/enriched/weblate.py @@ -61,10 +61,11 @@ class WeblateEnrich(Enrich): def __init__(self, db_sortinghat=None, json_projects_map=None, db_user='', db_password='', db_host='', db_path=None, - db_port=None, db_ssl=False, db_verify_ssl=True): + db_port=None, db_ssl=False, db_verify_ssl=True, db_tenant=None): super().__init__(db_sortinghat=db_sortinghat, json_projects_map=json_projects_map, db_user=db_user, db_password=db_password, db_host=db_host, - db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl) + db_port=db_port, db_path=db_path, db_ssl=db_ssl, db_verify_ssl=db_verify_ssl, + db_tenant=db_tenant) self.studies = [] self.studies.append(self.enrich_demography) diff --git a/releases/unreleased/sortinghat-configuration.yml b/releases/unreleased/sortinghat-configuration.yml new file mode 100644 index 000000000..7be76f943 --- /dev/null +++ b/releases/unreleased/sortinghat-configuration.yml @@ -0,0 +1,8 @@ +--- +title: SortingHat configuration +category: changed +author: Jose Javier Merchante +issue: null +notes: | + When SortingHat's multi-tenancy is enabled, the tenant is + included in all clients during execution. diff --git a/tests/base.py b/tests/base.py index 1fbc6cc79..d7556088f 100644 --- a/tests/base.py +++ b/tests/base.py @@ -133,6 +133,7 @@ def setUpClass(cls): cls.db_path = cls.config.get('Database', 'path', fallback=None) cls.db_ssl = cls.config.getboolean('Database', 'ssl', fallback=False) cls.db_verify_ssl = cls.config.getboolean('Database', 'verify_ssl', fallback=True) + cls.db_tenant = cls.config.get('Database', 'tenant', fallback=None) def setUp(self): with open(os.path.join("data", self.connector + ".json")) as f: @@ -182,7 +183,8 @@ def _test_raw_to_enrich(self, sortinghat=False, projects=False, pair_programming db_port=self.db_port, db_path=self.db_path, db_ssl=self.db_ssl, - db_verify_ssl=self.db_verify_ssl) + db_verify_ssl=self.db_verify_ssl, + db_tenant=self.db_tenant) elif sortinghat and projects: self.enrich_backend = self.connectors[self.connector][2](json_projects_map=FILE_PROJECTS, db_sortinghat=DB_SORTINGHAT, @@ -192,7 +194,8 @@ def _test_raw_to_enrich(self, sortinghat=False, projects=False, pair_programming db_port=self.db_port, db_path=self.db_path, db_ssl=self.db_ssl, - db_verify_ssl=self.db_verify_ssl) + db_verify_ssl=self.db_verify_ssl, + db_tenant=self.db_tenant) elif not sortinghat and projects: self.enrich_backend = self.connectors[self.connector][2](json_projects_map=FILE_PROJECTS, @@ -202,7 +205,8 @@ def _test_raw_to_enrich(self, sortinghat=False, projects=False, pair_programming db_port=self.db_port, db_path=self.db_path, db_ssl=self.db_ssl, - db_verify_ssl=self.db_verify_ssl) + db_verify_ssl=self.db_verify_ssl, + db_tenant=self.db_tenant) if pair_programming: self.enrich_backend.pair_programming = pair_programming @@ -257,7 +261,8 @@ def _test_refresh_identities(self): db_port=self.db_port, db_path=self.db_path, db_ssl=self.db_ssl, - db_verify_ssl=self.db_verify_ssl) + db_verify_ssl=self.db_verify_ssl, + db_tenant=self.db_tenant) elastic_enrich = get_elastic(self.es_con, self.enrich_index, clean, self.enrich_backend) self.enrich_backend.set_elastic(elastic_enrich) self.enrich_backend.enrich_items(self.ocean_backend) @@ -285,7 +290,8 @@ def _test_study(self, test_study, projects_json_repo=None, projects_json=None, p db_port=self.db_port, db_path=self.db_path, db_ssl=self.db_ssl, - db_verify_ssl=self.db_verify_ssl) + db_verify_ssl=self.db_verify_ssl, + db_tenant=self.db_tenant) elastic_enrich = get_elastic(self.es_con, self.enrich_index, clean, self.enrich_backend) self.enrich_backend.set_elastic(elastic_enrich) @@ -339,7 +345,8 @@ def _test_raw_to_enrich_anonymized(self, sortinghat=False, projects=False): db_port=self.db_port, db_path=self.db_path, db_ssl=self.db_ssl, - db_verify_ssl=self.db_verify_ssl) + db_verify_ssl=self.db_verify_ssl, + db_tenant=self.db_tenant) elastic_enrich = get_elastic(self.es_con, self.enrich_index_anonymized, clean, self.enrich_backend, self.enrich_aliases) self.enrich_backend.set_elastic(elastic_enrich) diff --git a/tests/test_sortinghat_gelk.py b/tests/test_sortinghat_gelk.py index cae184133..bc71d363d 100644 --- a/tests/test_sortinghat_gelk.py +++ b/tests/test_sortinghat_gelk.py @@ -104,6 +104,7 @@ def setUp(self): db_path = config.get('Database', 'path', fallback=None) db_ssl = config.getboolean('Database', 'ssl', fallback=False) db_verify_ssl = config.getboolean('Database', 'verify_ssl', fallback=True) + db_tenant = config.get('Database', 'tenant', fallback=None) self.sh_db = SortingHatClient(host=db_host, port=db_port, @@ -111,7 +112,8 @@ def setUp(self): password=db_password, path=db_path, ssl=db_ssl, - verify_ssl=db_verify_ssl) + verify_ssl=db_verify_ssl, + tenant=db_tenant) self.sh_db.connect() # Clean database # Remove identities