def savehostvarname(doc, node, name, vname): """Save variable name as children with host and variable name""" vn = doc.createElement(name) parts = vname.split(':', 1) if len(parts) > 1: xmlutil.save_xml_string(doc, vn, "host", parts.pop(0)) xmlutil.save_xml_string(doc, vn, "name", parts.pop()) node.appendChild(vn)
def save(self, doc, pnode, name): """Save constant value to XML DOM""" if not self.isdef: return cn = doc.createElement(name) if self.isint: xmlutil.save_xml_string(doc, cn, "intval", str(self.value)) else: xmlutil.save_xml_string(doc, cn, "textval", self.value) pnode.appendChild(cn)
def save(self, doc, pnode, name): """Save assignment to XML DOM""" if not self.isvalid(): return an = doc.createElement(name) an.setAttribute("type", str(self.bja_op)) xmlutil.save_xml_bool(doc, an, "iscrit", self.bja_iscrit) savehostvarname(doc, an, "vname", self.toname()) if self.bja_op < jass.BJA_SEXIT: self.bja_con.save(doc, an, "const") xmlutil.save_xml_string(doc, an, "flags", self.bja_flags) pnode.appendChild(an)
def save(self, doc, pnode, name): """Save list to XML file""" sl = doc.createElement(name) pnode.appendChild(sl) xmlutil.save_xml_string(doc, sl, "lahost", self.lahost) xmlutil.save_xml_string(doc, sl, "laport", str(self.laport)) if len(self.serversbyip) != 0: dl = doc.createElement("servers") sl.appendChild(dl) for srv in self.list_servers(): srv.save(doc, dl, "server", self.myhostid)
def save(self, doc, parent, name, myip): """Save state to XML file""" saves = doc.createElement(name) parent.appendChild(saves) if self.namebyip: xmlutil.save_xml_string(doc, saves, "ip", self.servip.ipaddr()) else: xmlutil.save_xml_string(doc, saves, "name", self.servname) if len(self.alias) > 0: saves.setAttribute("alias", self.alias) if self.autoconn: saves.setAttribute("autoconn", "y")
def save(self, doc, pnode, name): """Save variable to XML DOM""" varnode = doc.createElement(name) xmlutil.save_xml_string(doc, varnode, "name", self.var_name) xmlutil.save_xml_string(doc, varnode, "comment", self.var_comment) if self.var_type != 0: xmlutil.save_xml_string(doc, varnode, "type", self.var_type) if self.var_flags != 0: xmlutil.save_xml_string(doc, varnode, "flags", self.var_flags) self.var_value.save(doc, varnode, "value") self.var_mode.save(doc, varnode, "vmode") pnode.appendChild(varnode)
def save(self, doc, pnode, name): """Save permissions to XML DOM""" pm = doc.createElement(name) xmlutil.save_xml_string(doc, pm, "uperm", self.u_flags) xmlutil.save_xml_string(doc, pm, "gperm", self.g_flags) xmlutil.save_xml_string(doc, pm, "operm", self.o_flags) pnode.appendChild(pm)
def save(self, doc, pnode, name): """Save redirection to XML DOM""" rd = doc.createElement(name) rd.setAttribute("type", str(self.action)) xmlutil.save_xml_string(doc, rd, "fd", self.fd) if self.action < redir.RD_ACT_CLOSE: xmlutil.save_xml_string(doc, rd, "file", self.filename) elif self.action == rdeir.RD_ACT_DUP: xmlutil.save_xml_string(doc, rd, "fd2", self.fd2) pnode.appendChild(rd)
def save(self, doc, pnode, name): """Output options to XML file""" saved = doc.createElement(name) pnode.appendChild(saved) xmlutil.save_xml_bool(doc, saved, "inclnull", self.inclnull) if len(self.limuser) != 0: xmlutil.save_xml_string(doc, saved, "limuser", self.limuser) if len(self.limgroup) != 0: xmlutil.save_xml_string(doc, saved, "limgroup", self.limgroup) if len(self.limqueue) != 0: xmlutil.save_xml_string(doc, saved, "limqueue", self.limqueue)
def save(self, doc, pnode, name): """Save job to XML DOM""" jobnode = doc.createElement(name) xmlutil.save_xml_string(doc, jobnode, "progress", self.bj_progress) xmlutil.save_xml_string(doc, jobnode, "pri", self.bj_pri) xmlutil.save_xml_string(doc, jobnode, "ll", self.bj_ll) xmlutil.save_xml_string(doc, jobnode, "umask", self.bj_umask) if self.bj_ulimit != 0: xmlutil.save_xml_string(doc, jobnode, "ulimit", self.bj_ulimit) xmlutil.save_xml_string(doc, jobnode, "jflags", self.bj_jflags) if len(self.bj_title) != 0: xmlutil.save_xml_string(doc, jobnode, "title", self.bj_title) xmlutil.save_xml_string(doc, jobnode, "direct", self.bj_direct) if self.bj_runtime != 0: xmlutil.save_xml_string(doc, jobnode, "runtime", self.bj_runtime) if self.bj_autoksig != 0 and self.bj_runon != 0: xmlutil.save_xml_string(doc, jobnode, "autoksig", self.bj_autoksig) xmlutil.save_xml_string(doc, jobnode, "runon", self.bj_runon) if self.bj_deltime != 0: xmlutil.save_xml_string(doc, jobnode, "deltime", self.bj_deltime) xmlutil.save_xml_string(doc, jobnode, "cmdinterp", self.bj_cmdinterp) self.bj_mode.save(doc, jobnode, "jmode") self.bj_times.save(doc, jobnode, "times") if len(self.bj_conds) != 0: cl = doc.createElement("conds") jobnode.appendChild(cl) for c in self.bj_conds: c.save(doc, cl, "cond") if len(self.bj_asses) != 0: al = doc.createElement("asses") jobnode.appendChild(al) for a in self.bj_asses: a.save(doc, al, "ass") if len(self.bj_arg) != 0: al = doc.createElement("args") jobnode.appendChild(al) for a in self.bj_arg: xmlutil.save_xml_string(doc, al, "arg", a) if len(self.bj_env) != 0: el = doc.createElement("envs") jobnode.appendChild(el) for e in self.bj_env: e.save(doc, el, "env") if len(self.bj_redirs) != 0: rl = doc.createElement("redirs") jobnode.appendChild(rl) for r in self.bj_redirs: r.save(doc, rl, "redir") self.exitn.save(doc, jobnode, "nexit") self.exite.save(doc, jobnode, "eexit") pnode.appendChild(jobnode)
def save(self, doc, pnode, name): """Save exit codes to XML DOM""" ex = doc.createElement(name) xmlutil.save_xml_string(doc, ex, "l", self.lower) xmlutil.save_xml_string(doc, ex, "u", self.upper) pnode.appendChild(ex)
def save(self, doc, pnode, name): """Save env var to XML DOM""" ev = doc.createElement(name) xmlutil.save_xml_string(doc, ev, "name", self.e_name) xmlutil.save_xml_string(doc, ev, "value", self.e_value) pnode.appendChild(ev)
def save(self, doc, pnode, name): """Save time details to XML file""" savend = doc.createElement(name) pnode.appendChild(savend) if self.tc_istime: savend.setAttribute("timeset", "y") else: savend.setAttribute("timeset", "n") xmlutil.save_xml_string(doc, savend, "nexttime", self.tc_nexttime) xmlutil.save_xml_string(doc, savend, "repeat", self.tc_repeat) xmlutil.save_xml_string(doc, savend, "rate", self.tc_rate) xmlutil.save_xml_string(doc, savend, "mday", self.tc_mday) xmlutil.save_xml_string(doc, savend, "nvaldays", self.tc_nvaldays) xmlutil.save_xml_string(doc, savend, "nposs", self.tc_nposs)