summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--inventory/byo/hosts.origin.example12
-rw-r--r--inventory/byo/hosts.ose.example10
-rw-r--r--pytest.ini1
-rw-r--r--roles/openshift_health_checker/openshift_checks/__init__.py3
-rw-r--r--roles/openshift_health_checker/test/conftest.py5
-rw-r--r--roles/openshift_health_checker/test/openshift_check_test.py40
-rw-r--r--roles/openshift_logging/files/generate-jks.sh2
7 files changed, 62 insertions, 11 deletions
diff --git a/inventory/byo/hosts.origin.example b/inventory/byo/hosts.origin.example
index 20764fb95..033ce8a82 100644
--- a/inventory/byo/hosts.origin.example
+++ b/inventory/byo/hosts.origin.example
@@ -494,6 +494,9 @@ openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true',
# your cloud platform use this.
#openshift_hosted_metrics_storage_kind=dynamic
#
+# Other Metrics Options -- Common items you may wish to reconfigure, for the complete
+# list of options please see roles/openshift_metrics/README.md
+#
# Override metricsPublicURL in the master config for cluster metrics
# Defaults to https://hawkular-metrics.{{openshift_master_default_subdomain}}/hawkular/metrics
# Currently, you may only alter the hostname portion of the url, alterting the
@@ -540,14 +543,13 @@ openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true',
#
# Configure loggingPublicURL in the master config for aggregate logging, defaults
# to kibana.{{ openshift_master_default_subdomain }}
-#openshift_master_logging_public_url=kibana.example.com
+#openshift_hosted_logging_hostname=logging.apps.example.com
# Configure the number of elastic search nodes, unless you're using dynamic provisioning
# this value must be 1
#openshift_hosted_logging_elasticsearch_cluster_size=1
-#openshift_hosted_logging_hostname=logging.apps.example.com
-# Configure the prefix and version for the deployer image
-#openshift_hosted_logging_deployer_prefix=registry.example.com:8888/openshift3/
-#openshift_hosted_logging_deployer_version=3.3.0
+# Configure the prefix and version for the component images
+#openshift_hosted_logging_deployer_prefix=docker.io/openshift/origin-
+#openshift_hosted_logging_deployer_version=1.5.0
# Configure the multi-tenant SDN plugin (default is 'redhat/openshift-ovs-subnet')
# os_sdn_network_plugin_name='redhat/openshift-ovs-multitenant'
diff --git a/inventory/byo/hosts.ose.example b/inventory/byo/hosts.ose.example
index 3b9861a1d..49bcb7405 100644
--- a/inventory/byo/hosts.ose.example
+++ b/inventory/byo/hosts.ose.example
@@ -495,6 +495,9 @@ openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true',
# your cloud platform use this.
#openshift_hosted_metrics_storage_kind=dynamic
#
+# Other Metrics Options -- Common items you may wish to reconfigure, for the complete
+# list of options please see roles/openshift_metrics/README.md
+#
# Override metricsPublicURL in the master config for cluster metrics
# Defaults to https://hawkular-metrics.{{openshift_master_default_subdomain}}/hawkular/metrics
# Currently, you may only alter the hostname portion of the url, alterting the
@@ -541,14 +544,13 @@ openshift_master_identity_providers=[{'name': 'htpasswd_auth', 'login': 'true',
#
# Configure loggingPublicURL in the master config for aggregate logging, defaults
# to kibana.{{ openshift_master_default_subdomain }}
-#openshift_master_logging_public_url=kibana.example.com
+#openshift_hosted_logging_hostname=logging.apps.example.com
# Configure the number of elastic search nodes, unless you're using dynamic provisioning
# this value must be 1
#openshift_hosted_logging_elasticsearch_cluster_size=1
-#openshift_hosted_logging_hostname=logging.apps.example.com
-# Configure the prefix and version for the deployer image
+# Configure the prefix and version for the component images
#openshift_hosted_logging_deployer_prefix=registry.example.com:8888/openshift3/
-#openshift_hosted_logging_deployer_version=3.3.0
+#openshift_hosted_logging_deployer_version=3.5.0
# Configure the multi-tenant SDN plugin (default is 'redhat/openshift-ovs-subnet')
# os_sdn_network_plugin_name='redhat/openshift-ovs-multitenant'
diff --git a/pytest.ini b/pytest.ini
index 502fd1f46..1b0d19bb2 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -9,6 +9,7 @@ python_files =
# is Python unittest's default, while pytest discovers both "test_*.py" and
# "*_test.py" by default.
test_*.py
+ *_test.py
*_tests.py
addopts =
--cov=.
diff --git a/roles/openshift_health_checker/openshift_checks/__init__.py b/roles/openshift_health_checker/openshift_checks/__init__.py
index 8433923ed..f66d19fbf 100644
--- a/roles/openshift_health_checker/openshift_checks/__init__.py
+++ b/roles/openshift_health_checker/openshift_checks/__init__.py
@@ -66,7 +66,8 @@ def get_var(task_vars, *keys, **kwargs):
Ansible task_vars structures are Python dicts, often mapping strings to
other dicts. This helper makes it easier to get a nested value, raising
- OpenShiftCheckException when a key is not found.
+ OpenShiftCheckException when a key is not found or returning a default value
+ provided as a keyword argument.
"""
try:
value = reduce(operator.getitem, keys, task_vars)
diff --git a/roles/openshift_health_checker/test/conftest.py b/roles/openshift_health_checker/test/conftest.py
new file mode 100644
index 000000000..bf717ae85
--- /dev/null
+++ b/roles/openshift_health_checker/test/conftest.py
@@ -0,0 +1,5 @@
+import os
+import sys
+
+# extend sys.path so that tests can import openshift_checks
+sys.path.insert(1, os.path.dirname(os.path.dirname(__file__)))
diff --git a/roles/openshift_health_checker/test/openshift_check_test.py b/roles/openshift_health_checker/test/openshift_check_test.py
new file mode 100644
index 000000000..c4c8cd1c2
--- /dev/null
+++ b/roles/openshift_health_checker/test/openshift_check_test.py
@@ -0,0 +1,40 @@
+import pytest
+
+from openshift_checks import get_var, OpenShiftCheckException
+
+
+# Fixtures
+
+
+@pytest.fixture()
+def task_vars():
+ return dict(foo=42, bar=dict(baz="openshift"))
+
+
+@pytest.fixture(params=[
+ ("notfound",),
+ ("multiple", "keys", "not", "in", "task_vars"),
+])
+def missing_keys(request):
+ return request.param
+
+
+# Tests
+
+
+@pytest.mark.parametrize("keys,expected", [
+ (("foo",), 42),
+ (("bar", "baz"), "openshift"),
+])
+def test_get_var_ok(task_vars, keys, expected):
+ assert get_var(task_vars, *keys) == expected
+
+
+def test_get_var_error(task_vars, missing_keys):
+ with pytest.raises(OpenShiftCheckException):
+ get_var(task_vars, *missing_keys)
+
+
+def test_get_var_default(task_vars, missing_keys):
+ default = object()
+ assert get_var(task_vars, *missing_keys, default=default) == default
diff --git a/roles/openshift_logging/files/generate-jks.sh b/roles/openshift_logging/files/generate-jks.sh
index 9fe557f83..b5ba7f9d1 100644
--- a/roles/openshift_logging/files/generate-jks.sh
+++ b/roles/openshift_logging/files/generate-jks.sh
@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/bash
set -ex
function usage() {