Loading cloudcontrol/server/clients/cli.py +12 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,18 @@ class CliHandler(RegisteredCCHandler): self.client.check('wall') self.server.wall(self.client.login, message) @listed def loadmotd(self): """ Load and return the message of the day. """ return self.server.load_motd() @listed def savemotd(self, motd): """ Save a new message of the day. """ self.server.save_motd(motd) # # VM actions: # Loading cloudcontrol/server/server.py +19 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,8 @@ class CCServer(object): conn_kw=dict(handler=WelcomeHandler(self), on_disconnect='on_disconnect')) self.motd_filename = os.path.join(conf_dir, 'motd') # The jobs manager: self.jobs = JobsManager(self.logger.getChild('jobs'), ServerJobsManagerInterface(self), Loading Loading @@ -241,6 +243,23 @@ class CCServer(object): 'connected' % login) client.shutdown() def save_motd(self, motd): """ Save a new message of the day. """ with open(self.motd_filename, 'w') as fmotd: fmotd.write(motd) def load_motd(self): """ Get the current message of the day. """ try: with open(self.motd_filename) as fmotd: return fmotd.read() except IOError as err: if err.errno == 2: return '' # Return empty MOTD raise def filter(self, tql_response, requester, method): """ Filter the provided TqlResponse object using rules matching the provided requester. Loading Loading
cloudcontrol/server/clients/cli.py +12 −0 Original line number Diff line number Diff line Loading @@ -98,6 +98,18 @@ class CliHandler(RegisteredCCHandler): self.client.check('wall') self.server.wall(self.client.login, message) @listed def loadmotd(self): """ Load and return the message of the day. """ return self.server.load_motd() @listed def savemotd(self, motd): """ Save a new message of the day. """ self.server.save_motd(motd) # # VM actions: # Loading
cloudcontrol/server/server.py +19 −0 Original line number Diff line number Diff line Loading @@ -84,6 +84,8 @@ class CCServer(object): conn_kw=dict(handler=WelcomeHandler(self), on_disconnect='on_disconnect')) self.motd_filename = os.path.join(conf_dir, 'motd') # The jobs manager: self.jobs = JobsManager(self.logger.getChild('jobs'), ServerJobsManagerInterface(self), Loading Loading @@ -241,6 +243,23 @@ class CCServer(object): 'connected' % login) client.shutdown() def save_motd(self, motd): """ Save a new message of the day. """ with open(self.motd_filename, 'w') as fmotd: fmotd.write(motd) def load_motd(self): """ Get the current message of the day. """ try: with open(self.motd_filename) as fmotd: return fmotd.read() except IOError as err: if err.errno == 2: return '' # Return empty MOTD raise def filter(self, tql_response, requester, method): """ Filter the provided TqlResponse object using rules matching the provided requester. Loading