gui-x: 0
gui-y: 0
nbi:
- charm: "cs:~charmed-osm/nbi-5"
+ charm: "cs:~charmed-osm/nbi-6"
scale: 3
series: kubernetes
options:
gui-x: 0
gui-y: -250
ro:
- charm: "cs:~charmed-osm/ro-0"
+ charm: "cs:~charmed-osm/ro-1"
scale: 3
series: kubernetes
options:
gui-x: -300
gui-y: 250
ng-ui:
- charm: "cs:~charmed-osm/ng-ui-16"
+ charm: "cs:~charmed-osm/ng-ui-17"
scale: 3
series: kubernetes
annotations:
gui-x: 600
gui-y: 0
lcm:
- charm: "cs:~charmed-osm/lcm-0"
+ charm: "cs:~charmed-osm/lcm-2"
scale: 3
series: kubernetes
options:
gui-x: -300
gui-y: 0
mon:
- charm: "cs:~charmed-osm/mon-1"
+ charm: "cs:~charmed-osm/mon-2"
scale: 1
series: kubernetes
options:
gui-x: 300
gui-y: 0
pol:
- charm: "cs:~charmed-osm/pol-0"
+ charm: "cs:~charmed-osm/pol-1"
scale: 3
series: kubernetes
options:
gui-x: -300
gui-y: 500
pla:
- charm: "cs:~charmed-osm/pla-6"
+ charm: "cs:~charmed-osm/pla-7"
scale: 3
series: kubernetes
options:
gui-x: 600
gui-y: -250
prometheus:
- charm: "cs:~charmed-osm/prometheus-0"
+ charm: "cs:~charmed-osm/prometheus-1"
scale: 1
series: kubernetes
storage:
gui-x: 300
gui-y: 250
grafana:
- charm: "cs:~charmed-osm/grafana-0"
+ charm: "cs:~charmed-osm/grafana-1"
scale: 3
series: kubernetes
annotations:
gui-x: 300
gui-y: 500
keystone:
- charm: "cs:~charmed-osm/keystone-4"
+ charm: "cs:~charmed-osm/keystone-5"
scale: 1
series: kubernetes
annotations:
gui-x: 0
gui-y: 0
nbi:
- charm: "cs:~charmed-osm/nbi-5"
+ charm: "cs:~charmed-osm/nbi-6"
scale: 1
series: kubernetes
options:
gui-x: 0
gui-y: -250
ro:
- charm: "cs:~charmed-osm/ro-0"
+ charm: "cs:~charmed-osm/ro-1"
scale: 1
series: kubernetes
options:
gui-x: -300
gui-y: 250
ng-ui:
- charm: "cs:~charmed-osm/ng-ui-16"
+ charm: "cs:~charmed-osm/ng-ui-17"
scale: 1
series: kubernetes
annotations:
gui-x: 600
gui-y: 0
lcm:
- charm: "cs:~charmed-osm/lcm-0"
+ charm: "cs:~charmed-osm/lcm-2"
scale: 1
series: kubernetes
options:
gui-x: -300
gui-y: 0
mon:
- charm: "cs:~charmed-osm/mon-1"
+ charm: "cs:~charmed-osm/mon-2"
scale: 1
series: kubernetes
options:
gui-x: 300
gui-y: 0
pol:
- charm: "cs:~charmed-osm/pol-0"
+ charm: "cs:~charmed-osm/pol-1"
scale: 1
series: kubernetes
options:
gui-x: -300
gui-y: 500
pla:
- charm: "cs:~charmed-osm/pla-6"
+ charm: "cs:~charmed-osm/pla-7"
scale: 1
series: kubernetes
options:
gui-x: 600
gui-y: -250
prometheus:
- charm: "cs:~charmed-osm/prometheus-0"
+ charm: "cs:~charmed-osm/prometheus-1"
scale: 1
series: kubernetes
storage:
gui-x: 300
gui-y: 250
grafana:
- charm: "cs:~charmed-osm/grafana-0"
+ charm: "cs:~charmed-osm/grafana-1"
scale: 1
series: kubernetes
annotations:
gui-x: 300
gui-y: 500
keystone:
- charm: "cs:~charmed-osm/keystone-4"
+ charm: "cs:~charmed-osm/keystone-5"
scale: 1
series: kubernetes
annotations:
venv
.vscode
build
-prometheus.charm
+*.charm
.coverage
+coverage.xml
+.gitignore
.stestr
cover
+release
+tests/
+requirements*
+tox.ini
#
# To get in touch with the maintainers, please contact:
# osm-charmers@lists.launchpad.net
-##
--r requirements.txt
-coverage
-stestr
-mock
-black
-yamllint
-flake8
-safety
-requests-mock
-asynctest
-nose2
\ No newline at end of file
+mock==4.0.3
# pylint: disable=E0213
-import logging
-from typing import Optional, NoReturn
from ipaddress import ip_network
+import logging
+from pathlib import Path
+from string import Template
+from typing import NoReturn, Optional
+from urllib.parse import urlparse
from ops.main import main
-
from opslib.osm.charm import CharmedOsmBase, RelationsMissing
-
+from opslib.osm.interfaces.prometheus import PrometheusClient
from opslib.osm.pod import (
- IngressResourceV3Builder,
- FilesV3Builder,
ContainerV3Builder,
+ FilesV3Builder,
+ IngressResourceV3Builder,
PodSpecV3Builder,
)
+from opslib.osm.validator import ModelValidator, validator
-from opslib.osm.validator import (
- ModelValidator,
- validator,
-)
-
-from opslib.osm.interfaces.prometheus import PrometheusClient
-
-from urllib.parse import urlparse
-from string import Template
-from pathlib import Path
-
logger = logging.getLogger(__name__)
PORT = 3000
super().__init__(*args, oci_image="image")
self.prometheus_client = PrometheusClient(self, "prometheus")
- self.framework.observe(self.on["prometheus"].relation_changed, self.configure_pod)
- self.framework.observe(self.on["prometheus"].relation_broken, self.configure_pod)
+ self.framework.observe(
+ self.on["prometheus"].relation_changed, self.configure_pod
+ )
+ self.framework.observe(
+ self.on["prometheus"].relation_broken, self.configure_pod
+ )
def _build_dashboard_files(self, config: ConfigModel):
files_builder = FilesV3Builder()
"""Init mocking for unit tests."""
import sys
+
+
import mock
sys.path.append("src")
import sys
from typing import NoReturn
import unittest
-from ops.model import ActiveStatus, BlockedStatus
-from ops.testing import Harness
from charm import GrafanaCharm
+from ops.model import ActiveStatus, BlockedStatus
+from ops.testing import Harness
class TestCharm(unittest.TestCase):
#######################################################################################
[tox]
-envlist = flake8, cover, pylint, safety, yamllint
-skipsdist = True
+envlist = black, cover, flake8, pylint, yamllint, safety
+skipsdist = true
+
+[tox:jenkins]
+toxworkdir = /tmp/.tox
[testenv]
basepython = python3.8
-setenv =
- VIRTUAL_ENV={envdir}
- PYTHONHASHSEED=0
- PYTHONPATH = {toxinidir}/src
+setenv = VIRTUAL_ENV={envdir}
+ PYTHONDONTWRITEBYTECODE = 1
deps = -r{toxinidir}/requirements.txt
+
+#######################################################################################
+[testenv:black]
+deps = black
+commands =
+ black --check --diff src/ tests/
+
+
#######################################################################################
[testenv:cover]
deps = {[testenv]deps}
-r{toxinidir}/requirements-test.txt
+ coverage
+ nose2
commands =
sh -c 'rm -f nosetests.xml'
coverage erase
coverage xml -o coverage.xml --omit=*tests*
whitelist_externals = sh
-#######################################################################################
-[testenv:safety]
-setenv =
- LC_ALL=C.UTF-8
- LANG=C.UTF-8
-deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
-commands =
- - safety check --full-report
#######################################################################################
[testenv:flake8]
-deps = flake8
+deps = flake8
+ flake8-import-order
commands =
- flake8 src/ tests/
+ flake8 src/ tests/ --exclude=*pod_spec*
+
#######################################################################################
[testenv:pylint]
-r{toxinidir}/requirements-test.txt
pylint
commands =
- pylint -E src
+ pylint -E src/ tests/
+
#######################################################################################
-[testenv:black]
+[testenv:safety]
+setenv =
+ LC_ALL=C.UTF-8
+ LANG=C.UTF-8
deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
- black
-commands = black --check --diff . --exclude "build/|.tox/|mod/|lib/"
+ safety
+commands =
+ - safety check --full-report
+
#######################################################################################
[testenv:yamllint]
#######################################################################################
[testenv:build]
passenv=HTTP_PROXY HTTPS_PROXY NO_PROXY
-deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
- charmcraft
+deps = charmcraft
whitelist_externals =
charmcraft
cp
max-line-length = 120
show-source = True
builtins = _
-
+max-complexity = 10
+import-order-style = google
venv
.vscode
build
-prometheus.charm
+*.charm
.coverage
+coverage.xml
+.gitignore
.stestr
cover
+release
+tests/
+requirements*
+tox.ini
#
# To get in touch with the maintainers, please contact:
# osm-charmers@lists.launchpad.net
-##
--r requirements.txt
-coverage
-stestr
-mock
-black
-yamllint
-flake8
-safety
-requests-mock
-asynctest
-nose2
\ No newline at end of file
+mock==4.0.3
# pylint: disable=E0213
-import json
-import logging
-from cryptography.fernet import Fernet
from datetime import datetime
-from typing import Optional, NoReturn, List, Tuple
from ipaddress import ip_network
+import json
+import logging
+from typing import List, NoReturn, Optional, Tuple
from urllib.parse import urlparse
+from cryptography.fernet import Fernet
from ops.main import main
-
from opslib.osm.charm import CharmedOsmBase, RelationsMissing
-
+from opslib.osm.interfaces.keystone import KeystoneServer
+from opslib.osm.interfaces.mysql import MysqlClient
from opslib.osm.pod import (
ContainerV3Builder,
- PodSpecV3Builder,
FilesV3Builder,
IngressResourceV3Builder,
+ PodSpecV3Builder,
)
-
-
-from opslib.osm.validator import (
- ModelValidator,
- validator,
-)
-
-from opslib.osm.interfaces.mysql import MysqlClient
-from opslib.osm.interfaces.keystone import KeystoneServer
+from opslib.osm.validator import ModelValidator, validator
logger = logging.getLogger(__name__)
"""Init mocking for unit tests."""
import sys
+
+
import mock
sys.path.append("src")
import sys
from typing import NoReturn
import unittest
-from ops.model import ActiveStatus, BlockedStatus
-from ops.testing import Harness
+
from charm import KeystoneCharm
+from ops.model import ActiveStatus, BlockedStatus
+from ops.testing import Harness
class TestCharm(unittest.TestCase):
#######################################################################################
[tox]
-envlist = flake8, cover, pylint, safety, yamllint
-skipsdist = True
+envlist = black, cover, flake8, pylint, yamllint, safety
+skipsdist = true
+
+[tox:jenkins]
+toxworkdir = /tmp/.tox
[testenv]
basepython = python3.8
-setenv =
- VIRTUAL_ENV={envdir}
- PYTHONHASHSEED=0
- PYTHONPATH = {toxinidir}/src
+setenv = VIRTUAL_ENV={envdir}
+ PYTHONDONTWRITEBYTECODE = 1
deps = -r{toxinidir}/requirements.txt
+
+#######################################################################################
+[testenv:black]
+deps = black
+commands =
+ black --check --diff src/ tests/
+
+
#######################################################################################
[testenv:cover]
deps = {[testenv]deps}
-r{toxinidir}/requirements-test.txt
+ coverage
+ nose2
commands =
sh -c 'rm -f nosetests.xml'
coverage erase
coverage xml -o coverage.xml --omit=*tests*
whitelist_externals = sh
-#######################################################################################
-[testenv:safety]
-setenv =
- LC_ALL=C.UTF-8
- LANG=C.UTF-8
-deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
-commands =
- - safety check --full-report
#######################################################################################
[testenv:flake8]
-deps = flake8
+deps = flake8
+ flake8-import-order
commands =
flake8 src/ tests/
+
#######################################################################################
[testenv:pylint]
deps = {[testenv]deps}
-r{toxinidir}/requirements-test.txt
pylint
commands =
- pylint -E src
+ pylint -E src/ tests/
+
#######################################################################################
-[testenv:black]
+[testenv:safety]
+setenv =
+ LC_ALL=C.UTF-8
+ LANG=C.UTF-8
deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
- black
-commands = black --check --diff . --exclude "build/|.tox/|mod/|lib/"
+ safety
+commands =
+ - safety check --full-report
+
#######################################################################################
[testenv:yamllint]
#######################################################################################
[testenv:build]
passenv=HTTP_PROXY HTTPS_PROXY NO_PROXY
-deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
- charmcraft
+deps = charmcraft
whitelist_externals =
charmcraft
cp
max-line-length = 120
show-source = True
builtins = _
-
+; max-complexity = 10
+import-order-style = google
venv
.vscode
build
-prometheus.charm
+*.charm
.coverage
+coverage.xml
+.gitignore
.stestr
cover
+release
+tests/
+requirements*
+tox.ini
type: string
description: "The VCA user name."
default: "admin"
- vca_password:
+ vca_secret:
type: string
- description: "The VCA user password."
+ description: "The VCA user secret."
default: "secret"
vca_pubkey:
type: string
description: "Log Level"
type: string
default: "INFO"
+ vca_model_config_agent_metadata_url:
+ description: The URL of the private stream.
+ type: string
+ vca_model_config_agent_stream:
+ description: |
+ The stream to use for deploy/upgrades of agents.
+ See additional info below.
+ type: string
+ vca_model_config_apt_ftp_proxy:
+ description: The APT FTP proxy for the model.
+ type: string
+ vca_model_config_apt_http_proxy:
+ description: The APT HTTP proxy for the model.
+ type: string
+ vca_model_config_apt_https_proxy:
+ description: The APT HTTPS proxy for the model.
+ type: string
+ vca_model_config_apt_mirror:
+ description: The APT mirror for the model.
+ type: string
+ vca_model_config_apt_no_proxy:
+ description: The APT no proxy for the model.
+ type: string
+ vca_model_config_automatically_retry_hooks:
+ description: Set the policy on retying failed hooks.
+ type: boolean
+ vca_model_config_backup_dir:
+ description: Backup directory
+ type: string
+ vca_model_config_cloudinit_userdata:
+ description: Cloudinit userdata
+ type: string
+ vca_model_config_container_image_metadata_url:
+ description: |
+ Corresponds to 'image-metadata-url' (see below) for cloud-hosted
+ KVM guests or LXD containers. Not needed for the localhost cloud.
+ type: string
+ vca_model_config_container_image_stream:
+ description: |
+ Corresponds to 'image-stream' (see below) for cloud-hosted KVM
+ guests or LXD containers. Not needed for the localhost cloud.
+ type: string
+ vca_model_config_container_inherit_properties:
+ description: |
+ Set parameters to be inherited from a machine toits hosted
+ containers (KVM or LXD).
+ type: string
+ vca_model_config_container_networking_method:
+ description: |
+ The FAN networking mode to use. Default values can be provider-specific.
+ type: string
+ vca_model_config_default_series:
+ description: The default series of Ubuntu to use for deploying charms.
+ type: string
+ vca_model_config_default_space:
+ description: |
+ The space used as the default binding when deploying charms.
+ Will be "alpha" by default.
+ type: string
+ vca_model_config_development:
+ description: Set whether the model is in development mode.
+ type: boolean
+ vca_model_config_disable_network_management:
+ description: |
+ Set whether to give network control to the provider instead
+ of Juju controlling configuration.
+ type: boolean
+ vca_model_config_egress_subnets:
+ description: Egress subnets
+ type: string
+ vca_model_config_enable_os_refresh_update:
+ description: |
+ Set whether newly provisioned instances should run their
+ respective OS's update capability.
+ type: boolean
+ vca_model_config_enable_os_upgrade:
+ description: |
+ Set whether newly provisioned instances should run their
+ respective OS's upgrade capability.
+ type: boolean
+ vca_model_config_fan_config:
+ description: |
+ The FAN overlay and underlay networks in
+ CIDR notation (space-separated).
+ type: string
+ vca_model_config_firewall_mode:
+ description: The mode to use for network firewalling.
+ type: string
+ vca_model_config_ftp_proxy:
+ description: |
+ The FTP proxy value to configure on instances,
+ in the FTP_PROXY environment variable.
+ type: string
+ vca_model_config_http_proxy:
+ description: |
+ The HTTP proxy value to configure on instances,
+ in the HTTP_PROXY environment variable.
+ type: string
+ vca_model_config_https_proxy:
+ description: |
+ The HTTPS proxy value to configure on instances,
+ in the HTTPS_PROXY environment variable.
+ type: string
+ vca_model_config_ignore_machine_addresses:
+ description: |
+ When true, the machine worker will not look up
+ or discover any machine addresses.
+ type: boolean
+ vca_model_config_image_metadata_url:
+ description: |
+ The URL at which the metadata used to locate
+ OS image ids is located.
+ type: string
+ vca_model_config_image_stream:
+ description: |
+ The simplestreams stream used to identify which image
+ ids to search when starting an instance.
+ type: string
+ vca_model_config_juju_ftp_proxy:
+ description: The charm-centric FTP proxy value.
+ type: string
+ vca_model_config_juju_http_proxy:
+ description: The charm-centric HTTP proxy value.
+ type: string
+ vca_model_config_juju_https_proxy:
+ description: The charm-centric HTTPS proxy value.
+ type: string
+ vca_model_config_juju_no_proxy:
+ description: The charm-centric no-proxy value.
+ type: string
+ vca_model_config_logforward_enabled:
+ description: Set whether the log forward function is enabled.
+ type: boolean
+ vca_model_config_logging_config:
+ description: |
+ The configuration string to use when configuring Juju agent logging
+ type: string
+ vca_model_config_lxd_snap_channel:
+ description: LXD snap channel
+ type: string
+ vca_model_config_max_action_results_age:
+ description: The maximum aget for status action results entries
+ type: string
+ vca_model_config_max_action_results_size:
+ description: The maximum size for status action results entries
+ type: string
+ vca_model_config_max_status_history_age:
+ description: |
+ The maximum age for status history entries before they are pruned,
+ in a human-readable time format.
+ type: string
+ vca_model_config_max_status_history_size:
+ description: |
+ The maximum size for the status history collection,
+ in human-readable memory format.
+ type: string
+ vca_model_config_net_bond_reconfigure_delay:
+ description: Net bond reconfigure delay
+ type: int
+ vca_model_config_no_proxy:
+ description: List of domain addresses not to be proxied (comma-separated).
+ type: string
+ vca_model_config_provisioner_harvest_mode:
+ description: Set what to do with unknown machines.
+ type: string
+ vca_model_config_proxy_ssh:
+ description: |
+ Set whether SSH commands should be proxied through the API server.
+ type: boolean
+ vca_model_config_snap_http_proxy:
+ description: The snap-centric HTTP proxy value.
+ type: string
+ vca_model_config_snap_https_proxy:
+ description: The snap-centric HTTPS proxy value.
+ type: string
+ vca_model_config_snap_store_assertions:
+ description: |
+ The collection of snap store assertions.
+ Each entry should contain the snap store ID.
+ type: string
+ vca_model_config_snap_store_proxy:
+ description: The snap store ID.
+ type: string
+ vca_model_config_snap_store_proxy_url:
+ description: The snap store proxy url
+ type: string
+ vca_model_config_ssl_hostname_verification:
+ description: Set whether SSL hostname verification is enabled.
+ type: boolean
+ vca_model_config_test_mode:
+ description: |
+ Set whether the model is intended for testing.
+ If true, accessing the charm store does not affect
+ statistical data of the store.
+ type: boolean
+ vca_model_config_transmit_vendor_metrics:
+ description: |
+ Set whether the controller will send metrics collected from
+ this model for use in anonymized aggregate analytics.
+ type: boolean
+ vca_model_config_update_status_hook_interval:
+ description: |
+ The run frequency of the update-status hook.
+ The value has a random +/- 20% offset applied to avoid hooks
+ for all units firing at once. Value change only honoured
+ during controller and model creation
+ (bootstrap --config and add-model --config).
+ type: string
#
# To get in touch with the maintainers, please contact:
# osm-charmers@lists.launchpad.net
-##
--r requirements.txt
-coverage
-stestr
-mock
-black
-yamllint
-flake8
-safety
-requests-mock
-asynctest
-nose2
\ No newline at end of file
+mock==4.0.3
import logging
-from typing import Optional, NoReturn
+from typing import NoReturn, Optional
-from ops.main import main
+from ops.main import main
from opslib.osm.charm import CharmedOsmBase, RelationsMissing
-
-from opslib.osm.pod import (
- ContainerV3Builder,
- PodSpecV3Builder,
-)
-
-from opslib.osm.validator import (
- ModelValidator,
- validator,
-)
-
+from opslib.osm.interfaces.http import HttpClient
from opslib.osm.interfaces.kafka import KafkaClient
from opslib.osm.interfaces.mongo import MongoClient
-from opslib.osm.interfaces.http import HttpClient
+from opslib.osm.pod import ContainerV3Builder, PodSpecV3Builder
+from opslib.osm.validator import ModelValidator, validator
logger = logging.getLogger(__name__)
vca_host: str
vca_port: int
vca_user: str
- vca_password: str
+ vca_secret: str
vca_pubkey: str
vca_cacert: str
vca_cloud: str
database_commonkey: str
log_level: str
vca_apiproxy: Optional[str]
+ # Model-config options
+ vca_model_config_agent_metadata_url: Optional[str]
+ vca_model_config_agent_stream: Optional[str]
+ vca_model_config_apt_ftp_proxy: Optional[str]
+ vca_model_config_apt_http_proxy: Optional[str]
+ vca_model_config_apt_https_proxy: Optional[str]
+ vca_model_config_apt_mirror: Optional[str]
+ vca_model_config_apt_no_proxy: Optional[str]
+ vca_model_config_automatically_retry_hooks: Optional[bool]
+ vca_model_config_backup_dir: Optional[str]
+ vca_model_config_cloudinit_userdata: Optional[str]
+ vca_model_config_container_image_metadata_url: Optional[str]
+ vca_model_config_container_image_stream: Optional[str]
+ vca_model_config_container_inherit_properties: Optional[str]
+ vca_model_config_container_networking_method: Optional[str]
+ vca_model_config_default_series: Optional[str]
+ vca_model_config_default_space: Optional[str]
+ vca_model_config_development: Optional[bool]
+ vca_model_config_disable_network_management: Optional[bool]
+ vca_model_config_egress_subnets: Optional[str]
+ vca_model_config_enable_os_refresh_update: Optional[bool]
+ vca_model_config_enable_os_upgrade: Optional[bool]
+ vca_model_config_fan_config: Optional[str]
+ vca_model_config_firewall_mode: Optional[str]
+ vca_model_config_ftp_proxy: Optional[str]
+ vca_model_config_http_proxy: Optional[str]
+ vca_model_config_https_proxy: Optional[str]
+ vca_model_config_ignore_machine_addresses: Optional[bool]
+ vca_model_config_image_metadata_url: Optional[str]
+ vca_model_config_image_stream: Optional[str]
+ vca_model_config_juju_ftp_proxy: Optional[str]
+ vca_model_config_juju_http_proxy: Optional[str]
+ vca_model_config_juju_https_proxy: Optional[str]
+ vca_model_config_juju_no_proxy: Optional[str]
+ vca_model_config_logforward_enabled: Optional[bool]
+ vca_model_config_logging_config: Optional[str]
+ vca_model_config_lxd_snap_channel: Optional[str]
+ vca_model_config_max_action_results_age: Optional[str]
+ vca_model_config_max_action_results_size: Optional[str]
+ vca_model_config_max_status_history_age: Optional[str]
+ vca_model_config_max_status_history_size: Optional[str]
+ vca_model_config_net_bond_reconfigure_delay: Optional[str]
+ vca_model_config_no_proxy: Optional[str]
+ vca_model_config_provisioner_harvest_mode: Optional[str]
+ vca_model_config_proxy_ssh: Optional[bool]
+ vca_model_config_snap_http_proxy: Optional[str]
+ vca_model_config_snap_https_proxy: Optional[str]
+ vca_model_config_snap_store_assertions: Optional[str]
+ vca_model_config_snap_store_proxy: Optional[str]
+ vca_model_config_snap_store_proxy_url: Optional[str]
+ vca_model_config_ssl_hostname_verification: Optional[bool]
+ vca_model_config_test_mode: Optional[bool]
+ vca_model_config_transmit_vendor_metrics: Optional[bool]
+ vca_model_config_update_status_hook_interval: Optional[str]
@validator("log_level")
def validate_log_level(cls, v):
"OSMLCM_VCA_PORT": config.vca_port,
"OSMLCM_VCA_USER": config.vca_user,
"OSMLCM_VCA_PUBKEY": config.vca_pubkey,
- "OSMLCM_VCA_SECRET": config.vca_password,
+ "OSMLCM_VCA_SECRET": config.vca_secret,
"OSMLCM_VCA_CACERT": config.vca_cacert,
"OSMLCM_VCA_CLOUD": config.vca_cloud,
"OSMLCM_VCA_K8S_CLOUD": config.vca_k8s_cloud,
if config.vca_apiproxy:
container_builder.add_env("OSMLCM_VCA_APIPROXY", config.vca_apiproxy)
+ model_config_envs = {
+ f"OSMLCM_{k.upper()}": v
+ for k, v in self.config.items()
+ if k.startswith("vca_model_config")
+ }
+ if model_config_envs:
+ container_builder.add_envs(model_config_envs)
container = container_builder.build()
# Add container to pod spec
pod_spec_builder.add_container(container)
"""Init mocking for unit tests."""
import sys
+
import mock
sys.path.append("src")
import sys
from typing import NoReturn
import unittest
-from ops.model import ActiveStatus, BlockedStatus
-from ops.testing import Harness
from charm import LcmCharm
+import mock
+from ops.model import ActiveStatus, BlockedStatus
+from ops.testing import Harness
class TestCharm(unittest.TestCase):
"vca_host": "192.168.0.13",
"vca_port": 17070,
"vca_user": "admin",
- "vca_password": "admin",
+ "vca_secret": "admin",
"vca_pubkey": "key",
"vca_cacert": "cacert",
"vca_cloud": "cloud",
# Verifying status
self.assertNotIsInstance(self.harness.charm.unit.status, BlockedStatus)
+ def test_build_pod_spec(
+ self,
+ ) -> NoReturn:
+ expected_config = {
+ "OSMLCM_GLOBAL_LOGLEVEL": self.config["log_level"],
+ "OSMLCM_DATABASE_COMMONKEY": self.config["database_commonkey"],
+ }
+ expected_config.update(
+ {
+ f"OSMLCM_{k.upper()}": v
+ for k, v in self.config.items()
+ if k.startswith("vca_")
+ }
+ )
+ self.harness.charm._check_missing_dependencies = mock.Mock()
+ pod_spec = self.harness.charm.build_pod_spec(
+ {"imageDetails": {"imagePath": "lcm-image"}}
+ )
+ actual_config = pod_spec["containers"][0]["envConfig"]
+
+ self.assertDictContainsSubset(
+ expected_config,
+ actual_config,
+ )
+ for config_key in actual_config:
+ self.assertNotIn("VCA_MODEL_CONFIG", config_key)
+
+ def test_build_pod_spec_with_model_config(
+ self,
+ ) -> NoReturn:
+ self.harness.update_config(
+ {
+ "vca_model_config_agent_metadata_url": "string",
+ "vca_model_config_agent_stream": "string",
+ "vca_model_config_apt_ftp_proxy": "string",
+ "vca_model_config_apt_http_proxy": "string",
+ "vca_model_config_apt_https_proxy": "string",
+ "vca_model_config_apt_mirror": "string",
+ "vca_model_config_apt_no_proxy": "string",
+ "vca_model_config_automatically_retry_hooks": False,
+ "vca_model_config_backup_dir": "string",
+ "vca_model_config_cloudinit_userdata": "string",
+ "vca_model_config_container_image_metadata_url": "string",
+ "vca_model_config_container_image_stream": "string",
+ "vca_model_config_container_inherit_properties": "string",
+ "vca_model_config_container_networking_method": "string",
+ "vca_model_config_default_series": "string",
+ "vca_model_config_default_space": "string",
+ "vca_model_config_development": False,
+ "vca_model_config_disable_network_management": False,
+ "vca_model_config_egress_subnets": "string",
+ "vca_model_config_enable_os_refresh_update": False,
+ "vca_model_config_enable_os_upgrade": False,
+ "vca_model_config_fan_config": "string",
+ "vca_model_config_firewall_mode": "string",
+ "vca_model_config_ftp_proxy": "string",
+ "vca_model_config_http_proxy": "string",
+ "vca_model_config_https_proxy": "string",
+ "vca_model_config_ignore_machine_addresses": False,
+ "vca_model_config_image_metadata_url": "string",
+ "vca_model_config_image_stream": "string",
+ "vca_model_config_juju_ftp_proxy": "string",
+ "vca_model_config_juju_http_proxy": "string",
+ "vca_model_config_juju_https_proxy": "string",
+ "vca_model_config_juju_no_proxy": "string",
+ "vca_model_config_logforward_enabled": False,
+ "vca_model_config_logging_config": "string",
+ "vca_model_config_lxd_snap_channel": "string",
+ "vca_model_config_max_action_results_age": "string",
+ "vca_model_config_max_action_results_size": "string",
+ "vca_model_config_max_status_history_age": "string",
+ "vca_model_config_max_status_history_size": "string",
+ "vca_model_config_net_bond_reconfigure_delay": "string",
+ "vca_model_config_no_proxy": "string",
+ "vca_model_config_provisioner_harvest_mode": "string",
+ "vca_model_config_proxy_ssh": False,
+ "vca_model_config_snap_http_proxy": "string",
+ "vca_model_config_snap_https_proxy": "string",
+ "vca_model_config_snap_store_assertions": "string",
+ "vca_model_config_snap_store_proxy": "string",
+ "vca_model_config_snap_store_proxy_url": "string",
+ "vca_model_config_ssl_hostname_verification": False,
+ "vca_model_config_test_mode": False,
+ "vca_model_config_transmit_vendor_metrics": False,
+ "vca_model_config_update_status_hook_interval": "string",
+ }
+ )
+ expected_config = {
+ f"OSMLCM_{k.upper()}": v
+ for k, v in self.config.items()
+ if k.startswith("vca_model_config_")
+ }
+
+ self.harness.charm._check_missing_dependencies = mock.Mock()
+ pod_spec = self.harness.charm.build_pod_spec(
+ {"imageDetails": {"imagePath": "lcm-image"}}
+ )
+ actual_config = pod_spec["containers"][0]["envConfig"]
+
+ self.assertDictContainsSubset(
+ expected_config,
+ actual_config,
+ )
+
def initialize_kafka_relation(self):
kafka_relation_id = self.harness.add_relation("kafka", "kafka")
self.harness.add_relation_unit(kafka_relation_id, "kafka/0")
#######################################################################################
[tox]
-envlist = flake8, cover, pylint, safety, yamllint
-skipsdist = True
+envlist = black, cover, flake8, pylint, yamllint, safety
+skipsdist = true
+
+[tox:jenkins]
+toxworkdir = /tmp/.tox
[testenv]
basepython = python3.8
-setenv =
- VIRTUAL_ENV={envdir}
- PYTHONHASHSEED=0
- PYTHONPATH = {toxinidir}/src
+setenv = VIRTUAL_ENV={envdir}
+ PYTHONDONTWRITEBYTECODE = 1
deps = -r{toxinidir}/requirements.txt
+
+#######################################################################################
+[testenv:black]
+deps = black
+commands =
+ black --check --diff src/ tests/
+
+
#######################################################################################
[testenv:cover]
deps = {[testenv]deps}
-r{toxinidir}/requirements-test.txt
+ coverage
+ nose2
commands =
sh -c 'rm -f nosetests.xml'
coverage erase
coverage xml -o coverage.xml --omit=*tests*
whitelist_externals = sh
-#######################################################################################
-[testenv:safety]
-setenv =
- LC_ALL=C.UTF-8
- LANG=C.UTF-8
-deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
-commands =
- - safety check --full-report
#######################################################################################
[testenv:flake8]
-deps = flake8
+deps = flake8
+ flake8-import-order
commands =
flake8 src/ tests/
+
#######################################################################################
[testenv:pylint]
deps = {[testenv]deps}
-r{toxinidir}/requirements-test.txt
pylint
commands =
- pylint -E src
+ pylint -E src/ tests/
+
#######################################################################################
-[testenv:black]
+[testenv:safety]
+setenv =
+ LC_ALL=C.UTF-8
+ LANG=C.UTF-8
deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
- black
-commands = black --check --diff . --exclude "build/|.tox/|mod/|lib/"
+ safety
+commands =
+ - safety check --full-report
+
#######################################################################################
[testenv:yamllint]
#######################################################################################
[testenv:build]
passenv=HTTP_PROXY HTTPS_PROXY NO_PROXY
-deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
- charmcraft
+deps = charmcraft
whitelist_externals =
charmcraft
cp
max-line-length = 120
show-source = True
builtins = _
-
+max-complexity = 10
+import-order-style = google
--- /dev/null
+# Copyright 2020 Canonical Ltd.
+#
+# 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.
+description: Single instance OSM bundle
+bundle: kubernetes
+variables:
+ proxy: &proxy http://91.189.89.11:3128
+ no-proxy: &no_proxy 127.0.0.1,localhost,::1,10.131.15.1/24,10.152.183.0/24,10.1.0.0/16
+applications:
+ zookeeper-k8s:
+ charm: "cs:~charmed-osm/zookeeper-k8s"
+ channel: "stable"
+ scale: 1
+ series: kubernetes
+ storage:
+ database: 100M
+ annotations:
+ gui-x: 0
+ gui-y: 550
+ mariadb-k8s:
+ charm: "cs:~charmed-osm/mariadb-k8s"
+ channel: "stable"
+ scale: 1
+ series: kubernetes
+ storage:
+ database: 50M
+ options:
+ password: manopw
+ root_password: osm4u
+ user: mano
+ annotations:
+ gui-x: -250
+ gui-y: -200
+ kafka-k8s:
+ charm: "cs:~charmed-osm/kafka-k8s"
+ channel: "stable"
+ scale: 1
+ series: kubernetes
+ storage:
+ database: 100M
+ annotations:
+ gui-x: 0
+ gui-y: 300
+ mongodb-k8s:
+ charm: "cs:~charmed-osm/mongodb-k8s"
+ channel: "stable"
+ scale: 1
+ series: kubernetes
+ storage:
+ database: 50M
+ options:
+ replica-set: rs0
+ namespace: osm
+ enable-sidecar: true
+ annotations:
+ gui-x: 0
+ gui-y: 50
+ nbi:
+ charm: "./nbi/build"
+ scale: 1
+ series: kubernetes
+ options:
+ database_commonkey: osm
+ auth_backend: keystone
+ annotations:
+ gui-x: 0
+ gui-y: -200
+ ro:
+ charm: "./ro/build"
+ scale: 1
+ series: kubernetes
+ annotations:
+ gui-x: -250
+ gui-y: 300
+ ng-ui:
+ charm: "./ng-ui/build"
+ scale: 1
+ series: kubernetes
+ annotations:
+ gui-x: 500
+ gui-y: 100
+ lcm:
+ charm: "./lcm/build"
+ scale: 1
+ series: kubernetes
+ options:
+ database_commonkey: osm
+ vca_model_config_no_proxy: *no_proxy
+ vca_model_config_juju_no_proxy: *no_proxy
+ vca_model_config_apt_no_proxy: *no_proxy
+ vca_model_config_juju_http_proxy: *proxy
+ vca_model_config_juju_https_proxy: *proxy
+ vca_model_config_apt_http_proxy: *proxy
+ vca_model_config_apt_https_proxy: *proxy
+ vca_model_config_snap_http_proxy: *proxy
+ vca_model_config_snap_https_proxy: *proxy
+ annotations:
+ gui-x: -250
+ gui-y: 50
+ mon:
+ charm: "./mon/build"
+ scale: 1
+ series: kubernetes
+ options:
+ database_commonkey: osm
+ annotations:
+ gui-x: 250
+ gui-y: 50
+ pol:
+ charm: "./pol/build"
+ scale: 1
+ series: kubernetes
+ annotations:
+ gui-x: -250
+ gui-y: 550
+ pla:
+ charm: "./pla/build"
+ scale: 1
+ series: kubernetes
+ annotations:
+ gui-x: 500
+ gui-y: -200
+ prometheus:
+ charm: "./prometheus/build"
+ channel: "stable"
+ scale: 1
+ series: kubernetes
+ storage:
+ data: 50M
+ options:
+ default-target: "mon:8000"
+ annotations:
+ gui-x: 250
+ gui-y: 300
+ grafana:
+ charm: "./grafana/build"
+ channel: "stable"
+ scale: 1
+ series: kubernetes
+ annotations:
+ gui-x: 250
+ gui-y: 550
+ keystone:
+ charm: "./keystone/build"
+ scale: 1
+ series: kubernetes
+ annotations:
+ gui-x: -250
+ gui-y: 550
+relations:
+ - - grafana:prometheus
+ - prometheus:prometheus
+ - - kafka-k8s:zookeeper
+ - zookeeper-k8s:zookeeper
+ - - keystone:db
+ - mariadb-k8s:mysql
+ - - lcm:kafka
+ - kafka-k8s:kafka
+ - - lcm:mongodb
+ - mongodb-k8s:mongo
+ - - ro:ro
+ - lcm:ro
+ - - ro:kafka
+ - kafka-k8s:kafka
+ - - ro:mongodb
+ - mongodb-k8s:mongo
+ - - pol:kafka
+ - kafka-k8s:kafka
+ - - pol:mongodb
+ - mongodb-k8s:mongo
+ - - mon:mongodb
+ - mongodb-k8s:mongo
+ - - mon:kafka
+ - kafka-k8s:kafka
+ - - pla:kafka
+ - kafka-k8s:kafka
+ - - pla:mongodb
+ - mongodb-k8s:mongo
+ - - nbi:mongodb
+ - mongodb-k8s:mongo
+ - - nbi:kafka
+ - kafka-k8s:kafka
+ - - nbi:prometheus
+ - prometheus:prometheus
+ - - nbi:keystone
+ - keystone:keystone
+ - - mon:prometheus
+ - prometheus:prometheus
+ - - ng-ui:nbi
+ - nbi:nbi
venv
.vscode
build
-prometheus.charm
+*.charm
.coverage
+coverage.xml
+.gitignore
.stestr
cover
+release
+tests/
+requirements*
+tox.ini
type: string
description: "The VCA user name."
default: "admin"
- vca_password:
+ vca_secret:
type: string
description: "The VCA user password."
default: "secret"
#
# To get in touch with the maintainers, please contact:
# osm-charmers@lists.launchpad.net
-##
--r requirements.txt
-coverage
-stestr
-mock
-black
-yamllint
-flake8
-safety
-requests-mock
-asynctest
-nose2
\ No newline at end of file
+mock==4.0.3
import logging
from typing import NoReturn
-from ops.main import main
+from ops.main import main
from opslib.osm.charm import CharmedOsmBase, RelationsMissing
-
-from opslib.osm.pod import (
- ContainerV3Builder,
- PodSpecV3Builder,
-)
-
-from opslib.osm.validator import (
- ModelValidator,
- validator,
-)
-
from opslib.osm.interfaces.kafka import KafkaClient
+from opslib.osm.interfaces.keystone import KeystoneClient
from opslib.osm.interfaces.mongo import MongoClient
from opslib.osm.interfaces.prometheus import PrometheusClient
-from opslib.osm.interfaces.keystone import KeystoneClient
+from opslib.osm.pod import ContainerV3Builder, PodSpecV3Builder
+from opslib.osm.validator import ModelValidator, validator
logger = logging.getLogger(__name__)
keystone_enabled: bool
vca_host: str
vca_user: str
- vca_password: str
+ vca_secret: str
vca_cacert: str
database_commonkey: str
log_level: str
# VCA configuration
"OSMMON_VCA_HOST": config.vca_host,
"OSMMON_VCA_USER": config.vca_user,
- "OSMMON_VCA_SECRET": config.vca_password,
+ "OSMMON_VCA_SECRET": config.vca_secret,
"OSMMON_VCA_CACERT": config.vca_cacert,
"OSMMON_GRAFANA_URL": config.grafana_url,
"OSMMON_GRAFANA_USER": config.grafana_user,
"""Init mocking for unit tests."""
import sys
+
import mock
sys.path.append("src")
import sys
from typing import NoReturn
import unittest
-from ops.model import ActiveStatus, BlockedStatus
-from ops.testing import Harness
from charm import MonCharm
+from ops.model import ActiveStatus, BlockedStatus
+from ops.testing import Harness
class TestCharm(unittest.TestCase):
self.config = {
"vca_host": "192.168.0.13",
"vca_user": "admin",
- "vca_password": "admin",
+ "vca_secret": "admin",
"vca_cacert": "cacert",
"database_commonkey": "commonkey",
"log_level": "INFO",
"OSMMON_DATABASE_DRIVER": "mongo",
"OSMMON_DATABASE_URI": relation_state["database_uri"],
"OSMMON_DATABASE_COMMONKEY": config["database_commonkey"],
- "OSMMON_PROMETHEUS_URL":
- f"http://{relation_state['prometheus_host']}:{relation_state['prometheus_port']}",
+ "OSMMON_PROMETHEUS_URL": (
+ f"http://{relation_state['prometheus_host']}:{relation_state['prometheus_port']}"
+ ),
"OSMMON_VCA_HOST": config["vca_host"],
"OSMMON_VCA_USER": config["vca_user"],
"OSMMON_VCA_SECRET": config["vca_password"],
#######################################################################################
[tox]
-envlist = flake8, cover, pylint, safety, yamllint
-skipsdist = True
+envlist = black, cover, flake8, pylint, yamllint, safety
+skipsdist = true
+
+[tox:jenkins]
+toxworkdir = /tmp/.tox
[testenv]
basepython = python3.8
-setenv =
- VIRTUAL_ENV={envdir}
- PYTHONHASHSEED=0
- PYTHONPATH = {toxinidir}/src
+setenv = VIRTUAL_ENV={envdir}
+ PYTHONDONTWRITEBYTECODE = 1
deps = -r{toxinidir}/requirements.txt
+
+#######################################################################################
+[testenv:black]
+deps = black
+commands =
+ black --check --diff src/ tests/
+
+
#######################################################################################
[testenv:cover]
deps = {[testenv]deps}
-r{toxinidir}/requirements-test.txt
+ coverage
+ nose2
commands =
sh -c 'rm -f nosetests.xml'
coverage erase
coverage xml -o coverage.xml --omit=*tests*
whitelist_externals = sh
-#######################################################################################
-[testenv:safety]
-setenv =
- LC_ALL=C.UTF-8
- LANG=C.UTF-8
-deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
-commands =
- - safety check --full-report
#######################################################################################
[testenv:flake8]
-deps = flake8
+deps = flake8
+ flake8-import-order
commands =
flake8 src/ tests/
+
#######################################################################################
[testenv:pylint]
deps = {[testenv]deps}
-r{toxinidir}/requirements-test.txt
pylint
commands =
- pylint -E src
+ pylint -E src/ tests/
+
#######################################################################################
-[testenv:black]
+[testenv:safety]
+setenv =
+ LC_ALL=C.UTF-8
+ LANG=C.UTF-8
deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
- black
-commands = black --check --diff . --exclude "build/|.tox/|mod/|lib/"
+ safety
+commands =
+ - safety check --full-report
+
#######################################################################################
[testenv:yamllint]
#######################################################################################
[testenv:build]
passenv=HTTP_PROXY HTTPS_PROXY NO_PROXY
-deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
- charmcraft
+deps = charmcraft
whitelist_externals =
charmcraft
cp
max-line-length = 120
show-source = True
builtins = _
-
+max-complexity = 10
+import-order-style = google
venv
.vscode
build
-<<<<<<< HEAD
-nbi.charm
-.coverage*
-=======
*.charm
.coverage
coverage.xml
->>>>>>> WIP: Improve osm charms
.stestr
cover
release
\ No newline at end of file
venv
.vscode
build
-prometheus.charm
+*.charm
.coverage
+coverage.xml
+.gitignore
.stestr
cover
+release
+tests/
+requirements*
+tox.ini
#
# To get in touch with the maintainers, please contact:
# osm-charmers@lists.launchpad.net
-##
--r requirements.txt
-coverage
-stestr
-mock
-black
-yamllint
-flake8
-safety
-requests-mock
-asynctest
-nose2
\ No newline at end of file
+mock==4.0.3
# pylint: disable=E0213
-import logging
-from typing import Optional, NoReturn
from ipaddress import ip_network
+import logging
+from typing import NoReturn, Optional
from urllib.parse import urlparse
-from ops.main import main
+from ops.main import main
from opslib.osm.charm import CharmedOsmBase, RelationsMissing
-
+from opslib.osm.interfaces.http import HttpServer
+from opslib.osm.interfaces.kafka import KafkaClient
+from opslib.osm.interfaces.keystone import KeystoneClient
+from opslib.osm.interfaces.mongo import MongoClient
+from opslib.osm.interfaces.prometheus import PrometheusClient
from opslib.osm.pod import (
ContainerV3Builder,
- PodSpecV3Builder,
IngressResourceV3Builder,
+ PodSpecV3Builder,
)
-
-
-from opslib.osm.validator import (
- ModelValidator,
- validator,
-)
-
-from opslib.osm.interfaces.kafka import KafkaClient
-from opslib.osm.interfaces.mongo import MongoClient
-from opslib.osm.interfaces.prometheus import PrometheusClient
-from opslib.osm.interfaces.keystone import KeystoneClient
-from opslib.osm.interfaces.http import HttpServer
+from opslib.osm.validator import ModelValidator, validator
logger = logging.getLogger(__name__)
"""Init mocking for unit tests."""
import sys
+
import mock
sys.path.append("src")
import sys
from typing import NoReturn
import unittest
-from ops.model import ActiveStatus, BlockedStatus
-from ops.testing import Harness
+
from charm import NbiCharm
+from ops.model import ActiveStatus, BlockedStatus
+from ops.testing import Harness
class TestCharm(unittest.TestCase):
#######################################################################################
[tox]
-envlist = flake8, cover, pylint, safety, yamllint
-skipsdist = True
+envlist = black, cover, flake8, pylint, yamllint, safety
+skipsdist = true
+
+[tox:jenkins]
+toxworkdir = /tmp/.tox
[testenv]
basepython = python3.8
-setenv =
- VIRTUAL_ENV={envdir}
- PYTHONHASHSEED=0
- PYTHONPATH = {toxinidir}/src
+setenv = VIRTUAL_ENV={envdir}
+ PYTHONDONTWRITEBYTECODE = 1
deps = -r{toxinidir}/requirements.txt
+
+#######################################################################################
+[testenv:black]
+deps = black
+commands =
+ black --check --diff src/ tests/
+
+
#######################################################################################
[testenv:cover]
deps = {[testenv]deps}
-r{toxinidir}/requirements-test.txt
+ coverage
+ nose2
commands =
sh -c 'rm -f nosetests.xml'
coverage erase
coverage xml -o coverage.xml --omit=*tests*
whitelist_externals = sh
-#######################################################################################
-[testenv:safety]
-setenv =
- LC_ALL=C.UTF-8
- LANG=C.UTF-8
-deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
-commands =
- - safety check --full-report
#######################################################################################
[testenv:flake8]
-deps = flake8
+deps = flake8
+ flake8-import-order
commands =
flake8 src/ tests/
+
#######################################################################################
[testenv:pylint]
deps = {[testenv]deps}
-r{toxinidir}/requirements-test.txt
pylint
commands =
- pylint -E src
+ pylint -E src/ tests/
+
#######################################################################################
-[testenv:black]
+[testenv:safety]
+setenv =
+ LC_ALL=C.UTF-8
+ LANG=C.UTF-8
deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
- black
-commands = black --check --diff . --exclude "build/|.tox/|mod/|lib/"
+ safety
+commands =
+ - safety check --full-report
+
#######################################################################################
[testenv:yamllint]
#######################################################################################
[testenv:build]
passenv=HTTP_PROXY HTTPS_PROXY NO_PROXY
-deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
- charmcraft
+deps = charmcraft
whitelist_externals =
charmcraft
cp
max-line-length = 120
show-source = True
builtins = _
-
+max-complexity = 10
+import-order-style = google
venv
.vscode
build
-<<<<<<< HEAD
-ng-ui.charm
-.stestr
-.coverage*
-cover/
-=======
*.charm
.coverage
coverage.xml
.stestr
cover
release
->>>>>>> WIP: Improve osm charms
venv
.vscode
build
-prometheus.charm
+*.charm
.coverage
+coverage.xml
+.gitignore
.stestr
cover
+release
+tests/
+requirements*
+tox.ini
#
# To get in touch with the maintainers, please contact:
# osm-charmers@lists.launchpad.net
-##
--r requirements.txt
-coverage
-stestr
-mock
-black
-yamllint
-flake8
-safety
-requests-mock
-asynctest
-nose2
\ No newline at end of file
+mock==4.0.3
# pylint: disable=E0213
-import logging
-from typing import Optional, NoReturn
from ipaddress import ip_network
+import logging
+from pathlib import Path
+from string import Template
+from typing import NoReturn, Optional
from urllib.parse import urlparse
from ops.main import main
-
from opslib.osm.charm import CharmedOsmBase, RelationsMissing
-
+from opslib.osm.interfaces.http import HttpClient
from opslib.osm.pod import (
ContainerV3Builder,
- PodSpecV3Builder,
FilesV3Builder,
IngressResourceV3Builder,
+ PodSpecV3Builder,
)
+from opslib.osm.validator import ModelValidator, validator
-from opslib.osm.validator import (
- ModelValidator,
- validator,
-)
-
-from opslib.osm.interfaces.http import HttpClient
-from string import Template
-from pathlib import Path
-
logger = logging.getLogger(__name__)
"""Init mocking for unit tests."""
import sys
+
+
import mock
sys.path.append("src")
import sys
from typing import NoReturn
import unittest
-from ops.model import ActiveStatus, BlockedStatus
-from ops.testing import Harness
from charm import NgUiCharm
+from ops.model import ActiveStatus, BlockedStatus
+from ops.testing import Harness
class TestCharm(unittest.TestCase):
#######################################################################################
[tox]
-envlist = flake8, cover, pylint, safety, yamllint
-skipsdist = True
+envlist = black, cover, flake8, pylint, yamllint, safety
+skipsdist = true
+
+[tox:jenkins]
+toxworkdir = /tmp/.tox
[testenv]
basepython = python3.8
-setenv =
- VIRTUAL_ENV={envdir}
- PYTHONHASHSEED=0
- PYTHONPATH = {toxinidir}/src
+setenv = VIRTUAL_ENV={envdir}
+ PYTHONDONTWRITEBYTECODE = 1
deps = -r{toxinidir}/requirements.txt
+
+#######################################################################################
+[testenv:black]
+deps = black
+commands =
+ black --check --diff src/ tests/
+
+
#######################################################################################
[testenv:cover]
deps = {[testenv]deps}
-r{toxinidir}/requirements-test.txt
+ coverage
+ nose2
commands =
sh -c 'rm -f nosetests.xml'
coverage erase
coverage xml -o coverage.xml --omit=*tests*
whitelist_externals = sh
-#######################################################################################
-[testenv:safety]
-setenv =
- LC_ALL=C.UTF-8
- LANG=C.UTF-8
-deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
-commands =
- - safety check --full-report
#######################################################################################
[testenv:flake8]
-deps = flake8
+deps = flake8
+ flake8-import-order
commands =
- flake8 src/ tests/
+ flake8 src/ tests/ --exclude=*pod_spec*
+
#######################################################################################
[testenv:pylint]
-r{toxinidir}/requirements-test.txt
pylint
commands =
- pylint -E src
+ pylint -E src/ tests/
+
#######################################################################################
-[testenv:black]
+[testenv:safety]
+setenv =
+ LC_ALL=C.UTF-8
+ LANG=C.UTF-8
deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
- black
-commands = black --check --diff . --exclude "build/|.tox/|mod/|lib/"
+ safety
+commands =
+ - safety check --full-report
+
#######################################################################################
[testenv:yamllint]
#######################################################################################
[testenv:build]
passenv=HTTP_PROXY HTTPS_PROXY NO_PROXY
-deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
- charmcraft
+deps = charmcraft
whitelist_externals =
charmcraft
cp
max-line-length = 120
show-source = True
builtins = _
-
+max-complexity = 10
+import-order-style = google
venv
.vscode
build
-prometheus.charm
+*.charm
.coverage
+coverage.xml
+.gitignore
.stestr
cover
+release
+tests/
+requirements*
+tox.ini
#
# To get in touch with the maintainers, please contact:
# osm-charmers@lists.launchpad.net
-##
--r requirements.txt
-coverage
-stestr
-mock
-black
-yamllint
-flake8
-safety
-requests-mock
-asynctest
-nose2
\ No newline at end of file
+mock==4.0.3
from typing import NoReturn
from ops.main import main
-
from opslib.osm.charm import CharmedOsmBase, RelationsMissing
-
+from opslib.osm.interfaces.kafka import KafkaClient
+from opslib.osm.interfaces.mongo import MongoClient
from opslib.osm.pod import (
ContainerV3Builder,
PodSpecV3Builder,
)
-
-from opslib.osm.validator import (
- ModelValidator,
- validator,
-)
-
-from opslib.osm.interfaces.kafka import KafkaClient
-from opslib.osm.interfaces.mongo import MongoClient
+from opslib.osm.validator import ModelValidator, validator
logger = logging.getLogger(__name__)
"""Init mocking for unit tests."""
import sys
+
+
import mock
sys.path.append("src")
import sys
from typing import NoReturn
import unittest
-from ops.model import ActiveStatus, BlockedStatus
-from ops.testing import Harness
+
from charm import PlaCharm
+from ops.model import ActiveStatus, BlockedStatus
+from ops.testing import Harness
class TestCharm(unittest.TestCase):
#######################################################################################
[tox]
-envlist = flake8, cover, pylint, safety, yamllint
-skipsdist = True
+envlist = black, cover, flake8, pylint, yamllint, safety
+skipsdist = true
+
+[tox:jenkins]
+toxworkdir = /tmp/.tox
[testenv]
basepython = python3.8
-setenv =
- VIRTUAL_ENV={envdir}
- PYTHONHASHSEED=0
- PYTHONPATH = {toxinidir}/src
+setenv = VIRTUAL_ENV={envdir}
+ PYTHONDONTWRITEBYTECODE = 1
deps = -r{toxinidir}/requirements.txt
+
+#######################################################################################
+[testenv:black]
+deps = black
+commands =
+ black --check --diff src/ tests/
+
+
#######################################################################################
[testenv:cover]
deps = {[testenv]deps}
-r{toxinidir}/requirements-test.txt
+ coverage
+ nose2
commands =
sh -c 'rm -f nosetests.xml'
coverage erase
coverage xml -o coverage.xml --omit=*tests*
whitelist_externals = sh
-#######################################################################################
-[testenv:safety]
-setenv =
- LC_ALL=C.UTF-8
- LANG=C.UTF-8
-deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
-commands =
- - safety check --full-report
#######################################################################################
[testenv:flake8]
-deps = flake8
+deps = flake8
+ flake8-import-order
commands =
flake8 src/ tests/
+
#######################################################################################
[testenv:pylint]
deps = {[testenv]deps}
-r{toxinidir}/requirements-test.txt
pylint
commands =
- pylint -E src
+ pylint -E src/ tests/
+
#######################################################################################
-[testenv:black]
+[testenv:safety]
+setenv =
+ LC_ALL=C.UTF-8
+ LANG=C.UTF-8
deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
- black
-commands = black --check --diff . --exclude "build/|.tox/|mod/|lib/"
+ safety
+commands =
+ - safety check --full-report
+
#######################################################################################
[testenv:yamllint]
#######################################################################################
[testenv:build]
passenv=HTTP_PROXY HTTPS_PROXY NO_PROXY
-deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
- charmcraft
+deps = charmcraft
whitelist_externals =
charmcraft
cp
max-line-length = 120
show-source = True
builtins = _
-
+max-complexity = 10
+import-order-style = google
venv
.vscode
build
-prometheus.charm
+*.charm
.coverage
+coverage.xml
+.gitignore
.stestr
cover
+release
+tests/
+requirements*
+tox.ini
#
# To get in touch with the maintainers, please contact:
# osm-charmers@lists.launchpad.net
-##
--r requirements.txt
-coverage
-stestr
-mock
-black
-yamllint
-flake8
-safety
-requests-mock
-asynctest
-nose2
\ No newline at end of file
+mock==4.0.3
from typing import NoReturn
from ops.main import main
-
from opslib.osm.charm import CharmedOsmBase, RelationsMissing
-
+from opslib.osm.interfaces.kafka import KafkaClient
+from opslib.osm.interfaces.mongo import MongoClient
from opslib.osm.pod import (
ContainerV3Builder,
PodSpecV3Builder,
)
-
-from opslib.osm.validator import (
- ModelValidator,
- validator,
-)
-
-from opslib.osm.interfaces.kafka import KafkaClient
-from opslib.osm.interfaces.mongo import MongoClient
+from opslib.osm.validator import ModelValidator, validator
logger = logging.getLogger(__name__)
"""Init mocking for unit tests."""
import sys
+
+
import mock
sys.path.append("src")
import sys
from typing import NoReturn
import unittest
-from ops.model import ActiveStatus, BlockedStatus
-from ops.testing import Harness
from charm import PolCharm
+from ops.model import ActiveStatus, BlockedStatus
+from ops.testing import Harness
class TestCharm(unittest.TestCase):
#######################################################################################
[tox]
-envlist = flake8, cover, pylint, safety, yamllint
-skipsdist = True
+envlist = black, cover, flake8, pylint, yamllint, safety
+skipsdist = true
+
+[tox:jenkins]
+toxworkdir = /tmp/.tox
[testenv]
basepython = python3.8
-setenv =
- VIRTUAL_ENV={envdir}
- PYTHONHASHSEED=0
- PYTHONPATH = {toxinidir}/src
+setenv = VIRTUAL_ENV={envdir}
+ PYTHONDONTWRITEBYTECODE = 1
deps = -r{toxinidir}/requirements.txt
+
+#######################################################################################
+[testenv:black]
+deps = black
+commands =
+ black --check --diff src/ tests/
+
+
#######################################################################################
[testenv:cover]
deps = {[testenv]deps}
-r{toxinidir}/requirements-test.txt
+ coverage
+ nose2
commands =
sh -c 'rm -f nosetests.xml'
coverage erase
coverage xml -o coverage.xml --omit=*tests*
whitelist_externals = sh
-#######################################################################################
-[testenv:safety]
-setenv =
- LC_ALL=C.UTF-8
- LANG=C.UTF-8
-deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
-commands =
- - safety check --full-report
#######################################################################################
[testenv:flake8]
-deps = flake8
+deps = flake8
+ flake8-import-order
commands =
flake8 src/ tests/
+
#######################################################################################
[testenv:pylint]
deps = {[testenv]deps}
-r{toxinidir}/requirements-test.txt
pylint
commands =
- pylint -E src
+ pylint -E src/ tests/
+
#######################################################################################
-[testenv:black]
+[testenv:safety]
+setenv =
+ LC_ALL=C.UTF-8
+ LANG=C.UTF-8
deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
- black
-commands = black --check --diff . --exclude "build/|.tox/|mod/|lib/"
+ safety
+commands =
+ - safety check --full-report
+
#######################################################################################
[testenv:yamllint]
#######################################################################################
[testenv:build]
passenv=HTTP_PROXY HTTPS_PROXY NO_PROXY
-deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
- charmcraft
+deps = charmcraft
whitelist_externals =
charmcraft
cp
max-line-length = 120
show-source = True
builtins = _
-
+max-complexity = 10
+import-order-style = google
venv
.vscode
build
-prometheus.charm
+*.charm
.coverage
+coverage.xml
+.gitignore
.stestr
cover
+release
+tests/
+requirements*
+tox.ini
#
# To get in touch with the maintainers, please contact:
# osm-charmers@lists.launchpad.net
-##
--r requirements.txt
-coverage
-stestr
-mock
-black
-yamllint
-flake8
-safety
-requests-mock
-asynctest
-nose2
\ No newline at end of file
+mock==4.0.3
# pylint: disable=E0213
-import logging
-from typing import Optional, NoReturn
from ipaddress import ip_network
+import logging
+from typing import NoReturn, Optional
+from urllib.parse import urlparse
from ops.framework import EventBase
from ops.main import main
-
from opslib.osm.charm import CharmedOsmBase
-
+from opslib.osm.interfaces.prometheus import PrometheusServer
from opslib.osm.pod import (
- IngressResourceV3Builder,
- FilesV3Builder,
ContainerV3Builder,
+ FilesV3Builder,
+ IngressResourceV3Builder,
PodSpecV3Builder,
)
-
-
from opslib.osm.validator import (
ModelValidator,
validator,
)
-from opslib.osm.interfaces.prometheus import PrometheusServer
-from urllib.parse import urlparse
logger = logging.getLogger(__name__)
"""Init mocking for unit tests."""
import sys
+
+
import mock
sys.path.append("src")
import sys
from typing import NoReturn
import unittest
-from ops.model import ActiveStatus
-from ops.testing import Harness
from charm import PrometheusCharm
+from ops.model import ActiveStatus
+from ops.testing import Harness
class TestCharm(unittest.TestCase):
#######################################################################################
[tox]
-envlist = flake8, cover, pylint, safety, yamllint
-skipsdist = True
+envlist = black, cover, flake8, pylint, yamllint, safety
+skipsdist = true
+
+[tox:jenkins]
+toxworkdir = /tmp/.tox
[testenv]
basepython = python3.8
-setenv =
- VIRTUAL_ENV={envdir}
- PYTHONHASHSEED=0
- PYTHONPATH = {toxinidir}/src
+setenv = VIRTUAL_ENV={envdir}
+ PYTHONDONTWRITEBYTECODE = 1
deps = -r{toxinidir}/requirements.txt
+
+#######################################################################################
+[testenv:black]
+deps = black
+commands =
+ black --check --diff src/ tests/
+
+
#######################################################################################
[testenv:cover]
deps = {[testenv]deps}
-r{toxinidir}/requirements-test.txt
+ coverage
+ nose2
commands =
sh -c 'rm -f nosetests.xml'
coverage erase
coverage xml -o coverage.xml --omit=*tests*
whitelist_externals = sh
-#######################################################################################
-[testenv:safety]
-setenv =
- LC_ALL=C.UTF-8
- LANG=C.UTF-8
-deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
-commands =
- - safety check --full-report
#######################################################################################
[testenv:flake8]
-deps = flake8
+deps = flake8
+ flake8-import-order
commands =
flake8 src/ tests/
+
#######################################################################################
[testenv:pylint]
deps = {[testenv]deps}
-r{toxinidir}/requirements-test.txt
pylint
commands =
- pylint -E src
+ pylint -E src/ tests/
+
#######################################################################################
-[testenv:black]
+[testenv:safety]
+setenv =
+ LC_ALL=C.UTF-8
+ LANG=C.UTF-8
deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
- black
-commands = black --check --diff . --exclude "build/|.tox/|mod/|lib/"
+ safety
+commands =
+ - safety check --full-report
+
#######################################################################################
[testenv:yamllint]
#######################################################################################
[testenv:build]
passenv=HTTP_PROXY HTTPS_PROXY NO_PROXY
-deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
- charmcraft
+deps = charmcraft
whitelist_externals =
charmcraft
cp
max-line-length = 120
show-source = True
builtins = _
-
+max-complexity = 10
+import-order-style = google
venv
.vscode
build
-prometheus.charm
+*.charm
.coverage
+coverage.xml
+.gitignore
.stestr
cover
+release
+tests/
+requirements*
+tox.ini
#
# To get in touch with the maintainers, please contact:
# osm-charmers@lists.launchpad.net
--r requirements.txt
-coverage
-stestr
-mock
-black
-yamllint
-flake8
-safety
-requests-mock
-asynctest
-nose2
\ No newline at end of file
+mock==4.0.3
from typing import NoReturn
from ops.main import main
-
from opslib.osm.charm import CharmedOsmBase, RelationsMissing
-
+from opslib.osm.interfaces.kafka import KafkaClient
+from opslib.osm.interfaces.mongo import MongoClient
+from opslib.osm.interfaces.mysql import MysqlClient
from opslib.osm.pod import (
ContainerV3Builder,
PodSpecV3Builder,
)
-
-
-from opslib.osm.validator import (
- ModelValidator,
- validator,
-)
-
-from opslib.osm.interfaces.kafka import KafkaClient
-from opslib.osm.interfaces.mysql import MysqlClient
-from opslib.osm.interfaces.mongo import MongoClient
+from opslib.osm.validator import ModelValidator, validator
logger = logging.getLogger(__name__)
"""Init mocking for unit tests."""
import sys
+
+
import mock
sys.path.append("src")
import sys
from typing import NoReturn
import unittest
-from ops.model import ActiveStatus, BlockedStatus
-from ops.testing import Harness
from charm import RoCharm
+from ops.model import ActiveStatus, BlockedStatus
+from ops.testing import Harness
class TestCharm(unittest.TestCase):
#######################################################################################
[tox]
-envlist = flake8, cover, pylint, safety, yamllint
-skipsdist = True
+envlist = black, cover, flake8, pylint, yamllint, safety
+skipsdist = true
+
+[tox:jenkins]
+toxworkdir = /tmp/.tox
[testenv]
basepython = python3.8
-setenv =
- VIRTUAL_ENV={envdir}
- PYTHONHASHSEED=0
- PYTHONPATH = {toxinidir}/src
+setenv = VIRTUAL_ENV={envdir}
+ PYTHONDONTWRITEBYTECODE = 1
deps = -r{toxinidir}/requirements.txt
+
+#######################################################################################
+[testenv:black]
+deps = black
+commands =
+ black --check --diff src/ tests/
+
+
#######################################################################################
[testenv:cover]
deps = {[testenv]deps}
-r{toxinidir}/requirements-test.txt
+ coverage
+ nose2
commands =
sh -c 'rm -f nosetests.xml'
coverage erase
coverage xml -o coverage.xml --omit=*tests*
whitelist_externals = sh
-#######################################################################################
-[testenv:safety]
-setenv =
- LC_ALL=C.UTF-8
- LANG=C.UTF-8
-deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
-commands =
- - safety check --full-report
#######################################################################################
[testenv:flake8]
-deps = flake8
+deps = flake8
+ flake8-import-order
commands =
flake8 src/ tests/
+
#######################################################################################
[testenv:pylint]
deps = {[testenv]deps}
-r{toxinidir}/requirements-test.txt
pylint
commands =
- pylint -E src
+ pylint -E src/ tests/
+
#######################################################################################
-[testenv:black]
+[testenv:safety]
+setenv =
+ LC_ALL=C.UTF-8
+ LANG=C.UTF-8
deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
- black
-commands = black --check --diff . --exclude "build/|.tox/|mod/|lib/"
+ safety
+commands =
+ - safety check --full-report
+
#######################################################################################
[testenv:yamllint]
#######################################################################################
[testenv:build]
passenv=HTTP_PROXY HTTPS_PROXY NO_PROXY
-deps = {[testenv]deps}
- -r{toxinidir}/requirements-test.txt
- charmcraft
+deps = charmcraft
whitelist_externals =
charmcraft
cp
max-line-length = 120
show-source = True
builtins = _
-
+max-complexity = 10
+import-order-style = google
MODEL_NAME=osm
-OSM_BUNDLE=cs:osm-58
-OSM_HA_BUNDLE=cs:osm-ha-43
+OSM_BUNDLE=cs:osm-60
+OSM_HA_BUNDLE=cs:osm-ha-45
TAG=testing-daily
function check_arguments(){
sudo snap install yq
local HOME=/home/$USER
local vca_user=$(cat $HOME/.local/share/juju/accounts.yaml | yq e .controllers.$CONTROLLER_NAME.user - )
- local vca_password=$(cat $HOME/.local/share/juju/accounts.yaml | yq e .controllers.$CONTROLLER_NAME.password - )
+ local vca_secret=$(cat $HOME/.local/share/juju/accounts.yaml | yq e .controllers.$CONTROLLER_NAME.password - )
local vca_host=$(cat $HOME/.local/share/juju/controllers.yaml | yq e .controllers.$CONTROLLER_NAME.api-endpoints[0] - | cut -d ":" -f 1)
local vca_port=$(cat $HOME/.local/share/juju/controllers.yaml | yq e .controllers.$CONTROLLER_NAME.api-endpoints[0] - | cut -d ":" -f 2)
local vca_pubkey=\"$(cat $HOME/.local/share/juju/ssh/juju_id_rsa.pub)\"
lcm:
options:
vca_user: $vca_user
- vca_password: $vca_password
+ vca_secret: $vca_secret
vca_host: $vca_host
vca_port: $vca_port
vca_pubkey: $vca_pubkey
mon:
options:
vca_user: $vca_user
- vca_password: $vca_password
+ vca_secret: $vca_secret
vca_host: $vca_host
vca_cacert: $vca_cacert
EOF