def __init__(self, inputdevices, event_filter=None): super(InputParserThread, self).__init__() self.logger = log.getLogger(__name__) self.daemon = True self.logger.info("Creating input watcher thread") self.inputdevices = inputdevices self.event_filter = event_filter self.on_event = base.Base.Signal(self)
def log_call(msg, args=[], kwargs={}, masks=[], logfunc=None): logfunc = logfunc or log.getLogger(__name__).debug masks = masks or log_call.masks # Replace masked items if masks: args = ["<masked>" if arg in masks else arg for arg in args] kwargs = dict((key, "<masked>" if v in masks else v) for key, v in kwargs.items()) cmd = "%s %s" % (args, kwargs) return logfunc("%s: %s" % (msg, cmd))
def __init__(self, files): assert type(files) is list self.fds = [os.open(dev, os.O_RDONLY) for dev in files] self.logger = log.getLogger(__name__)
from ovirt.node.utils.fs import File import glob import gudev import os.path import ovirt.node.utils.fs import ovirt.node.utils.process as process import re import socket import struct import shlex """ Some convenience functions related to networking """ LOGGER = log.getLogger(__name__) # # Try to use NM if available # FIXME we need to migrte to GUdev at some poit to make it really work # _nm_client = None try: # pylint: disable-msg=E0611 from gi.repository import NetworkManager, NMClient # @UnresolvedImport # pylint: enable-msg=E0611 NetworkManager _nm_client = NMClient.Client.new() LOGGER.debug("NetworkManager support via GI (fast-path)") except Exception as e: LOGGER.debug("NetworkManager support disabled: " +
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, # MA 02110-1301, USA. A copy of the GNU General Public License is # also available at http://www.gnu.org/copyleft/gpl.html. from ovirt.node import base, exceptions, ui, log from ovirt.node.exceptions import InvalidData """ This contains much stuff related to plugins """ logger = log.getLogger(__name__) class NodePlugin(base.Base): """ Basically a plugin provides a model which is changed by the UI (using the model() method) When the user "saves", the changes are provided to the plugin which can then decide what to do with the changes. Flow: 1. [Start UI] 2. [Change UI] triggers check_changes(), exception leads to UI dialog 3. [Save UI] triggers save_changes(), exception leads to UI dialog
# also available at http://www.gnu.org/copyleft/gpl.html. """ Some convenience functions realted to the filesystem """ from ovirt.node import log from ovirt.node.utils import process, parse_varfile import shutil import os import re import StringIO from ovirt.node import base LOGGER = log.getLogger(__name__) def get_contents(src): """Read the contents of a file Args: src: The file to be read Returns: The contents of src """ with open(src, "r") as f: contents = f.read() return contents