Example #1
0
    def init(self, core):
        Component.init(self, core)
        self.core = core
        vardir = core.config.get('CORE', 'vardir')

        sw_version = self._get_sw_version()

        filename = join(vardir, 'licence.txt')
        try:
            with open(filename, 'r') as fd:
                for line in fd.readlines():
                    split = line.split()
                    key = split[0]
                    try:
                        value = " ".join(split[1:])
                    except IndexError:
                        self.fail("check %s" % filename)
                    self.values[key] = value
        except IOError, err:
            #TODO: reenable this
            #self.fail("could not read %s" % filename)
            #TODO: remove this
            self.values = {
                "sw_version": sw_version,
            }
            if EDENWALL:
                self.values.update(
                    {
                    "client": "Client not specified",
                    "model": "EW4",
                    "type": "EW4",   # For compatibility with old EAS.
                    "hw_version": "4.2.1",
                    "serial": "000000000000000"
                    }
                )
Example #2
0
 def __init__(self):
     self.auth = None
     self.core = None
     Component.__init__(self)
Example #3
0
 def formatServiceArguments(self, service, arguments):
     arguments = list(arguments)
     if service in ('addUser', 'editUser'):
         # Don't log plain text passwords
         arguments[2] = '***'
     return Component.formatServiceArguments(self, service, arguments)
Example #4
0
    fd.write('iface %s %s %s\n' % (interface.system_name, inet_string, method))

def writeConf(netcfg, interfaces_file, ha_status):
    if isinstance(interfaces_file, file):
        f = interfaces_file
        close_f = False
    else:
        close_f = True
        try:
            f = open(interfaces_file, 'w')
        except IOError, err:
            raise NetCfgError(
                'Unable to write the configuration to "%s"! %s',
                interfaces_file, exceptionAsUnicode(err))
    f.write(PREAMBLE)
    f.write("#File generated by EdenWall: %s\n" % Component.timestamp())

    # write lo, no logic involved
    f.write(LO_DEFINITION)

    if netcfg.ethernets:
        f.write(ETHERNET_BANNER)
        ethernets = list(netcfg.iterEthernets())
        ethernets.sort()
        for ethernet in ethernets:
            if isInterfaceSpecified(ethernet, ha_status=ha_status):
                writeEthernet(f, netcfg, ha_status, ethernet)

    if netcfg.bondings:
        f.write(BONDING_BANNER)
        bondings = list(netcfg.iterBondings())
Example #5
0
 def __init__(self):
     Component.__init__(self)
     UseCertificateComponent.__init__(self)
Example #6
0
 def init(self, core):
     Component.init(self, core)
     self.core = core
     self.createSubscriptions()
     self.read_config(None)
Example #7
0
 def __init__(self):
     self.CONFIG_FILES = {}
     self.core = None
     self.TEMPLATE_PATH = None
     Component.__init__(self)