def poll(self, argv): """poll Polls this process object.""" sts = self._obj.poll(self._pid) if sts == -errno.EAGAIN: self._print("running.") elif sts == -errno.ENOENT: self._print("Process disappeared!") raise CLI.CommandQuit(self._pid) else: self._print(sts) self._print("Exited.") raise CLI.CommandQuit(self._pid)
def commit(self, argv): """commit Commit the changes.""" try: _session.commit() except: _session.rollback() ex, val, tb = sys.exc_info() self._ui.error("%s: %s" % (ex, val)) else: raise CLI.CommandQuit()
def chdir(self, argv): """chdir/cd <container> Make <container> the current container.""" name = argv[1] if name == "..": raise CLI.CommandQuit() item = self._get(name) if isinstance(item, dict): cmd = self.clone(ConfigCommands) cmd._setup(item, "%Ykey%N:{}> ".format(name)) raise CLI.NewCommand(cmd) else: self._print("%s: not a container." % (name,))
def chdir(self, argv): """chdir/cd <container> Make <container> the current container.""" name = argv[1] if name == "..": raise CLI.CommandQuit() row = _session.query(models.Config).filter(and_( models.Config.name==name, models.Config.container==self._obj)).one() if row.value is NULL: pathname = ".".join([self._obj.name, row.name]) cmd = self.clone(ConfigCommands) cmd._setup(row, "%%YConfig%%N:%s> " % pathname) raise CLI.NewCommand(cmd) else: self._print("%s: not a container." % (name,))
def commit(self, argv): """commit Commit the new instance.""" _session.add(self._obj) _session.commit() raise CLI.CommandQuit()
def count(self, argv): """count Show the count of the query.""" self._print(self._obj.count()) raise CLI.CommandQuit()
def close(self, argv): """close Close the database.""" self._obj.close() raise CLI.CommandQuit()
def abort(self, argv): """abort Abort this edit, don't commit changes.""" _session.rollback() raise CLI.CommandQuit()
def close(self, argv): """close Close the file object.""" self._obj.fclose(self._handle) raise CLI.CommandQuit(self._handle)
def kill(self, argv): """kill Kills this interactive process.""" es = self._obj.kill(self._pid) self._print(str(es)) raise CLI.CommandQuit(self._pid)