summaryrefslogtreecommitdiffstats
path: root/src/test/rgw/bucket_notification/__init__.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
commite6918187568dbd01842d8d1d2c808ce16a894239 (patch)
tree64f88b554b444a49f656b6c656111a145cbbaa28 /src/test/rgw/bucket_notification/__init__.py
parentInitial commit. (diff)
downloadceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz
ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/rgw/bucket_notification/__init__.py')
-rw-r--r--src/test/rgw/bucket_notification/__init__.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/test/rgw/bucket_notification/__init__.py b/src/test/rgw/bucket_notification/__init__.py
new file mode 100644
index 000000000..6785fce92
--- /dev/null
+++ b/src/test/rgw/bucket_notification/__init__.py
@@ -0,0 +1,48 @@
+import configparser
+import os
+
+def setup():
+ cfg = configparser.RawConfigParser()
+ try:
+ path = os.environ['BNTESTS_CONF']
+ except KeyError:
+ raise RuntimeError(
+ 'To run tests, point environment '
+ + 'variable BNTESTS_CONF to a config file.',
+ )
+ cfg.read(path)
+
+ if not cfg.defaults():
+ raise RuntimeError('Your config file is missing the DEFAULT section!')
+ if not cfg.has_section("s3 main"):
+ raise RuntimeError('Your config file is missing the "s3 main" section!')
+
+ defaults = cfg.defaults()
+
+ global default_host
+ default_host = defaults.get("host")
+
+ global default_port
+ default_port = int(defaults.get("port"))
+
+ global main_access_key
+ main_access_key = cfg.get('s3 main',"access_key")
+
+ global main_secret_key
+ main_secret_key = cfg.get('s3 main',"secret_key")
+
+def get_config_host():
+ global default_host
+ return default_host
+
+def get_config_port():
+ global default_port
+ return default_port
+
+def get_access_key():
+ global main_access_key
+ return main_access_key
+
+def get_secret_key():
+ global main_secret_key
+ return main_secret_key