Loading magma/hackfest_squid_cnf/charms/squid/metadata.yaml +4 −7 Original line number Diff line number Diff line Loading @@ -10,6 +10,9 @@ tags: - misc series: - kubernetes deployment: type: stateful service: loadbalancer storage: docker: type: filesystem Loading @@ -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 magma/hackfest_squid_cnf/charms/squid/src/charm.py +0 −24 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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") Loading @@ -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) Loading
magma/hackfest_squid_cnf/charms/squid/metadata.yaml +4 −7 Original line number Diff line number Diff line Loading @@ -10,6 +10,9 @@ tags: - misc series: - kubernetes deployment: type: stateful service: loadbalancer storage: docker: type: filesystem Loading @@ -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
magma/hackfest_squid_cnf/charms/squid/src/charm.py +0 −24 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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") Loading @@ -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)