示例#1
0
    def init(self, core):
        AbstractNuConfComponent.init(self, core)
        self.context = Context.fromComponent(self)
        self.var_dir = self.core.config.get('CORE', 'vardir')
        self.ufwi_conf_var_dir = join(self.var_dir, 'ufwi_conf')
        if self.core.config.getboolean('CORE', 'use_edenwall'):
            warn_dangerous_files(self)
        if not check_and_correct_lo(self):
            self.critical("Networking configuration problem. :-(")

        self.core = core
        self.ethtool = Ethtool('/usr/sbin/ethtool', self)

        if not self.config_loaded:
            self.autoconf()
            self.save_config(
                    CONFIG_AUTOCONFIGURATION,
                    "network : auto configuration",
                    self.context
                    )
        else:
            self.info("not autoconfiguring")

        self.core.notify.connect('ha', 'ImportStart', self.__haImportStart)
        self.core.notify.connect('ha', 'ImportEnd', self.__haImportEnd)
示例#2
0
文件: tools.py 项目: maximerobin/Ufwi
 def checkServiceCall(self, context, service_name):
     if 'rebootSystem' == service_name \
     and context.isComponentContext() \
     and 'config' == context.component.name:
         # config component doesn't need a lock to reboot the system
         return
     AbstractNuConfComponent.checkServiceCall(self, context, service_name)
示例#3
0
    def checkServiceCall(self, context, service_name):
        """Allow each component to call their reload, restart, start and stop services"""
        if (context.isComponentContext() and context.ownerString() == self.NAME
          and service_name in ['reload', 'restart', 'start', 'status', 'stop']):
            return

        AbstractNuConfComponent.checkServiceCall(self, context, service_name)
示例#4
0
 def __init__(self):
     AbstractNuConfComponent.__init__(self)
     self.config_loaded = False
     self.var_dir = None
     self.ufwi_conf_var_dir = None
     self.context = None
     self.__during_ha_import = False
     self.__config_before_ha_import = None
示例#5
0
 def init(self, core):
     AbstractNuConfComponent.init(self, core)
     self.body_template = self.read_body_template()
     for genfile in (
         GENFILE_ALIASES,
         GENFILE_EMAIL_ADDRESSES
         ):
         self.addConfFile(genfile, 'root:root', '0644')
示例#6
0
    def init(self, core):
        AbstractNuConfComponent.init(self, core)
        self.core = core

        # dict: service name => port list
        self.services = None

        # Read streaming port from the config
        port = core.config.getint('CORE', 'streaming_udp_port')
        self.HARDCODED_SERVICES['ufwi_rpcd_access'][1]['port'] = port
示例#7
0
 def init(self, core):
     AbstractNuConfComponent.init(self, core)
     self.core = core
     self.license_dir = DEFAULT_LICENSE_DIR
     self.gpg_homedir = DEFAULT_LICENSE_GPG_DIR
     try:
         self.license_dir = self.core.config.get('license', 'license_dir')
         self.gpg_homedir = self.core.config.get('license', 'gpg_homedir')
     except Exception, err:
         self.error("Missing or incorrect 'license' configuration in /etc "
                    "Rpcd configuration file (%s)." %
                    exceptionAsUnicode(err))
示例#8
0
 def checkServiceCall(self, context, service_name):
     if 'sendMailToAdmin' == service_name:
         # lock is not needed when sending an email
         return
     return AbstractNuConfComponent.checkServiceCall(self, context, service_name)
示例#9
0
 def __init__(self):
     AbstractNuConfComponent.__init__(self)
     self.config = None
示例#10
0
 def __init__(self):
     AbstractNuConfComponent.__init__(self)
     self.states = VariablesStore()
     self.registered_for_mail = SupervisorMail()
     self.purging = False
示例#11
0
 def __init__(self):
     AbstractNuConfComponent.__init__(self)
     self.values = {}
示例#12
0
 def init(self, core):
     AbstractNuConfComponent.init(self, core)
     # do not place this as a static declaration, this will be overidden by others
     if not os.path.exists(self.get_initscript()):
         raise RpcdError(tr("The %s initialization script is not present"), self.get_initscript())