Ejemplo n.º 1
0
 def _status(self, status, message):
     self._touch()
     os.write(self._stream,
              (("<BSTRAP component='%s' "
                "status='%s' result='%s' "
                "message='%s'/>\n") %
               (deployUtil.escapeXML(str(
                   self._component)), deployUtil.escapeXML(
                       str(status)), deployUtil.escapeXML(str(self._group)),
                deployUtil.escapeXML(str(message)))).encode('utf-8'))
Ejemplo n.º 2
0
 def _status(self, status, message):
     self._touch()
     os.write(
         self._stream,
         (
             ("<BSTRAP component='%s' " "status='%s' result='%s' " "message='%s'/>\n")
             % (
                 deployUtil.escapeXML(str(self._component)),
                 deployUtil.escapeXML(str(status)),
                 deployUtil.escapeXML(str(self._group)),
                 deployUtil.escapeXML(str(message)),
             )
         ).encode("utf-8"),
     )
Ejemplo n.º 3
0
    def _xmlOutput(self, component, status, resultKey, result, msg,
                   test=False):
        """
            Internal: publish results to server and log.
        """
        if test:
            message = "Validate '"
        else:
            message = "<BSTRAP component='"

        message += (
            component +
            "' status='" +
            str(status)
        )
        if resultKey is not None:
            message += ("' " + str(resultKey) + "='" + str(result))

        #Fix xml encoding:
        msg = deployUtil.escapeXML(str(msg))
        message += ("' message='" + msg + "'")

        if not test:
            message += "/>"

        print message
        logging.debug(message)
        sys.stdout.flush()
Ejemplo n.º 4
0
    def _xmlOutput(self,
                   component,
                   status,
                   resultKey,
                   result,
                   msg,
                   test=False):
        """
            Internal: publish results to server and log.
        """
        if test:
            message = "Validate '"
        else:
            message = "<BSTRAP component='"

        message += (component + "' status='" + str(status))
        if resultKey is not None:
            message += ("' " + str(resultKey) + "='" + str(result))

        # Fix xml encoding:
        msg = deployUtil.escapeXML(str(msg))
        message += ("' message='" + msg + "'")

        if not test:
            message += "/>"

        print message
        logging.debug(message)
        sys.stdout.flush()
Ejemplo n.º 5
0
def main():
    """Usage: vds_bootstrap_complete.py  [-c vds_config_str] [-v <ver>] [-V]
              [-g] <random_num> [reboot]"""
    try:
        vds_config_str = None
        #FIXME: these flags are added for near future use
        installVirtualizationService = True
        installGlusterService = False
        opts, args = getopt.getopt(sys.argv[1:], "v:c:Vg")
        for o, v in opts:
            if o == "-v":
                deployUtil.setBootstrapInterfaceVersion(int(v))
            if o == "-c":
                # it should looks like:
                # 'ssl=true;ksm_nice=5;images=/images/irsd' without white
                # spaces in it.
                vds_config_str = v
            if o == "-V":
                installVirtualizationService = False
            if o == "-g":
                installGlusterService = True

        logging.debug("installVirtualizationService = '%s', "
                      "installGlusterService = '%s'" %
                      (installVirtualizationService, installGlusterService))
        rnum = args[0]
    except:
        print main.__doc__
        return False
    try:
        arg = int(args[1])
    except:
        arg = 1

    res = True
    try:
        res = deployUtil.instCert(rnum, VDSM_CONF_FILE)
        if res:
            res = deployUtil.setCoreDumpPath()

        if res:
            res = deployUtil.cleanAll(rnum)

        if res:
            try:
                deployUtil.setVdsConf(vds_config_str, VDSM_CONF_FILE)
                print "<BSTRAP component='VDS Configuration' status='OK'/>"
            except Exception, err:
                res = False
                print "<BSTRAP component='VDS Configuration' status='FAIL'" \
                      " message='%s'/>" % deployUtil.escapeXML(str(err))

        deployUtil.setService("vdsmd", "reconfigure")
Ejemplo n.º 6
0
def main():
    """Usage: vds_bootstrap_complete.py  [-c vds_config_str] [-v <ver>] [-V]
              [-g] <random_num> [reboot]"""
    try:
        vds_config_str = None
        # FIXME: these flags are added for near future use
        installVirtualizationService = True
        installGlusterService = False
        opts, args = getopt.getopt(sys.argv[1:], "v:c:Vg")
        for o, v in opts:
            if o == "-v":
                deployUtil.setBootstrapInterfaceVersion(int(v))
            if o == "-c":
                # it should looks like:
                # 'ssl=true;ksm_nice=5;images=/images/irsd' without white
                # spaces in it.
                vds_config_str = v
            if o == "-V":
                installVirtualizationService = False
            if o == "-g":
                installGlusterService = True

        logging.debug("installVirtualizationService = '%s', "
                      "installGlusterService = '%s'" %
                      (installVirtualizationService, installGlusterService))
        rnum = args[0]
    except:
        print main.__doc__
        return False
    try:
        arg = int(args[1])
    except:
        arg = 1

    res = True
    try:
        res = deployUtil.instCert(rnum, VDSM_CONF_FILE)
        if res:
            res = deployUtil.setCoreDumpPath()

        if res:
            res = deployUtil.cleanAll(rnum)

        if res:
            try:
                deployUtil.setVdsConf(vds_config_str, VDSM_CONF_FILE)
                print "<BSTRAP component='VDS Configuration' status='OK'/>"
            except Exception, err:
                res = False
                print "<BSTRAP component='VDS Configuration' status='FAIL'" \
                      " message='%s'/>" % deployUtil.escapeXML(str(err))

        deployUtil.setService("vdsmd", "reconfigure")