From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-commits+bounces-1202287-garchives=archives.gentoo.org@lists.gentoo.org> Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 8472C138359 for <garchives@archives.gentoo.org>; Thu, 3 Sep 2020 00:43:03 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 79F88E088B; Thu, 3 Sep 2020 00:43:02 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 536C7E088B for <gentoo-commits@lists.gentoo.org>; Thu, 3 Sep 2020 00:43:02 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E6E99340ED2 for <gentoo-commits@lists.gentoo.org>; Thu, 3 Sep 2020 00:42:58 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 65F4B327 for <gentoo-commits@lists.gentoo.org>; Thu, 3 Sep 2020 00:42:57 +0000 (UTC) From: "Magnus Granberg" <zorry@gentoo.org> To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Magnus Granberg" <zorry@gentoo.org> Message-ID: <1599093624.f715a6953ed1e5f62a406029b62ca8d1000197fb.zorry@gentoo> Subject: [gentoo-commits] proj/tinderbox-cluster:master commit in: gosbs/conf/, gosbs/ X-VCS-Repository: proj/tinderbox-cluster X-VCS-Files: gosbs/conf/__init__.py gosbs/conf/minio.py gosbs/context.py X-VCS-Directories: gosbs/conf/ gosbs/ X-VCS-Committer: zorry X-VCS-Committer-Name: Magnus Granberg X-VCS-Revision: f715a6953ed1e5f62a406029b62ca8d1000197fb X-VCS-Branch: master Date: Thu, 3 Sep 2020 00:42:57 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: f02b63ea-c1b9-4451-a731-4028dc73becf X-Archives-Hash: 2c7ec82e9d1b4092c3ee69325245ff9f commit: f715a6953ed1e5f62a406029b62ca8d1000197fb Author: Magnus Granberg <zorry <AT> gentoo <DOT> org> AuthorDate: Thu Sep 3 00:40:24 2020 +0000 Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org> CommitDate: Thu Sep 3 00:40:24 2020 +0000 URL: https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=f715a695 Add Openstack connect and MinIO connect Signed-off-by: Magnus Granberg <zorry <AT> gentoo.org> gosbs/conf/__init__.py | 3 ++- gosbs/conf/minio.py | 42 ++++++++++++++++++++++++++++++++++++++++++ gosbs/context.py | 27 +++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 1 deletion(-) diff --git a/gosbs/conf/__init__.py b/gosbs/conf/__init__.py index d79e8a5..0589ca1 100644 --- a/gosbs/conf/__init__.py +++ b/gosbs/conf/__init__.py @@ -41,6 +41,7 @@ from gosbs.conf import database #from nova.conf import key_manager from gosbs.conf import keystone #from nova.conf import libvirt +from gosbs.conf import minio #from nova.conf import mks from gosbs.conf import netconf #from nova.conf import neutron @@ -88,7 +89,7 @@ database.register_opts(CONF) #glance.register_opts(CONF) #guestfs.register_opts(CONF) #hyperv.register_opts(CONF) -#mks.register_opts(CONF) +minio.register_opts(CONF) #imagecache.register_opts(CONF) #ironic.register_opts(CONF) #key_manager.register_opts(CONF) diff --git a/gosbs/conf/minio.py b/gosbs/conf/minio.py new file mode 100644 index 0000000..82524c0 --- /dev/null +++ b/gosbs/conf/minio.py @@ -0,0 +1,42 @@ +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from oslo_config import cfg + + +minio_group = cfg.OptGroup( + name='minio', + title='MinIO Options', + help='Configuration options for the MinIO service') + +minio_opts = [ + cfg.StrOpt('url', + default='', + help=''), + cfg.StrOpt('username', + default='', + help=''), + cfg.StrOpt('password', + secret=True, + default='True', + help=''), +] + + +def register_opts(conf): + conf.register_group(minio_group) + conf.register_opts(minio_opts, group=minio_group) + + +def list_opts(): + return {minio_group: minio_opts} diff --git a/gosbs/context.py b/gosbs/context.py index 11ef81a..bffda32 100644 --- a/gosbs/context.py +++ b/gosbs/context.py @@ -20,6 +20,7 @@ from contextlib import contextmanager import copy import warnings +from minio import Minio import eventlet.queue import eventlet.timeout @@ -29,6 +30,7 @@ from oslo_context import context from oslo_db.sqlalchemy import enginefacade from oslo_log import log as logging from oslo_utils import timeutils +from openstack import connection import six from gosbs import exception @@ -36,6 +38,9 @@ from gosbs.i18n import _ from gosbs import objects from gosbs import policy from gosbs import utils +import gosbs.conf + +CONF = gosbs.conf.CONF LOG = logging.getLogger(__name__) # TODO(melwitt): This cache should be cleared whenever WSGIService receives a @@ -558,3 +563,25 @@ def scatter_gather_all_cells(context, fn, *args, **kwargs): load_cells() return scatter_gather_cells(context, CELLS, CELL_TIMEOUT, fn, *args, **kwargs) + +def get_openstack_connect(): + openstack_conn = connection.Connection( + region_name = CONF.keystone.region_name, + auth=dict( + auth_url = CONF.keystone.auth_url, + username = CONF.keystone.username, + password = CONF.keystone.password, + project_id = CONF.keystone.project_id, + user_domain_id = CONF.keystone.user_domain_name), + gosbs_api_version = CONF.keystone.auth_version, + identity_interface= CONF.keystone.identity_interface) + return openstack_conn + +def get_minio_connect(): + minioclient = Minio( + CONF.minio.url, + access_key = CONF.minio.username, + secret_key = CONF.minio.password, + secure = True + ) + return minioclient