diff --git a/magma/hackfest_squid_cnf/charms/squid/metadata.yaml b/magma/hackfest_squid_cnf/charms/squid/metadata.yaml index 30b0d0148b792b693f167c319a303cbe24e23136..aa3bbfa1a1fc888e1e5f0d88b0a05ae8a9ee5900 100644 --- a/magma/hackfest_squid_cnf/charms/squid/metadata.yaml +++ b/magma/hackfest_squid_cnf/charms/squid/metadata.yaml @@ -10,6 +10,9 @@ tags: - misc series: - kubernetes +deployment: + type: stateful + service: loadbalancer storage: docker: type: filesystem @@ -17,10 +20,4 @@ storage: spool: type: filesystem location: /var/spool/squid -# -- example relations, delete if unneeded -#requires: -# db: -# interface: mysql -#provides: -# website: -# interface: http + diff --git a/magma/hackfest_squid_cnf/charms/squid/src/charm.py b/magma/hackfest_squid_cnf/charms/squid/src/charm.py index 6e2eff40c9534c822815c88dea3c5c0955192aab..67383ee8f7b818495f4c6306d8614290d684478a 100755 --- a/magma/hackfest_squid_cnf/charms/squid/src/charm.py +++ b/magma/hackfest_squid_cnf/charms/squid/src/charm.py @@ -65,7 +65,6 @@ class SquidK8SCharm(CharmBase): if not self.state.installed: logging.warning("Config changed called before install complete, deferring event: {}.".format(event.handle)) - self._defer_once(event) return @@ -81,7 +80,6 @@ class SquidK8SCharm(CharmBase): if not self.state.configured: logging.warning("Start called before configuration complete, deferring event: {}".format(event.handle)) - self._defer_once(event) return self.unit.status = MaintenanceStatus("Applying pod spec") @@ -93,28 +91,6 @@ class SquidK8SCharm(CharmBase): self.state.started = True logging.info("Started") - def _defer_once(self, event): - """Defer the given event, but only once.""" - notice_count = 0 - handle = str(event.handle) - - for event_path, _, _ in self.framework._storage.notices(None): - if event_path.startswith(handle.split('[')[0]): - notice_count += 1 - logging.debug("Found event: {} x {}".format(event_path, notice_count)) - - if notice_count > 1: - logging.debug("Not deferring {} notice count of {}".format(handle, notice_count)) - else: - logging.debug("Deferring {} notice count of {}".format(handle, notice_count)) - event.defer() - - def on_addconfig_action(self, event): - """Handle the example_action action.""" - event.log("Hello from the example action.") - event.set_results({"success": "true"}) - - if __name__ == "__main__": from ops.main import main main(SquidK8SCharm)