Fix 1473 and add vca_model_config_* to lcm charm 08/10508/5
authorDavid Garcia <david.garcia@canonical.com>
Wed, 17 Mar 2021 14:28:47 +0000 (15:28 +0100)
committerDavid Garcia <david.garcia@canonical.com>
Wed, 17 Mar 2021 19:03:04 +0000 (20:03 +0100)
Changes in all operator charms:
- Optimize deps for tox environments
- Add import-order-style to flake8
- Optimize .jujuignore to reduce the size of charm artifacts
OSM LCM charm:
- Added vca_model_config_* options
Added bundle example for using a bundle
Updated the bundles and pin the new versions in the installer

Change-Id: Ic6591354fa5d1b5f43383215b2f0df13eb28ce67
Signed-off-by: David Garcia <david.garcia@canonical.com>
69 files changed:
installers/charm/bundles/osm-ha/bundle.yaml
installers/charm/bundles/osm/bundle.yaml
installers/charm/grafana/.jujuignore
installers/charm/grafana/requirements-test.txt
installers/charm/grafana/src/charm.py
installers/charm/grafana/tests/__init__.py
installers/charm/grafana/tests/test_charm.py
installers/charm/grafana/tox.ini
installers/charm/keystone/.jujuignore
installers/charm/keystone/requirements-test.txt
installers/charm/keystone/src/charm.py
installers/charm/keystone/tests/__init__.py
installers/charm/keystone/tests/test_charm.py
installers/charm/keystone/tox.ini
installers/charm/lcm/.jujuignore
installers/charm/lcm/config.yaml
installers/charm/lcm/requirements-test.txt
installers/charm/lcm/src/charm.py
installers/charm/lcm/tests/__init__.py
installers/charm/lcm/tests/test_charm.py
installers/charm/lcm/tox.ini
installers/charm/local_osm_bundle_proxy.yaml [new file with mode: 0644]
installers/charm/mon/.jujuignore
installers/charm/mon/config.yaml
installers/charm/mon/requirements-test.txt
installers/charm/mon/src/charm.py
installers/charm/mon/tests/__init__.py
installers/charm/mon/tests/test_charm.py
installers/charm/mon/tests/test_pod_spec.py
installers/charm/mon/tox.ini
installers/charm/nbi/.gitignore
installers/charm/nbi/.jujuignore
installers/charm/nbi/requirements-test.txt
installers/charm/nbi/src/charm.py
installers/charm/nbi/tests/__init__.py
installers/charm/nbi/tests/test_charm.py
installers/charm/nbi/tox.ini
installers/charm/ng-ui/.gitignore
installers/charm/ng-ui/.jujuignore
installers/charm/ng-ui/requirements-test.txt
installers/charm/ng-ui/src/charm.py
installers/charm/ng-ui/tests/__init__.py
installers/charm/ng-ui/tests/test_charm.py
installers/charm/ng-ui/tox.ini
installers/charm/pla/.jujuignore
installers/charm/pla/requirements-test.txt
installers/charm/pla/src/charm.py
installers/charm/pla/tests/__init__.py
installers/charm/pla/tests/test_charm.py
installers/charm/pla/tox.ini
installers/charm/pol/.jujuignore
installers/charm/pol/requirements-test.txt
installers/charm/pol/src/charm.py
installers/charm/pol/tests/__init__.py
installers/charm/pol/tests/test_charm.py
installers/charm/pol/tox.ini
installers/charm/prometheus/.jujuignore
installers/charm/prometheus/requirements-test.txt
installers/charm/prometheus/src/charm.py
installers/charm/prometheus/tests/__init__.py
installers/charm/prometheus/tests/test_charm.py
installers/charm/prometheus/tox.ini
installers/charm/ro/.jujuignore
installers/charm/ro/requirements-test.txt
installers/charm/ro/src/charm.py
installers/charm/ro/tests/__init__.py
installers/charm/ro/tests/test_charm.py
installers/charm/ro/tox.ini
installers/charmed_install.sh

index d3a586a..9ee7195 100644 (file)
@@ -83,7 +83,7 @@ applications:
       gui-x: 0
       gui-y: 0
   nbi:
-    charm: "cs:~charmed-osm/nbi-5"
+    charm: "cs:~charmed-osm/nbi-6"
     scale: 3
     series: kubernetes
     options:
@@ -94,7 +94,7 @@ applications:
       gui-x: 0
       gui-y: -250
   ro:
-    charm: "cs:~charmed-osm/ro-0"
+    charm: "cs:~charmed-osm/ro-1"
     scale: 3
     series: kubernetes
     options:
@@ -103,14 +103,14 @@ applications:
       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:
@@ -120,7 +120,7 @@ applications:
       gui-x: -300
       gui-y: 0
   mon:
-    charm: "cs:~charmed-osm/mon-1"
+    charm: "cs:~charmed-osm/mon-2"
     scale: 1
     series: kubernetes
     options:
@@ -131,7 +131,7 @@ applications:
       gui-x: 300
       gui-y: 0
   pol:
-    charm: "cs:~charmed-osm/pol-0"
+    charm: "cs:~charmed-osm/pol-1"
     scale: 3
     series: kubernetes
     options:
@@ -140,7 +140,7 @@ applications:
       gui-x: -300
       gui-y: 500
   pla:
-    charm: "cs:~charmed-osm/pla-6"
+    charm: "cs:~charmed-osm/pla-7"
     scale: 3
     series: kubernetes
     options:
@@ -149,7 +149,7 @@ applications:
       gui-x: 600
       gui-y: -250
   prometheus:
-    charm: "cs:~charmed-osm/prometheus-0"
+    charm: "cs:~charmed-osm/prometheus-1"
     scale: 1
     series: kubernetes
     storage:
@@ -160,14 +160,14 @@ applications:
       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:
index b210a40..404ed56 100644 (file)
@@ -76,7 +76,7 @@ applications:
       gui-x: 0
       gui-y: 0
   nbi:
-    charm: "cs:~charmed-osm/nbi-5"
+    charm: "cs:~charmed-osm/nbi-6"
     scale: 1
     series: kubernetes
     options:
@@ -87,7 +87,7 @@ applications:
       gui-x: 0
       gui-y: -250
   ro:
-    charm: "cs:~charmed-osm/ro-0"
+    charm: "cs:~charmed-osm/ro-1"
     scale: 1
     series: kubernetes
     options:
@@ -96,14 +96,14 @@ applications:
       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:
@@ -113,7 +113,7 @@ applications:
       gui-x: -300
       gui-y: 0
   mon:
-    charm: "cs:~charmed-osm/mon-1"
+    charm: "cs:~charmed-osm/mon-2"
     scale: 1
     series: kubernetes
     options:
@@ -124,7 +124,7 @@ applications:
       gui-x: 300
       gui-y: 0
   pol:
-    charm: "cs:~charmed-osm/pol-0"
+    charm: "cs:~charmed-osm/pol-1"
     scale: 1
     series: kubernetes
     options:
@@ -133,7 +133,7 @@ applications:
       gui-x: -300
       gui-y: 500
   pla:
-    charm: "cs:~charmed-osm/pla-6"
+    charm: "cs:~charmed-osm/pla-7"
     scale: 1
     series: kubernetes
     options:
@@ -142,7 +142,7 @@ applications:
       gui-x: 600
       gui-y: -250
   prometheus:
-    charm: "cs:~charmed-osm/prometheus-0"
+    charm: "cs:~charmed-osm/prometheus-1"
     scale: 1
     series: kubernetes
     storage:
@@ -153,14 +153,14 @@ applications:
       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:
index bf04eb4..3ae3e7d 100644 (file)
 venv
 .vscode
 build
-prometheus.charm
+*.charm
 .coverage
+coverage.xml
+.gitignore
 .stestr
 cover
+release
+tests/
+requirements*
+tox.ini
index d7585f3..cf61dd4 100644 (file)
 #
 # 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
index d61873c..d10ccf2 100755 (executable)
 
 # 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
@@ -90,8 +82,12 @@ class GrafanaCharm(CharmedOsmBase):
         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()
index 4fd849a..0967ea6 100644 (file)
@@ -23,6 +23,8 @@
 """Init mocking for unit tests."""
 
 import sys
+
+
 import mock
 
 sys.path.append("src")
index 07beb4a..4e269df 100644 (file)
 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):
index 1f9442e..dc4074f 100644 (file)
 #######################################################################################
 
 [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
@@ -45,21 +56,14 @@ commands =
         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]
@@ -67,14 +71,19 @@ 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]
@@ -86,9 +95,7 @@ commands = 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
@@ -112,4 +119,5 @@ exclude =
 max-line-length = 120
 show-source = True
 builtins = _
-
+max-complexity = 10
+import-order-style = google
index bf04eb4..3ae3e7d 100644 (file)
 venv
 .vscode
 build
-prometheus.charm
+*.charm
 .coverage
+coverage.xml
+.gitignore
 .stestr
 cover
+release
+tests/
+requirements*
+tox.ini
index d7585f3..cf61dd4 100644 (file)
 #
 # 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
index 72d7090..a8c69fe 100755 (executable)
 # 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__)
index d0d973a..ca37e3b 100644 (file)
@@ -23,6 +23,8 @@
 """Init mocking for unit tests."""
 
 import sys
+
+
 import mock
 
 sys.path.append("src")
index 756a5e4..d16e75d 100644 (file)
 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):
index 1f9442e..d0d2570 100644 (file)
 #######################################################################################
 
 [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
@@ -45,36 +56,34 @@ commands =
         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]
@@ -86,9 +95,7 @@ commands = 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
@@ -112,4 +119,5 @@ exclude =
 max-line-length = 120
 show-source = True
 builtins = _
-
+; max-complexity = 10
+import-order-style = google
index bf04eb4..3ae3e7d 100644 (file)
 venv
 .vscode
 build
-prometheus.charm
+*.charm
 .coverage
+coverage.xml
+.gitignore
 .stestr
 cover
+release
+tests/
+requirements*
+tox.ini
index 4c823d1..6301622 100644 (file)
@@ -32,9 +32,9 @@ options:
     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
@@ -63,3 +63,211 @@ options:
     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
index d7585f3..cf61dd4 100644 (file)
 #
 # 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
index 270a547..e9552fd 100755 (executable)
 
 
 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__)
@@ -54,7 +45,7 @@ class ConfigModel(ModelValidator):
     vca_host: str
     vca_port: int
     vca_user: str
-    vca_password: str
+    vca_secret: str
     vca_pubkey: str
     vca_cacert: str
     vca_cloud: str
@@ -62,6 +53,60 @@ class ConfigModel(ModelValidator):
     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):
@@ -136,7 +181,7 @@ class LcmCharm(CharmedOsmBase):
                 "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,
@@ -145,6 +190,13 @@ class LcmCharm(CharmedOsmBase):
         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)
index d0d973a..ee5553b 100644 (file)
@@ -23,6 +23,7 @@
 """Init mocking for unit tests."""
 
 import sys
+
 import mock
 
 sys.path.append("src")
index bff3cee..831e176 100644 (file)
 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):
@@ -42,7 +43,7 @@ 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",
@@ -88,6 +89,110 @@ class TestCharm(unittest.TestCase):
         # 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")
index 1f9442e..30e0ea8 100644 (file)
 #######################################################################################
 
 [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
@@ -45,36 +56,34 @@ commands =
         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]
@@ -86,9 +95,7 @@ commands = 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
@@ -112,4 +119,5 @@ exclude =
 max-line-length = 120
 show-source = True
 builtins = _
-
+max-complexity = 10
+import-order-style = google
diff --git a/installers/charm/local_osm_bundle_proxy.yaml b/installers/charm/local_osm_bundle_proxy.yaml
new file mode 100644 (file)
index 0000000..d328522
--- /dev/null
@@ -0,0 +1,200 @@
+# 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
index bf04eb4..3ae3e7d 100644 (file)
 venv
 .vscode
 build
-prometheus.charm
+*.charm
 .coverage
+coverage.xml
+.gitignore
 .stestr
 cover
+release
+tests/
+requirements*
+tox.ini
index 2fffbc5..5391497 100644 (file)
@@ -52,7 +52,7 @@ options:
     type: string
     description: "The VCA user name."
     default: "admin"
-  vca_password:
+  vca_secret:
     type: string
     description: "The VCA user password."
     default: "secret"
index d7585f3..cf61dd4 100644 (file)
 #
 # 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
index 26dee3f..d0145d4 100755 (executable)
 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__)
@@ -55,7 +46,7 @@ class ConfigModel(ModelValidator):
     keystone_enabled: bool
     vca_host: str
     vca_user: str
-    vca_password: str
+    vca_secret: str
     vca_cacert: str
     database_commonkey: str
     log_level: str
@@ -146,7 +137,7 @@ class MonCharm(CharmedOsmBase):
                 # 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,
index d0d973a..ee5553b 100644 (file)
@@ -23,6 +23,7 @@
 """Init mocking for unit tests."""
 
 import sys
+
 import mock
 
 sys.path.append("src")
index 5d6f1a0..858ff7c 100644 (file)
 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):
@@ -41,7 +41,7 @@ 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",
index 6f61916..86a3d16 100644 (file)
@@ -199,8 +199,9 @@ class TestPodSpec(unittest.TestCase):
                         "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"],
index 1f9442e..30e0ea8 100644 (file)
 #######################################################################################
 
 [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
@@ -45,36 +56,34 @@ commands =
         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]
@@ -86,9 +95,7 @@ commands = 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
@@ -112,4 +119,5 @@ exclude =
 max-line-length = 120
 show-source = True
 builtins = _
-
+max-complexity = 10
+import-order-style = google
index 21a2062..2885df2 100644 (file)
 venv
 .vscode
 build
-<<<<<<< HEAD
-nbi.charm
-.coverage*
-=======
 *.charm
 .coverage
 coverage.xml
->>>>>>> WIP: Improve osm charms
 .stestr
 cover
 release
\ No newline at end of file
index bf04eb4..3ae3e7d 100644 (file)
 venv
 .vscode
 build
-prometheus.charm
+*.charm
 .coverage
+coverage.xml
+.gitignore
 .stestr
 cover
+release
+tests/
+requirements*
+tox.ini
index d7585f3..cf61dd4 100644 (file)
 #
 # 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
index 9d62fe2..7efc5b0 100755 (executable)
 # 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__)
index d0d973a..ee5553b 100644 (file)
@@ -23,6 +23,7 @@
 """Init mocking for unit tests."""
 
 import sys
+
 import mock
 
 sys.path.append("src")
index be24aa6..c4e857f 100644 (file)
 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):
index 1f9442e..30e0ea8 100644 (file)
 #######################################################################################
 
 [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
@@ -45,36 +56,34 @@ commands =
         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]
@@ -86,9 +95,7 @@ commands = 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
@@ -112,4 +119,5 @@ exclude =
 max-line-length = 120
 show-source = True
 builtins = _
-
+max-complexity = 10
+import-order-style = google
index ecfb4dc..493739e 100644 (file)
 venv
 .vscode
 build
-<<<<<<< HEAD
-ng-ui.charm
-.stestr
-.coverage*
-cover/
-=======
 *.charm
 .coverage
 coverage.xml
 .stestr
 cover
 release
->>>>>>> WIP: Improve osm charms
index bf04eb4..3ae3e7d 100644 (file)
 venv
 .vscode
 build
-prometheus.charm
+*.charm
 .coverage
+coverage.xml
+.gitignore
 .stestr
 cover
+release
+tests/
+requirements*
+tox.ini
index d7585f3..cf61dd4 100644 (file)
 #
 # 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
index 4d2bb85..bf301f3 100755 (executable)
 # 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__)
 
 
index d0d973a..ca37e3b 100644 (file)
@@ -23,6 +23,8 @@
 """Init mocking for unit tests."""
 
 import sys
+
+
 import mock
 
 sys.path.append("src")
index d9a4d3e..5b5327b 100644 (file)
 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):
index 1f9442e..dc4074f 100644 (file)
 #######################################################################################
 
 [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
@@ -45,21 +56,14 @@ commands =
         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]
@@ -67,14 +71,19 @@ 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]
@@ -86,9 +95,7 @@ commands = 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
@@ -112,4 +119,5 @@ exclude =
 max-line-length = 120
 show-source = True
 builtins = _
-
+max-complexity = 10
+import-order-style = google
index bf04eb4..3ae3e7d 100644 (file)
 venv
 .vscode
 build
-prometheus.charm
+*.charm
 .coverage
+coverage.xml
+.gitignore
 .stestr
 cover
+release
+tests/
+requirements*
+tox.ini
index d7585f3..cf61dd4 100644 (file)
 #
 # 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
index 4f463bf..15ae095 100755 (executable)
@@ -27,21 +27,14 @@ import logging
 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__)
index d0d973a..ca37e3b 100644 (file)
@@ -23,6 +23,8 @@
 """Init mocking for unit tests."""
 
 import sys
+
+
 import mock
 
 sys.path.append("src")
index b1a7820..80cb315 100644 (file)
 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):
index 1f9442e..30e0ea8 100644 (file)
 #######################################################################################
 
 [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
@@ -45,36 +56,34 @@ commands =
         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]
@@ -86,9 +95,7 @@ commands = 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
@@ -112,4 +119,5 @@ exclude =
 max-line-length = 120
 show-source = True
 builtins = _
-
+max-complexity = 10
+import-order-style = google
index bf04eb4..3ae3e7d 100644 (file)
 venv
 .vscode
 build
-prometheus.charm
+*.charm
 .coverage
+coverage.xml
+.gitignore
 .stestr
 cover
+release
+tests/
+requirements*
+tox.ini
index d7585f3..cf61dd4 100644 (file)
 #
 # 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
index ce1a25e..d339e1c 100755 (executable)
@@ -27,21 +27,14 @@ import logging
 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__)
index d0d973a..ca37e3b 100644 (file)
@@ -23,6 +23,8 @@
 """Init mocking for unit tests."""
 
 import sys
+
+
 import mock
 
 sys.path.append("src")
index 2214397..32b1acd 100644 (file)
 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):
index 1f9442e..30e0ea8 100644 (file)
 #######################################################################################
 
 [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
@@ -45,36 +56,34 @@ commands =
         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]
@@ -86,9 +95,7 @@ commands = 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
@@ -112,4 +119,5 @@ exclude =
 max-line-length = 120
 show-source = True
 builtins = _
-
+max-complexity = 10
+import-order-style = google
index bf04eb4..3ae3e7d 100644 (file)
 venv
 .vscode
 build
-prometheus.charm
+*.charm
 .coverage
+coverage.xml
+.gitignore
 .stestr
 cover
+release
+tests/
+requirements*
+tox.ini
index d7585f3..cf61dd4 100644 (file)
 #
 # 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
index 3d72cac..47533dd 100755 (executable)
 
 # 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__)
 
index d0d973a..ca37e3b 100644 (file)
@@ -23,6 +23,8 @@
 """Init mocking for unit tests."""
 
 import sys
+
+
 import mock
 
 sys.path.append("src")
index b1848bd..dd8b732 100644 (file)
 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):
index 1f9442e..30e0ea8 100644 (file)
 #######################################################################################
 
 [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
@@ -45,36 +56,34 @@ commands =
         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]
@@ -86,9 +95,7 @@ commands = 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
@@ -112,4 +119,5 @@ exclude =
 max-line-length = 120
 show-source = True
 builtins = _
-
+max-complexity = 10
+import-order-style = google
index bf04eb4..3ae3e7d 100644 (file)
 venv
 .vscode
 build
-prometheus.charm
+*.charm
 .coverage
+coverage.xml
+.gitignore
 .stestr
 cover
+release
+tests/
+requirements*
+tox.ini
index 1da01c8..cf61dd4 100644 (file)
 #
 # 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
index ae92d98..6851600 100755 (executable)
@@ -26,23 +26,15 @@ import logging
 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__)
index d0d973a..ca37e3b 100644 (file)
@@ -23,6 +23,8 @@
 """Init mocking for unit tests."""
 
 import sys
+
+
 import mock
 
 sys.path.append("src")
index 4f14aff..4610b25 100644 (file)
 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):
index 1f9442e..30e0ea8 100644 (file)
 #######################################################################################
 
 [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
@@ -45,36 +56,34 @@ commands =
         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]
@@ -86,9 +95,7 @@ commands = 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
@@ -112,4 +119,5 @@ exclude =
 max-line-length = 120
 show-source = True
 builtins = _
-
+max-complexity = 10
+import-order-style = google
index e196706..b36d582 100755 (executable)
@@ -25,8 +25,8 @@ PATH=/snap/bin:${PATH}
 
 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(){
@@ -306,7 +306,7 @@ function create_overlay() {
     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)\"
@@ -323,7 +323,7 @@ applications:
   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
@@ -333,7 +333,7 @@ applications:
   mon:
     options:
       vca_user: $vca_user
-      vca_password: $vca_password
+      vca_secret: $vca_secret
       vca_host: $vca_host
       vca_cacert: $vca_cacert
 EOF