Beispiel #1
0
    def computerUpdate(self, MACAddress):
        """
        Method to update the menu a computer.

        @raise TypeError: if MACAddress is malformed
        @return: a deferred object resulting to 1 if update was
                 successful, else 0.
        @rtype: int
        """
        def onSuccess(result):
            # TODO : add menu re-generation here
            return 1

        if not isMACAddress(MACAddress):
            raise TypeError

        url, credentials = makeURL(PackageServerConfig().mmc_agent)

        self.logger.info('Imaging: Starting menu update for %s' % (MACAddress))
        client = self._getXMLRPCClient()
        func = 'imaging.getMenu'
        args = (MACAddress)
        d = client.callRemote(func, *args)
        d.addCallbacks(onSuccess, client.onError, errbackArgs=(func, args, 0))
        return d
Beispiel #2
0
    def computerUpdate(self, MACAddress):
        """
        Method to update the menu a computer.

        @raise TypeError: if MACAddress is malformed
        @return: a deferred object resulting to 1 if update was
                 successful, else 0.
        @rtype: int
        """

        def onSuccess(result):
            # TODO : add menu re-generation here
            return 1

        if not isMACAddress(MACAddress):
            raise TypeError

        url, credentials = makeURL(PackageServerConfig().mmc_agent)

        self.logger.info('Imaging: Starting menu update for %s' % (MACAddress))
        client = self._getXMLRPCClient()
        func = 'imaging.getMenu'
        args = (MACAddress)
        d = client.callRemote(func, *args)
        d.addCallbacks(onSuccess, client.onError, errbackArgs = (func, args, 0))
        return d
Beispiel #3
0
 def convert2id(self, scheduler):
     self.logger.debug("Looking up scheduler id using: " + str(scheduler))
     ret = None
     if type(scheduler) == dict:
         if "server" in scheduler and "port" in scheduler and scheduler[
                 "server"] and scheduler["port"]:
             (scheduler, credentials) = makeURL(scheduler)
         elif "mountpoint" in scheduler and scheduler["mountpoint"]:
             ret = scheduler["mountpoint"]
     elif type(scheduler) in (str, unicode):
         ret = scheduler
     if not ret:
         #if type(scheduler) in (str, unicode) and scheduler in self.config.scheduler_url2id:
         if type(scheduler) in (
                 str, unicode
         ) and self.config.scheduler_url2id.has_key(scheduler):
             self.logger.debug(
                 "Found scheduler id from MSC config file using this key %s"
                 % scheduler)
             ret = self.config.scheduler_url2id[scheduler]
     if not ret:
         self.logger.debug("Using default scheduler")
         ret = self.config.default_scheduler
     self.logger.debug("Using scheduler '%s'" % ret)
     return ret
Beispiel #4
0
 def _getXMLRPCClient(self):
     """
     @return: a XML-RPC client allowing to connect to the agent
     @rtype: ImagingXMLRPCClient
     """
     url, _ = makeURL(PackageServerConfig().mmc_agent)
     return ImagingXMLRPCClient(
         '', url,
         PackageServerConfig().mmc_agent['verifypeer'],
         PackageServerConfig().mmc_agent['cacert'],
         PackageServerConfig().mmc_agent['localcert'])
Beispiel #5
0
 def _getXMLRPCClient(self):
     """
     @return: a XML-RPC client allowing to connect to the agent
     @rtype: ImagingXMLRPCClient
     """
     url, _ = makeURL(PackageServerConfig().mmc_agent)
     return ImagingXMLRPCClient(
         '',
         url,
         PackageServerConfig().mmc_agent['verifypeer'],
         PackageServerConfig().mmc_agent['cacert'],
         PackageServerConfig().mmc_agent['localcert'])
Beispiel #6
0
def getProxy(schedulerConfig):
    """
    Return a suitable Proxy object to communicate with the scheduler
    """
    (url, credentials) = makeURL(schedulerConfig)

    if url.startswith("http://"):
        ret = twisted.web.xmlrpc.Proxy(url)
    else:
        if schedulerConfig['verifypeer']:
            # We have to build the SSL context to include launcher certificates
            ctx = makeSSLContext(schedulerConfig['verifypeer'], schedulerConfig['cacert'], schedulerConfig['localcert'], False)
            ret = async.Proxy(url)
            ret.setSSLClientContext(ctx)
        else:
            ret = twisted.web.xmlrpc.Proxy(url)
    return ret
Beispiel #7
0
def getProxy(schedulerConfig):
    """
    Return a suitable Proxy object to communicate with the scheduler
    """
    (url, credentials) = makeURL(schedulerConfig)

    if url.startswith("http://"):
        ret = twisted.web.xmlrpc.Proxy(url)
    else:
        if schedulerConfig['verifypeer']:
            # We have to build the SSL context to include launcher certificates
            ctx = makeSSLContext(schedulerConfig['verifypeer'],
                                 schedulerConfig['cacert'],
                                 schedulerConfig['localcert'], False)
            ret = async .Proxy(url)
            ret.setSSLClientContext(ctx)
        else:
            ret = twisted.web.xmlrpc.Proxy(url)
    return ret
Beispiel #8
0
 def convert2id(self, scheduler):
     self.logger.debug("Looking up scheduler id using: " + str(scheduler))
     ret = None
     if type(scheduler) == dict:
         if "server" in scheduler and "port" in scheduler and scheduler["server"] and scheduler["port"]:
             (scheduler, credentials) = makeURL(scheduler)
         elif "mountpoint" in scheduler and scheduler["mountpoint"]:
             ret = scheduler["mountpoint"]
     elif type(scheduler) in (str, unicode):
         ret = scheduler
     if not ret:
         if type(scheduler) in (str, unicode) and self.config.scheduler_url2id.has_key(scheduler):
             self.logger.debug("Found scheduler id from MSC config file using this key %s" % scheduler)
             ret = self.config.scheduler_url2id[scheduler]
     if not ret:
         self.logger.debug("Using default scheduler")
         ret = self.config.default_scheduler
     self.logger.debug("Using scheduler '%s'" % ret)
     return ret
Beispiel #9
0
    def setup(self, conf_file):
        """
        Read the module configuration
        """
        self.disable = self.cp.getboolean("main", "disable")

        if self.cp.has_option("main", "check_db_enable"):
            self.check_db_enable = self.cp.getboolean("main",
                                                      "check_db_enable")
        if self.cp.has_option("main", "check_db_interval"):
            self.check_db_interval = self.cp.getint("main",
                                                    "check_db_interval")

        is_login_and_pass = isTwistedEnoughForLoginPass()

        # folders
        if self.cp.has_option("msc", "qactionspath"):
            self.qactionspath = self.cp.get("msc", "qactionspath")
        if self.cp.has_option("msc", "repopath"):
            self.repopath = self.cp.get("msc", "repopath")

        # IP address blacklists
        if self.cp.has_option("msc", "ignore_non_rfc2780"):
            self.ignore_non_rfc2780 = self.cp.getboolean(
                "msc", "ignore_non_rfc2780")
        if self.cp.has_option("msc", "ignore_non_rfc1918"):
            self.ignore_non_rfc1918 = self.cp.getboolean(
                "msc", "ignore_non_rfc1918")
        if self.cp.has_option("msc", "exclude_ipaddr"):
            self.exclude_ipaddr = self.cp.get("msc", "exclude_ipaddr")
        if self.cp.has_option("msc", "include_ipaddr"):
            self.include_ipaddr = self.cp.get("msc", "include_ipaddr")

        # Host name blacklists
        if self.cp.has_option("msc", "ignore_non_fqdn"):
            self.ignore_non_fqdn = self.cp.getboolean("msc", "ignore_non_fqdn")
        if self.cp.has_option("msc", "ignore_invalid_hostname"):
            self.ignore_invalid_hostname = self.cp.getboolean(
                "msc", "ignore_invalid_hostname")
        if self.cp.has_option("msc", "exclude_hostname"):
            self.exclude_hostname = self.cp.get("msc", "exclude_hostname")
        if self.cp.has_option("msc", "include_hostname"):
            self.include_hostname = self.cp.get("msc", "include_hostname")

        # MAC address blacklist
        if self.cp.has_option("msc", "wol_macaddr_blacklist"):
            self.wol_macaddr_blacklist = self.cp.get("msc",
                                                     "wol_macaddr_blacklist")

        # schedulers
        if self.cp.has_option("msc", "default_scheduler"):
            self.default_scheduler = self.cp.get("msc", "default_scheduler")

        # convergence_reschedule
        if self.cp.has_option("msc", "convergence_reschedule"):
            self.convergence_reschedule = self.cp.get(
                "msc", "convergence_reschedule")

        if self.cp.has_option("msc", "wu_command"):
            self.wu_command = self.cp.get("msc", "wu_command")

        for section in self.cp.sections():
            if re.compile("^scheduler_[0-9]+$").match(section):
                if self.default_scheduler == "":
                    self.default_scheduler = section
                username = self.cp.get(section, "username")
                password = self.cp.getpassword(section, "password")
                if not is_login_and_pass:
                    if username != '':
                        if username != 'username':
                            logging.getLogger().warning(
                                "your version of twisted is not high enough to use login (%s/username)"
                                % (section))
                        username = ''
                    if password != '':
                        if password != 'password':
                            logging.getLogger().warning(
                                "your version of twisted is not high enough to use password (%s/password)"
                                % (section))
                        password = ''

                self.schedulers[section] = {
                    'port': self.cp.get(section, "port"),
                    'host': self.cp.get(section, "host"),
                    'username': username,
                    'password': password,
                    'enablessl': self.cp.getboolean(section, "enablessl"),
                    'verifypeer': False
                }
                if self.schedulers[section]["enablessl"]:
                    if self.cp.has_option(section, "verifypeer"):
                        self.schedulers[section][
                            "verifypeer"] = self.cp.getboolean(
                                section, "verifypeer")
                    if self.cp.has_option(section, "cacert"):
                        self.schedulers[section]["cacert"] = self.cp.get(
                            section, "cacert")
                    if self.cp.has_option(section, "localcert"):
                        self.schedulers[section]["localcert"] = self.cp.get(
                            section, "localcert")
                    if "localcert" in self.schedulers[
                            section] and not os.path.isfile(
                                self.schedulers[section]["localcert"]):
                        raise Exception(
                            'can\'t read SSL key "%s"' %
                            (self.schedulers[section]["localcert"]))
                    if "cacert" in self.schedulers[
                            section] and not os.path.isfile(
                                self.schedulers[section]["cacert"]):
                        raise Exception('can\'t read SSL certificate "%s"' %
                                        (self.schedulers[section]["cacert"]))
                    if "verifypeer" in self.schedulers[
                            section] and self.schedulers[section]["verifypeer"]:
                        import twisted.internet.ssl
                        if not hasattr(twisted.internet.ssl, "Certificate"):
                            raise Exception(
                                'I need at least Python Twisted 2.5 to handle peer checking'
                            )

        # some default web interface values
        if self.cp.has_option("web", "web_def_awake"):
            self.web_def_awake = self.cp.getint("web", "web_def_awake")
        if self.cp.has_option("web", "web_def_date_fmt"):
            self.web_def_date_fmt = self.cp.get("web", "web_def_date_fmt")
        if self.cp.has_option("web", "web_def_inventory"):
            self.web_def_inventory = self.cp.getint("web", "web_def_inventory")
        if self.cp.has_option("web", "web_def_reboot"):
            self.web_def_reboot = self.cp.getint("web", "web_def_reboot")
        if self.cp.has_option("web", "web_def_mode"):
            self.web_def_mode = self.cp.get("web", "web_def_mode")
        if self.cp.has_option("web", "web_force_mode"):
            self.web_force_mode = self.cp.getboolean("web", "web_force_mode")
        if self.cp.has_option("web", "web_def_maxbw"):
            self.web_def_maxbw = self.cp.get("web", "web_def_maxbw")
        if self.cp.has_option("web", "web_def_delay"):
            self.web_def_delay = self.cp.get("web", "web_def_delay")
        if self.cp.has_option("web", "web_def_attempts"):
            self.web_def_attempts = self.cp.get("web", "web_def_attempts")
        if self.cp.has_option("web", "web_show_reboot"):
            self.web_show_reboot = self.cp.getboolean("web", "web_show_reboot")
        if self.cp.has_option("web", "web_dlpath"):
            self.web_dlpath = []
            dlpaths = self.cp.get("web", "web_dlpath")
            for path in dlpaths.split(","):
                self.web_dlpath.append(path.strip())
            if not os.path.exists(self.download_directory_path):
                logging.getLogger().warn(
                    "Plugin MSC: directory %s does not exist, please create it"
                    % self.download_directory_path)

        if self.cp.has_option("web", "web_def_dlmaxbw"):
            self.web_def_dlmaxbw = self.cp.getint("web", "web_def_dlmaxbw")
        if self.cp.has_option("web", "web_def_deployment_intervals"):
            time_intervals = self.cp.get("web", "web_def_deployment_intervals")
            if time_intervals:
                self.web_def_deployment_intervals = time_intervals
            else:
                self.web_def_deployment_intervals = ""
                logging.getLogger().warn(
                    "Plugin MSC: Error parsing option web_def_deployment_intervals !"
                )
        if self.cp.has_option("web", "web_allow_local_proxy"):
            self.web_allow_local_proxy = self.cp.get("web",
                                                     "web_allow_local_proxy")
        if self.cp.has_option("web", "web_def_local_proxy_mode"):
            self.web_def_local_proxy_mode = self.cp.get(
                "web", "web_def_local_proxy_mode")
        if self.cp.has_option("web", "web_def_max_clients_per_proxy"):
            self.web_def_max_clients_per_proxy = self.cp.getint(
                "web", "web_def_max_clients_per_proxy")
        if self.cp.has_option("web", "web_def_proxy_number"):
            self.web_def_proxy_number = self.cp.getint("web",
                                                       "web_def_proxy_number")
        if self.cp.has_option("web", "web_def_proxy_selection_mode"):
            self.web_def_proxy_selection_mode = self.cp.get(
                "web", "web_def_proxy_selection_mode")
        if self.cp.has_option("web", "web_def_refresh_time"):
            self.web_def_refresh_time = self.cp.getint(
                "web", "web_def_refresh_time") * 1000
        if self.cp.has_option("web", "web_def_use_no_vnc"):
            self.web_def_use_no_vnc = self.cp.getint("web",
                                                     "web_def_use_no_vnc")
        if self.cp.has_option("web", "web_def_coh_life_time"):
            self.web_def_coh_life_time = self.cp.getint(
                "web", "web_def_coh_life_time")
        if self.cp.has_option("web", "web_def_attempts_per_day"):
            self.web_def_proxy_selection_mode = self.cp.get(
                "web", "web_def_attempts_per_day")

        # Allow to delete commands and bundles from audit
        if self.cp.has_option("web", "web_def_allow_delete"):
            self.web_def_allow_delete = self.cp.get("web",
                                                    "web_def_allow_delete")

        # VNC stuff
        if self.cp.has_option("web", "vnc_show_icon"):
            self.web_vnc_show_icon = self.cp.getboolean("web", "vnc_show_icon")
        if self.cp.has_option("web", "vnc_view_only"):
            self.web_vnc_view_only = self.cp.getboolean("web", "vnc_view_only")
        if self.cp.has_option("web", "vnc_network_connectivity"):
            self.web_vnc_network_connectivity = self.cp.get(
                "web", "vnc_network_connectivity")
        if self.cp.has_option("web", "vnc_allow_user_control"):
            self.web_vnc_allow_user_control = self.cp.getboolean(
                "web", "vnc_allow_user_control")
        if self.cp.has_option("web", "vnc_port"):
            self.web_vnc_port = self.cp.get("web", "vnc_port")

        if self.cp.has_option("web", "probe_order"):
            self.web_probe_order = self.cp.get("web", "probe_order")
        if self.cp.has_option("web", "probe_order_on_demand"):
            self.web_probe_order_on_demand = self.cp.get(
                "web", "probe_order_on_demand")
        if self.cp.has_option("web", "show_root_commands"):
            self.show_root_commands = self.cp.get("web", "show_root_commands")

        # API Package
        if self.cp.has_option("package_api", "mserver"):
            self.ma_server = self.cp.get("package_api", "mserver")
        if self.cp.has_option("package_api", "mport"):
            self.ma_port = self.cp.get("package_api", "mport")
        if self.cp.has_option("package_api", "mmountpoint"):
            self.ma_mountpoint = self.cp.get("package_api", "mmountpoint")
        if self.cp.has_option("package_api", "username"):
            if not is_login_and_pass:
                logging.getLogger().warning(
                    "your version of twisted is not high enough to use login (package_api/username)"
                )
                self.ma_username = ""
            else:
                self.ma_username = self.cp.get("package_api", "username")
        if self.cp.has_option("package_api", "password"):
            if not is_login_and_pass:
                logging.getLogger().warning(
                    "your version of twisted is not high enough to use password (package_api/password)"
                )
                self.ma_password = ""
            else:
                self.ma_password = self.cp.get("package_api", "password")
        if self.cp.has_option("package_api", "enablessl"):
            self.ma_enablessl = self.cp.getboolean("package_api", "enablessl")
        if self.ma_enablessl:
            if self.cp.has_option("package_api", "verifypeer"):
                self.ma_verifypeer = self.cp.getboolean(
                    "package_api", "verifypeer")
            if self.ma_verifypeer:  # we need twisted.internet.ssl.Certificate to activate certs
                if self.cp.has_option("package_api", "cacert"):
                    self.ma_cacert = self.cp.get("package_api", "cacert")
                if self.cp.has_option("package_api", "localcert"):
                    self.ma_localcert = self.cp.get("package_api", "localcert")
                if not os.path.isfile(self.ma_localcert):
                    raise Exception('can\'t read SSL key "%s"' %
                                    (self.ma_localcert))
                if not os.path.isfile(self.ma_cacert):
                    raise Exception('can\'t read SSL certificate "%s"' %
                                    (self.ma_cacert))
                import twisted.internet.ssl
                if not hasattr(twisted.internet.ssl, "Certificate"):
                    raise Exception(
                        'I need at least Python Twisted 2.5 to handle peer checking'
                    )

        # Scheduler API
        if self.cp.has_section("scheduler_api"):
            self.sa_enable = True
            if self.cp.has_option("scheduler_api", "host"):
                self.sa_server = self.cp.get("scheduler_api", "host")
            if self.cp.has_option("scheduler_api", "port"):
                self.sa_port = self.cp.get("scheduler_api", "port")
            if self.cp.has_option("scheduler_api", "mountpoint"):
                self.sa_mountpoint = self.cp.get("scheduler_api", "mountpoint")
            if self.cp.has_option("scheduler_api", "username"):
                if not is_login_and_pass:
                    logging.getLogger().warning(
                        "your version of twisted is not high enough to use login (scheduler_api/username)"
                    )
                    self.sa_username = ""
                else:
                    self.sa_username = self.cp.get("scheduler_api", "username")
            if self.cp.has_option("scheduler_api", "password"):
                if not is_login_and_pass:
                    logging.getLogger().warning(
                        "your version of twisted is not high enough to use password (scheduler_api/password)"
                    )
                    self.sa_password = ""
                else:
                    self.sa_password = self.cp.get("scheduler_api", "password")
            if self.cp.has_option("scheduler_api", "enablessl"):
                self.sa_enablessl = self.cp.getboolean("scheduler_api",
                                                       "enablessl")
            if self.sa_enablessl:
                if self.cp.has_option("scheduler_api", "verifypeer"):
                    self.sa_verifypeer = self.cp.getboolean(
                        "scheduler_api", "verifypeer")
                if self.sa_verifypeer:  # we need twisted.internet.ssl.Certificate to activate certs
                    if self.cp.has_option("scheduler_api", "cacert"):
                        self.sa_cacert = self.cp.get("scheduler_api", "cacert")
                    if self.cp.has_option("scheduler_api", "localcert"):
                        self.sa_localcert = self.cp.get(
                            "scheduler_api", "localcert")
                    if not os.path.isfile(self.sa_localcert):
                        raise Exception('can\'t read SSL key "%s"' %
                                        (self.sa_localcert))
                    if not os.path.isfile(self.sa_cacert):
                        raise Exception('can\'t read SSL certificate "%s"' %
                                        (self.sa_cacert))
                    import twisted.internet.ssl
                    if not hasattr(twisted.internet.ssl, "Certificate"):
                        raise Exception(
                            'I need at least Python Twisted 2.5 to handle peer checking'
                        )

            self.scheduler_url2id = {}

            for id in self.schedulers:
                (url, credentials) = makeURL(self.schedulers[id])
                self.scheduler_url2id[url] = id
Beispiel #10
0
    def setup(self, conf_file):
        """
        Read the module configuration
        """
        self.disable = self.cp.getboolean("main", "disable")

        is_login_and_pass = isTwistedEnoughForLoginPass()

        # folders
        if self.cp.has_option("msc", "qactionspath"):
            self.qactionspath = self.cp.get("msc", "qactionspath")
        if self.cp.has_option("msc", "repopath"):
            self.repopath = self.cp.get("msc", "repopath")

        # IP address blacklists
        if self.cp.has_option("msc", "ignore_non_rfc2780"):
            self.ignore_non_rfc2780 = self.cp.getboolean("msc", "ignore_non_rfc2780")
        if self.cp.has_option("msc", "ignore_non_rfc1918"):
            self.ignore_non_rfc1918 = self.cp.getboolean("msc", "ignore_non_rfc1918")
        if self.cp.has_option("msc", "exclude_ipaddr"):
            self.exclude_ipaddr = self.cp.get("msc", "exclude_ipaddr")
        if self.cp.has_option("msc", "include_ipaddr"):
            self.include_ipaddr = self.cp.get("msc", "include_ipaddr")

        # Host name blacklists
        if self.cp.has_option("msc", "ignore_non_fqdn"):
            self.ignore_non_fqdn = self.cp.getboolean("msc", "ignore_non_fqdn")
        if self.cp.has_option("msc", "ignore_invalid_hostname"):
            self.ignore_invalid_hostname = self.cp.getboolean("msc", "ignore_invalid_hostname")
        if self.cp.has_option("msc", "exclude_hostname"):
            self.exclude_hostname = self.cp.get("msc", "exclude_hostname")
        if self.cp.has_option("msc", "include_hostname"):
            self.include_hostname = self.cp.get("msc", "include_hostname")

        # MAC address blacklist
        if self.cp.has_option("msc", "wol_macaddr_blacklist"):
            self.wol_macaddr_blacklist = self.cp.get("msc", "wol_macaddr_blacklist")

        # schedulers
        if self.cp.has_option("msc", "default_scheduler"):
            self.default_scheduler = self.cp.get("msc", "default_scheduler")

        for section in self.cp.sections():
            if re.compile("^scheduler_[0-9]+$").match(section):
                if self.default_scheduler == "":
                    self.default_scheduler = section
                username = self.cp.get(section, "username")
                password = self.cp.getpassword(section, "password")
                if not is_login_and_pass:
                    if username != '':
                        if username != 'username':
                            logging.getLogger().warning("your version of twisted is not high enough to use login (%s/username)"%(section))
                        username = ''
                    if password != '':
                        if password != 'password':
                            logging.getLogger().warning("your version of twisted is not high enough to use password (%s/password)"%(section))
                        password = ''

                self.schedulers[section] = {
                        'port': self.cp.get(section, "port"),
                        'host': self.cp.get(section, "host"),
                        'username': username,
                        'password': password,
                        'enablessl': self.cp.getboolean(section, "enablessl"),
                        'verifypeer': False
                    }
                if self.schedulers[section]["enablessl"]:
                    if self.cp.has_option(section, "verifypeer"):
                        self.schedulers[section]["verifypeer"] = self.cp.getboolean(section, "verifypeer")
                    if self.cp.has_option(section, "cacert"):
                        self.schedulers[section]["cacert"] = self.cp.get(section, "cacert")
                    if self.cp.has_option(section, "localcert"):
                        self.schedulers[section]["localcert"] = self.cp.get(section, "localcert")
                    if "localcert" in self.schedulers[section] and not os.path.isfile(self.schedulers[section]["localcert"]):
                        raise Exception('can\'t read SSL key "%s"' % (self.schedulers[section]["localcert"]))
                    if "cacert" in self.schedulers[section] and not os.path.isfile(self.schedulers[section]["cacert"]):
                        raise Exception('can\'t read SSL certificate "%s"' % (self.schedulers[section]["cacert"]))
                    if "verifypeer" in self.schedulers[section] and self.schedulers[section]["verifypeer"]:
                        import twisted.internet.ssl
                        if not hasattr(twisted.internet.ssl, "Certificate"):
                            raise Exception('I need at least Python Twisted 2.5 to handle peer checking')

        # some default web interface values
        if self.cp.has_option("web", "web_def_awake"):
            self.web_def_awake = self.cp.getint("web", "web_def_awake")
        if self.cp.has_option("web", "web_def_date_fmt"):
            self.web_def_date_fmt = self.cp.get("web", "web_def_date_fmt")
        if self.cp.has_option("web", "web_def_inventory"):
            self.web_def_inventory = self.cp.getint("web", "web_def_inventory")
        if self.cp.has_option("web", "web_def_mode"):
            self.web_def_mode = self.cp.get("web", "web_def_mode")
        if self.cp.has_option("web", "web_force_mode"):
            self.web_force_mode = self.cp.getboolean("web", "web_force_mode")
        if self.cp.has_option("web", "web_def_maxbw"):
            self.web_def_maxbw = self.cp.get("web", "web_def_maxbw")
        if self.cp.has_option("web", "web_def_delay"):
            self.web_def_delay = self.cp.get("web", "web_def_delay")
        if self.cp.has_option("web", "web_def_attempts"):
            self.web_def_attempts = self.cp.get("web", "web_def_attempts")
        if self.cp.has_option("web", "web_def_issue_halt_to"):
            self.web_def_issue_halt_to = []
            #p_wdiht = ['done', 'failed', 'over_time', 'out_of_interval']
            p_wdiht = ['done']
            for wdiht in self.cp.get("web", "web_def_issue_halt_to").split(','):
                if wdiht in p_wdiht:
                    self.web_def_issue_halt_to.append(wdiht)
                else:
                    logging.getLogger().warn("Plugin MSC: web_def_issue_halt_to cannot be '%s' (possible choices : %s)"%(wdiht, str(p_wdiht)))
        if self.cp.has_option("web", "web_show_reboot"):
            self.web_show_reboot = self.cp.getboolean("web", "web_show_reboot")
        if self.cp.has_option("web", "web_dlpath"):
            self.web_dlpath = []
            dlpaths = self.cp.get("web", "web_dlpath")
            for path in dlpaths.split(","):
                self.web_dlpath.append(path.strip())
            if not os.path.exists(self.download_directory_path):
                logging.getLogger().warn("Plugin MSC: directory %s does not exist, please create it" % self.download_directory_path)

        if self.cp.has_option("web", "web_def_dlmaxbw"):
            self.web_def_dlmaxbw = self.cp.getint("web", "web_def_dlmaxbw")
        if self.cp.has_option("web", "web_def_deployment_intervals"):
            time_intervals = pulse2.time_intervals.normalizeinterval(self.cp.get("web", "web_def_deployment_intervals"))
            if time_intervals:
                self.web_def_deployment_intervals = time_intervals
            else:
                self.web_def_deployment_intervals = ""
                logging.getLogger().warn("Plugin MSC: Error parsing option web_def_deployment_intervals !")
        if self.cp.has_option("web", "web_allow_local_proxy"):
            self.web_allow_local_proxy = self.cp.get("web", "web_allow_local_proxy")
        if self.cp.has_option("web", "web_def_local_proxy_mode"):
            self.web_def_local_proxy_mode = self.cp.get("web", "web_def_local_proxy_mode")
        if self.cp.has_option("web", "web_def_max_clients_per_proxy"):
            self.web_def_max_clients_per_proxy = self.cp.getint("web", "web_def_max_clients_per_proxy")
        if self.cp.has_option("web", "web_def_proxy_number"):
            self.web_def_proxy_number = self.cp.getint("web", "web_def_proxy_number")
        if self.cp.has_option("web", "web_def_proxy_selection_mode"):
            self.web_def_proxy_selection_mode = self.cp.get("web", "web_def_proxy_selection_mode")

        # VNC stuff
        if self.cp.has_option("web", "vnc_show_icon"):
            self.web_vnc_show_icon = self.cp.getboolean("web", "vnc_show_icon")
        if self.cp.has_option("web", "vnc_view_only"):
            self.web_vnc_view_only = self.cp.getboolean("web", "vnc_view_only")
        if self.cp.has_option("web", "vnc_network_connectivity"):
            self.web_vnc_network_connectivity = self.cp.get("web", "vnc_network_connectivity")
        if self.cp.has_option("web", "vnc_allow_user_control"):
            self.web_vnc_allow_user_control = self.cp.getboolean("web", "vnc_allow_user_control")
        if self.cp.has_option("web", "vnc_port"):
            self.web_vnc_port = self.cp.get("web", "vnc_port")

        if self.cp.has_option("web", "probe_order"):
            self.web_probe_order = self.cp.get("web", "probe_order")

        # API Package
        if self.cp.has_option("package_api", "mserver"):
            self.ma_server = self.cp.get("package_api", "mserver")
        if self.cp.has_option("package_api", "mport"):
            self.ma_port = self.cp.get("package_api", "mport")
        if self.cp.has_option("package_api", "mmountpoint"):
            self.ma_mountpoint = self.cp.get("package_api", "mmountpoint")
        if self.cp.has_option("package_api", "username"):
            if not is_login_and_pass:
                logging.getLogger().warning("your version of twisted is not high enough to use login (package_api/username)")
                self.ma_username = ""
            else:
                self.ma_username = self.cp.get("package_api", "username")
        if self.cp.has_option("package_api", "password"):
            if not is_login_and_pass:
                logging.getLogger().warning("your version of twisted is not high enough to use password (package_api/password)")
                self.ma_password = ""
            else:
                self.ma_password = self.cp.get("package_api", "password")
        if self.cp.has_option("package_api", "enablessl"):
            self.ma_enablessl = self.cp.getboolean("package_api", "enablessl")
        if self.ma_enablessl:
            if self.cp.has_option("package_api", "verifypeer"):
                self.ma_verifypeer = self.cp.getboolean("package_api", "verifypeer")
            if self.ma_verifypeer: # we need twisted.internet.ssl.Certificate to activate certs
                if self.cp.has_option("package_api", "cacert"):
                    self.ma_cacert = self.cp.get("package_api", "cacert")
                if self.cp.has_option("package_api", "localcert"):
                    self.ma_localcert = self.cp.get("package_api", "localcert")
                if not os.path.isfile(self.ma_localcert):
                    raise Exception('can\'t read SSL key "%s"' % (self.ma_localcert))
                if not os.path.isfile(self.ma_cacert):
                    raise Exception('can\'t read SSL certificate "%s"' % (self.ma_cacert))
                import twisted.internet.ssl
                if not hasattr(twisted.internet.ssl, "Certificate"):
                    raise Exception('I need at least Python Twisted 2.5 to handle peer checking')

        # Scheduler API
        if self.cp.has_section("scheduler_api"):
            self.sa_enable = True
            if self.cp.has_option("scheduler_api", "host"):
                self.sa_server = self.cp.get("scheduler_api", "host")
            if self.cp.has_option("scheduler_api", "port"):
                self.sa_port = self.cp.get("scheduler_api", "port")
            if self.cp.has_option("scheduler_api", "mountpoint"):
                self.sa_mountpoint = self.cp.get("scheduler_api", "mountpoint")
            if self.cp.has_option("scheduler_api", "username"):
                if not is_login_and_pass:
                    logging.getLogger().warning("your version of twisted is not high enough to use login (scheduler_api/username)")
                    self.sa_username = ""
                else:
                    self.sa_username = self.cp.get("scheduler_api", "username")
            if self.cp.has_option("scheduler_api", "password"):
                if not is_login_and_pass:
                    logging.getLogger().warning("your version of twisted is not high enough to use password (scheduler_api/password)")
                    self.sa_password = ""
                else:
                    self.sa_password = self.cp.get("scheduler_api", "password")
            if self.cp.has_option("scheduler_api", "enablessl"):
                self.sa_enablessl = self.cp.getboolean("scheduler_api", "enablessl")
            if self.sa_enablessl:
                if self.cp.has_option("scheduler_api", "verifypeer"):
                    self.sa_verifypeer = self.cp.getboolean("scheduler_api", "verifypeer")
                if self.sa_verifypeer: # we need twisted.internet.ssl.Certificate to activate certs
                    if self.cp.has_option("scheduler_api", "cacert"):
                        self.sa_cacert = self.cp.get("scheduler_api", "cacert")
                    if self.cp.has_option("scheduler_api", "localcert"):
                        self.sa_localcert = self.cp.get("scheduler_api", "localcert")
                    if not os.path.isfile(self.sa_localcert):
                        raise Exception('can\'t read SSL key "%s"' % (self.sa_localcert))
                    if not os.path.isfile(self.sa_cacert):
                        raise Exception('can\'t read SSL certificate "%s"' % (self.sa_cacert))
                    import twisted.internet.ssl
                    if not hasattr(twisted.internet.ssl, "Certificate"):
                        raise Exception('I need at least Python Twisted 2.5 to handle peer checking')

            self.scheduler_url2id = {}

            for id in self.schedulers:
                (url, credentials) = makeURL(self.schedulers[id])
                self.scheduler_url2id[url] = id