Coverage for janitoo.options : 79%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# -*- coding: utf-8 -*-
A thread that handle a bus, ... ie i2e, onewire,
It also handle the controller for the janitoo protocol
How do what :
The tread : - hold the mqttc - ask the nodeman to boot : - get an HADD for the controller - get configuration for the controller and start the i2c bus, the onewire bus, ..... - get an HADD for each nodes - get configuration of the node and start it : ie the lcd03 of i2c, the cpu of the rapsy, ...
Reloading configration: - inside the run loop of the thread so need to kill it and re-create a new one : only possible in the server. The server (=the rapsy server) can do it but it should be accessible on mqtt. """
This file is part of Janitoo.
Janitoo is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Janitoo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Janitoo. If not, see <http://www.gnu.org/licenses/>.
"""
# Set default logging handler to avoid "No handler found" warnings.
#We must NOT subsitute % in value for alembic (database section)
"""The options
:param options: The options used to start the worker. :type clientid: str """ #retrieve parameters in file else:
"""Load system section from file
:param options: The options used to start the worker. :type clientid: str """ #retrieve parameters in file self.data.update(system)
"""Retrieve options from a section """ #~ print self.data['conf_file'] #~ print "section ", section, " in cache", section in self._cache #~ print "data ", self.data #~ print "items ", config.items(section) #~ print self._cache[section]
"""Retrieve options from a section """ #print self.data['conf_file'] if default is None: self._cache[section][key] = opt return self._cache[section][key] else: if type(default) == type(0): try: self._cache[section][key] = int(opt) return self._cache[section][key] except: logger.exception("[%s] - Exception when converting option to integer : [%s] %s = %s", self.__class__.__name__, section, key, opt) return None elif type(default) == type(0.0): try: self._cache[section][key] = float(opt) return self._cache[section][key] except: logger.exception("[%s] - Exception when converting option to float : [%s] %s = %s", self.__class__.__name__, section, key, opt) #~ except ValueError: return None
"""Retrieve options from a section """ return False
"""Retrieve options from a section """ #print self.data['conf_file'] return False
"""Retrieve options from a section """ #print self.data['conf_file'] if 'conf_file' in self.data and self.data['conf_file'] is not None: config = RawConfigParser() config.read([self.data['conf_file']]) for key in data: config.remove_option(section, key) if section in self._cache and key in self._cache[section]: del self._cache[section][key] with open(self.data['conf_file'], 'wb') as configfile: config.write(configfile) return False
"""Remove a n entire section """ #print self.data['conf_file'] return False
"""Retrieve options which started with a key from a section """ #print self.data['conf_file']
"""Retrieve settings from a section """ return self.get_options_key(section, "settings.")
"""Retrieve component's configuration from a section """
"""Retrieve auto_start option from a section """ #print self.data['conf_file']
"""Convert a string to bool """ |