Exemple #1
0
    def _build_command(self, cmd, params, options, remote_target=None):
        root = etree.Element("command",
                             id=str(next(self._cmdindex)),
                             type=cmd,
                             close_on_return="no")
        if remote_target:
            root.attrib["remote_target"] = remote_target

        for k, v in options.items():
            root.append(
                etree.Element("option",
                              name=self._dump_xcli(k),
                              value=self._dump_xcli(v)))
        for k, v in params.items():
            root.append(
                etree.Element("argument",
                              name=self._dump_xcli(k),
                              value=self._dump_xcli(v)))
        data = etree.tostring(root)

        if ("password" in options):
            data = data.decode()
            data.replace(options["password"], "XXX")
            data.encode()

        anon = data

        xlog.debug("SEND %s" % (anon))
        return data
Exemple #2
0
 def __str__(self):
     ret_str = ""
     if isinstance(self.xml, str):
         ret_str = "%s\n\n%s" % (self.status, self.xml)
     else:
         ret_str = "%s\n\n%s" % (etree.tostring(self.xml))
     return ret_str
Exemple #3
0
 def __str__(self):
     ret_str = ""
     if isinstance(self.xml, str):
         ret_str = "%s\n\n%s" % (self.status, self.xml)
     else:
         ret_str = "%s\n\n%s" % (etree.tostring(self.xml))
     return ret_str
Exemple #4
0
    def _build_command(self, cmd, params, options, remote_target=None):
        root = etree.Element("command", id=str(self._cmdindex.next()),
                             type=cmd, close_on_return="no")
        if remote_target:
            root.attrib["remote_target"] = remote_target

        for k, v in options.items():
            root.append(etree.Element("option", name=self._dump_xcli(k),
                                      value=self._dump_xcli(v)))
        for k, v in params.items():
            root.append(etree.Element("argument", name=self._dump_xcli(k),
                                      value=self._dump_xcli(v)))
        data = etree.tostring(root)
        anon = data.replace(options["password"],
                            "XXX") if "password" in options else data
        xlog.debug("SEND %s" % (anon))
        return data
Exemple #5
0
 def __str__(self):
     return etree.tostring(self.response_etree)
Exemple #6
0
 def __str__(self):
     return etree.tostring(self.response_etree)