Fix ceph-dashboard SAML tests
This patchset fixes a couple of issues with ceph-dashboard's SAML support, mostly with outdated bundle configuration. Change-Id: I6c3f8ffdf10d42f9a5280d7e429a7ae64612a139 func-test-pr: https://github.com/openstack-charmers/zaza-openstack-tests/pull/762
This commit is contained in:
		
							
								
								
									
										16
									
								
								osci.yaml
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								osci.yaml
									
									
									
									
									
								
							@@ -1,21 +1,13 @@
 | 
			
		||||
- project:
 | 
			
		||||
    templates:
 | 
			
		||||
      - charm-unit-jobs-py38
 | 
			
		||||
      - charm-unit-jobs-py39
 | 
			
		||||
      - charm-unit-jobs-py310
 | 
			
		||||
    check:
 | 
			
		||||
      jobs:
 | 
			
		||||
      - focal-octopus
 | 
			
		||||
      - focal-yoga
 | 
			
		||||
      - jammy-yoga:
 | 
			
		||||
          voting: false
 | 
			
		||||
    vars:
 | 
			
		||||
      needs_charm_build: true
 | 
			
		||||
      charm_build_name: ceph-dashboard
 | 
			
		||||
      build_type: charmcraft
 | 
			
		||||
- job:
 | 
			
		||||
    name: focal-octopus
 | 
			
		||||
    parent: func-target
 | 
			
		||||
    dependencies:
 | 
			
		||||
      - charm-build
 | 
			
		||||
      - osci-lint
 | 
			
		||||
      - tox-py38
 | 
			
		||||
      - tox-py39
 | 
			
		||||
    vars:
 | 
			
		||||
      tox_extra_args: focal
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										26
									
								
								src/charm.py
									
									
									
									
									
								
							
							
						
						
									
										26
									
								
								src/charm.py
									
									
									
									
									
								
							@@ -14,7 +14,6 @@ from ops.framework import StoredState
 | 
			
		||||
from ops.main import main
 | 
			
		||||
from ops.model import ActiveStatus, BlockedStatus, StatusBase
 | 
			
		||||
from ops.charm import ActionEvent
 | 
			
		||||
from ops_openstack.core import charm_class, get_charm_class_for_release
 | 
			
		||||
from typing import List, Union, Tuple
 | 
			
		||||
 | 
			
		||||
import base64
 | 
			
		||||
@@ -47,7 +46,7 @@ class CephDashboardCharm(ops_openstack.core.OSBaseCharm):
 | 
			
		||||
    """Ceph Dashboard charm."""
 | 
			
		||||
 | 
			
		||||
    _stored = StoredState()
 | 
			
		||||
    PACKAGES = ['ceph-mgr-dashboard']
 | 
			
		||||
    PACKAGES = ['ceph-mgr-dashboard', 'python3-onelogin-saml2']
 | 
			
		||||
    CEPH_CONFIG_PATH = Path('/etc/ceph')
 | 
			
		||||
    TLS_KEY_PATH = CEPH_CONFIG_PATH / 'ceph-dashboard.key'
 | 
			
		||||
    TLS_PUB_KEY_PATH = CEPH_CONFIG_PATH / 'ceph-dashboard-pub.key'
 | 
			
		||||
@@ -426,7 +425,6 @@ class CephDashboardCharm(ops_openstack.core.OSBaseCharm):
 | 
			
		||||
            ceph_utils.mgr_enable_dashboard()
 | 
			
		||||
        self._apply_ceph_config_from_charm_config()
 | 
			
		||||
        self._configure_tls()
 | 
			
		||||
        self._configure_saml()
 | 
			
		||||
        ceph_utils.mgr_config_set(
 | 
			
		||||
            'mgr/dashboard/{hostname}/server_addr'.format(
 | 
			
		||||
                hostname=socket.gethostname()),
 | 
			
		||||
@@ -452,6 +450,8 @@ class CephDashboardCharm(ops_openstack.core.OSBaseCharm):
 | 
			
		||||
                self._run_cmd([
 | 
			
		||||
                    'ceph', 'dashboard', 'set-prometheus-api-host',
 | 
			
		||||
                    prometheus_ep])
 | 
			
		||||
            self._configure_saml()
 | 
			
		||||
 | 
			
		||||
        self._register_dashboards()
 | 
			
		||||
        self._manage_radosgw()
 | 
			
		||||
        self._manage_iscsigw()
 | 
			
		||||
@@ -571,9 +571,6 @@ class CephDashboardCharm(ops_openstack.core.OSBaseCharm):
 | 
			
		||||
        self.kick_dashboard()
 | 
			
		||||
 | 
			
		||||
    def _configure_saml(self) -> None:
 | 
			
		||||
        if 'python3-onelogin-saml2' not in self.PACKAGES:
 | 
			
		||||
            return
 | 
			
		||||
 | 
			
		||||
        base_url = self.config.get('saml-base-url')
 | 
			
		||||
        idp_metadata = self.config.get('saml-idp-metadata')
 | 
			
		||||
        if not base_url or not idp_metadata:
 | 
			
		||||
@@ -626,20 +623,5 @@ class CephDashboardCharm(ops_openstack.core.OSBaseCharm):
 | 
			
		||||
            event.fail(exc.output)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@charm_class
 | 
			
		||||
class CephDashboardCharmOctopus(CephDashboardCharm):
 | 
			
		||||
 | 
			
		||||
    _stored = StoredState()
 | 
			
		||||
    release = 'octopus'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@charm_class
 | 
			
		||||
class CephDashboardCharmQuincy(CephDashboardCharm):
 | 
			
		||||
 | 
			
		||||
    _stored = StoredState()
 | 
			
		||||
    PACKAGES = ['ceph-mgr-dashboard', 'python3-onelogin-saml2']
 | 
			
		||||
    release = 'quincy'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if __name__ == "__main__":
 | 
			
		||||
    main(get_charm_class_for_release())
 | 
			
		||||
    main(CephDashboardCharm)
 | 
			
		||||
 
 | 
			
		||||
@@ -37,9 +37,8 @@ applications:
 | 
			
		||||
    charm: ../../ceph-dashboard.charm
 | 
			
		||||
    options:
 | 
			
		||||
      public-hostname: 'ceph-dashboard.zaza.local'
 | 
			
		||||
      source: *openstack-origin
 | 
			
		||||
  prometheus:
 | 
			
		||||
    charm: cs:prometheus2
 | 
			
		||||
    charm: ch:prometheus2
 | 
			
		||||
    num_units: 1
 | 
			
		||||
  grafana:
 | 
			
		||||
    # SSL and allow_embedding are not released into cs:grafana yet, due 
 | 
			
		||||
@@ -57,7 +56,7 @@ applications:
 | 
			
		||||
    options:
 | 
			
		||||
       hostname: "{host}"
 | 
			
		||||
  prometheus-alertmanager:
 | 
			
		||||
    charm: cs:prometheus-alertmanager
 | 
			
		||||
    charm: ch:prometheus-alertmanager
 | 
			
		||||
    num_units: 1
 | 
			
		||||
  ceph-radosgw:
 | 
			
		||||
    charm: ch:ceph-radosgw
 | 
			
		||||
 
 | 
			
		||||
@@ -32,8 +32,9 @@ applications:
 | 
			
		||||
    options:
 | 
			
		||||
      public-hostname: 'ceph-dashboard.zaza.local'
 | 
			
		||||
  prometheus:
 | 
			
		||||
    charm: cs:prometheus2
 | 
			
		||||
    charm: ch:prometheus2
 | 
			
		||||
    num_units: 1
 | 
			
		||||
    series: focal
 | 
			
		||||
  grafana:
 | 
			
		||||
    # SSL and allow_embedding are not released into cs:grafana yet, due 
 | 
			
		||||
    # Octrober 2021
 | 
			
		||||
@@ -44,14 +45,15 @@ applications:
 | 
			
		||||
      install_plugins: https://storage.googleapis.com/plugins-community/vonage-status-panel/release/1.0.11/vonage-status-panel-1.0.11.zip,https://storage.googleapis.com/plugins-community/grafana-piechart-panel/release/1.6.2/grafana-piechart-panel-1.6.2.zip
 | 
			
		||||
      install_method: snap
 | 
			
		||||
      allow_embedding: True
 | 
			
		||||
  telegraf:
 | 
			
		||||
    charm: telegraf
 | 
			
		||||
    channel: stable
 | 
			
		||||
    options:
 | 
			
		||||
       hostname: "{host}"
 | 
			
		||||
  #telegraf:
 | 
			
		||||
  #  charm: telegraf
 | 
			
		||||
  #  channel: stable
 | 
			
		||||
  #  options:
 | 
			
		||||
  #    hostname: "{host}"
 | 
			
		||||
  prometheus-alertmanager:
 | 
			
		||||
    charm: cs:prometheus-alertmanager
 | 
			
		||||
    charm: ch:prometheus-alertmanager
 | 
			
		||||
    num_units: 1
 | 
			
		||||
    series: focal
 | 
			
		||||
  ceph-radosgw:
 | 
			
		||||
    charm: ch:ceph-radosgw
 | 
			
		||||
    num_units: 3
 | 
			
		||||
@@ -83,14 +85,14 @@ relations:
 | 
			
		||||
    - 'prometheus:grafana-source'
 | 
			
		||||
  - - 'grafana:certificates'
 | 
			
		||||
    - 'vault:certificates'
 | 
			
		||||
  - - 'ceph-osd:juju-info'
 | 
			
		||||
    - 'telegraf:juju-info'
 | 
			
		||||
  - - 'ceph-mon:juju-info'
 | 
			
		||||
    - 'telegraf:juju-info'
 | 
			
		||||
  - - 'telegraf:prometheus-client'
 | 
			
		||||
    - 'prometheus:target'
 | 
			
		||||
  - - 'telegraf:dashboards'
 | 
			
		||||
    - 'grafana:dashboards'
 | 
			
		||||
  #- - 'ceph-osd:juju-info'
 | 
			
		||||
  #- 'telegraf:juju-info'
 | 
			
		||||
  #- - 'ceph-mon:juju-info'
 | 
			
		||||
  #  - 'telegraf:juju-info'
 | 
			
		||||
  #- - 'telegraf:prometheus-client'
 | 
			
		||||
  #  - 'prometheus:target'
 | 
			
		||||
  #- - 'telegraf:dashboards'
 | 
			
		||||
  #  - 'grafana:dashboards'
 | 
			
		||||
  - - 'ceph-dashboard:grafana-dashboard'
 | 
			
		||||
    - 'grafana:dashboards'
 | 
			
		||||
  - - 'ceph-dashboard:alertmanager-service'
 | 
			
		||||
		Reference in New Issue
	
	Block a user