2019-12-30 05:34:34 -05:00
|
|
|
import logging
|
|
|
|
##
|
|
|
|
from lxml import etree
|
|
|
|
##
|
2019-10-30 03:29:12 -04:00
|
|
|
from . import locales
|
2019-12-04 01:48:41 -05:00
|
|
|
from . import console
|
|
|
|
from . import users
|
2019-12-06 22:57:32 -05:00
|
|
|
from . import services
|
2019-12-07 00:16:46 -05:00
|
|
|
|
|
|
|
|
2019-12-30 05:34:34 -05:00
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
2019-12-10 06:59:47 -05:00
|
|
|
class Sys(object):
|
|
|
|
def __init__(self, chroot_base, system_xml):
|
|
|
|
self.xml = system_xml
|
2019-12-30 05:34:34 -05:00
|
|
|
_logger.debug('system_xml: {0}'.format(etree.tostring(self.xml, with_tail = False).decode('utf-8')))
|
2019-12-10 06:59:47 -05:00
|
|
|
self.chroot_base = chroot_base
|
|
|
|
self.locale = locales.Locale(self.chroot_base, self.xml.find('locales'))
|
2019-12-30 05:34:34 -05:00
|
|
|
self.console = console.Console(self.chroot_base, self.xml.find('console'))
|
2019-12-10 06:59:47 -05:00
|
|
|
self.tz = locales.Timezone(self.chroot_base, self.xml.attrib.get('timezone', 'UTC'))
|
|
|
|
self.user = users.UserDB(self.chroot_base, self.xml.find('rootPassword'), self.xml.find('users'))
|
|
|
|
self.services = services.ServiceDB(self.chroot_base, self.xml.find('services'))
|
|
|
|
|
|
|
|
def apply(self):
|
|
|
|
self.locale.writeConf()
|
2019-12-30 05:34:34 -05:00
|
|
|
self.console.writeConf()
|
2019-12-10 06:59:47 -05:00
|
|
|
self.tz.apply()
|
|
|
|
self.user.writeConf()
|
|
|
|
self.services.apply()
|
2019-12-11 04:33:15 -05:00
|
|
|
return(None)
|