Fix juju status in OSM Charms
Change-Id: Iab33813f81c394f2444fb9407b4fab4b70929c90
Signed-off-by: David Garcia <david.garcia@canonical.com>
diff --git a/installers/charm/ng-ui/.gitignore b/installers/charm/ng-ui/.gitignore
new file mode 100644
index 0000000..dfaa805
--- /dev/null
+++ b/installers/charm/ng-ui/.gitignore
@@ -0,0 +1,16 @@
+# 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.
+.vscode
+build
+ng-ui.charm
\ No newline at end of file
diff --git a/installers/charm/ng-ui/hooks/start b/installers/charm/ng-ui/hooks/start
deleted file mode 120000
index 25b1f68..0000000
--- a/installers/charm/ng-ui/hooks/start
+++ /dev/null
@@ -1 +0,0 @@
-../src/charm.py
\ No newline at end of file
diff --git a/installers/charm/ng-ui/lib/ops b/installers/charm/ng-ui/lib/ops
deleted file mode 120000
index d934193..0000000
--- a/installers/charm/ng-ui/lib/ops
+++ /dev/null
@@ -1 +0,0 @@
-../mod/operator/ops
\ No newline at end of file
diff --git a/installers/charm/ng-ui/requirements.txt b/installers/charm/ng-ui/requirements.txt
new file mode 100644
index 0000000..10ecdcd
--- /dev/null
+++ b/installers/charm/ng-ui/requirements.txt
@@ -0,0 +1,14 @@
+# 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.
+ops
diff --git a/installers/charm/ng-ui/src/charm.py b/installers/charm/ng-ui/src/charm.py
index ce48927..8e21bcd 100755
--- a/installers/charm/ng-ui/src/charm.py
+++ b/installers/charm/ng-ui/src/charm.py
@@ -157,7 +157,7 @@
},
}
)
- logger.debug(files)
+
spec = {
"version": 2,
"containers": [
@@ -188,11 +188,12 @@
self.on_start(event)
def on_nbi_relation_changed(self, event):
- unit = self.model.unit
- if not unit.is_leader():
- return
- self.state.nbi_host = event.relation.data[event.unit].get("host")
- self.state.nbi_port = event.relation.data[event.unit].get("port")
+ nbi_host = event.relation.data[event.unit].get("host")
+ nbi_port = event.relation.data[event.unit].get("port")
+ if nbi_host and self.state.nbi_host != nbi_host:
+ self.state.nbi_host = nbi_host
+ if nbi_port and self.state.nbi_port != nbi_port:
+ self.state.nbi_port = nbi_port
self._apply_spec()
diff --git a/installers/charm/ng-ui/tox.ini b/installers/charm/ng-ui/tox.ini
index aafa301..1c22bd5 100644
--- a/installers/charm/ng-ui/tox.ini
+++ b/installers/charm/ng-ui/tox.ini
@@ -20,10 +20,20 @@
PYTHONHASHSEED=0
whitelist_externals = juju
passenv = HOME TERM CS_API_* OS_* AMULET_*
-deps = -r{toxinidir}/test-requirements.txt
install_command =
pip install {opts} {packages}
+[testenv:build]
+basepython = python3
+passenv=HTTP_PROXY HTTPS_PROXY NO_PROXY
+whitelist_externals = charmcraft
+ rm
+ unzip
+commands =
+ rm -rf release
+ charmcraft build
+ unzip ng-ui.charm -d release
+
[testenv:black]
basepython = python3
deps =