本文整理汇总了Python中mmc.support.config.PluginConfig.readConf方法的典型用法代码示例。如果您正苦于以下问题:Python PluginConfig.readConf方法的具体用法?Python PluginConfig.readConf怎么用?Python PluginConfig.readConf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mmc.support.config.PluginConfig
的用法示例。
在下文中一共展示了PluginConfig.readConf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: readConf
# 需要导入模块: from mmc.support.config import PluginConfig [as 别名]
# 或者: from mmc.support.config.PluginConfig import readConf [as 别名]
def readConf(self):
"""
Read web section of the imaging plugin configuration file
"""
PluginConfig.readConf(self)
if not self.disabled:
ImagingDatabaseConfig.setup(self, self.conffile)
if self.has_section("web"):
for option in self.options("web"):
# option variable is lowercase
setattr(self, option, self.get("web", option))
setattr(self, "network", "resolv_order")
if not type(self.resolv_order) == type([]):
self.resolv_order = self.resolv_order.split(' ')
if self.has_option("network", "preferred_network"):
self.preferred_network = self.get("network", "preferred_network")
else :
self.preferred_network = ''
try:
self.purge_interval = self.get('main', 'purge_interval')
except (NoOptionError, NoSectionError):
self.purge_interval = '23 0 * * 0'
示例2: readConf
# 需要导入模块: from mmc.support.config import PluginConfig [as 别名]
# 或者: from mmc.support.config.PluginConfig import readConf [as 别名]
def readConf(self):
PluginConfig.readConf(self)
try:
self.samba_prefix = self.get("main", "sambaPrefix")
except NoOptionError:
pass
try:
self.conf_file = self.get("main", "sambaConfFile")
except NoOptionError:
pass
try:
self.db_dir = self.get("main", "sambaDBDir")
except NoOptionError:
pass
self.defaultSharesPath = self.get("main", "defaultSharesPath")
try:
listSharePaths = self.get("main", "authorizedSharePaths")
self.authorizedSharePaths = listSharePaths.replace(' ',
'').split(',')
except NoOptionError:
self.authorizedSharePaths = [self.defaultSharesPath]
示例3: readConf
# 需要导入模块: from mmc.support.config import PluginConfig [as 别名]
# 或者: from mmc.support.config.PluginConfig import readConf [as 别名]
def readConf(self):
logger = logging.getLogger()
PluginConfig.readConf(self)
try: self.vDomainSupport = self.getboolean("main", "vDomainSupport")
except: pass
if self.vDomainSupport:
self.vDomainDN = self.get("main", "vDomainDN")
try: self.vAliasesSupport = self.getboolean("main", "vAliasesSupport")
except: pass
if self.vAliasesSupport:
self.vAliasesDN = self.get("main", "vAliasesDN")
try:
self.zarafa = self.getboolean("main", "zarafa")
except NoOptionError:
pass
try:
self.attrs = dict(self.items("mapping"))
except NoSectionError:
self.attrs = {}
attrs = ["mailalias", "maildrop", "mailenable", "mailbox", "mailuserquota", "mailhost", "mailproxy"]
# validate attribute mapping
for attr, val in self.attrs.copy().items():
if not attr in attrs:
del self.attrs[attr]
logger.error("Can't map attribute %s. Attribute not supported." % attr)
# add all other attributes
for attr in attrs:
if not attr in self.attrs:
self.attrs[attr] = attr
示例4: readConf
# 需要导入模块: from mmc.support.config import PluginConfig [as 别名]
# 或者: from mmc.support.config.PluginConfig import readConf [as 别名]
def readConf(self):
PluginConfig.readConf(self)
DatabaseConfig.setup(self, self.conffile)
#update_command
try:
self.update_commands_cron = self.get(
'main', 'update_commands_cron')
except (NoOptionError, NoSectionError):
self.update_commands_cron = '10 12 * * *'
try:
self.enable_update_commands = int(
self.get('main', 'enable_update_commands'))
except:
self.enable_update_commands = 1
#add_update_description
try:
self.add_update_description_cron = self.get(
'main', 'add_update_description_cron')
except (NoOptionError, NoSectionError):
self.add_update_description_cron = '0 */1 * * *'
try:
self.enable_update_description = int(
self.get('main', 'enable_update_description'))
except:
self.enable_update_description = 1
示例5: readConf
# 需要导入模块: from mmc.support.config import PluginConfig [as 别名]
# 或者: from mmc.support.config.PluginConfig import readConf [as 别名]
def readConf(self):
PluginConfig.readConf(self)
self.pid_path = self.safe_get("main",
"pid_path",
self.pid_path)
self.ssh_path = self.safe_get("main",
"ssh_path",
self.ssh_path)
self.support_url = self.safe_get("main",
"support_url",
self.support_url)
self.support_user = self.safe_get("main",
"support_user",
self.support_user)
self.identify_file = self.safe_get("main",
"identify_file",
self.identify_file)
if not os.path.exists(self.identify_file):
logging.getLogger().warn("File %s don't exists!" % self.identify_file)
self.url = "%[email protected]%s" % (self.support_user, self.support_url)
self.check_pid_delay = int(self.safe_get("main",
"check_pid_delay",
self.check_pid_delay))
self.session_timeout = int(self.safe_get("main",
"session_timeout",
self.session_timeout))
if not os.path.exists(self.install_id_path):
logging.getLogger().warn("File %s don't exists!" % self.install_id_path)
else:
with open(self.install_id_path, "r") as f:
content = f.readlines()
if len(content) > 0:
self.install_uuid = content[0].strip()
self.license_server_url = self.safe_get("main",
"license_server_url",
self.license_server_url)
self.cron_search_for_updates = self.safe_get("main",
"cron_search_for_updates",
self.cron_search_for_updates)
self._cron_randomize()
self.license_tmp_file = self.safe_get("main",
"license_tmp_file",
self.license_tmp_file)
self.country = self.safe_get("main",
"country",
self.country)
示例6: readConf
# 需要导入模块: from mmc.support.config import PluginConfig [as 别名]
# 或者: from mmc.support.config.PluginConfig import readConf [as 别名]
def readConf(self):
"""
Read the configuration file using the ConfigParser API.
The PluginConfig.readConf reads the "disable" option of the
"main" section.
"""
PluginConfig.readConf(self)
BackuppcDatabaseConfig.setup(self, self.conffile)
self.disable = self.getboolean("main", "disable")
self.tempdir = self.get("main", "tempdir")
示例7: readConf
# 需要导入模块: from mmc.support.config import PluginConfig [as 别名]
# 或者: from mmc.support.config.PluginConfig import readConf [as 别名]
def readConf(self):
"""
Read the module configuration
"""
PluginConfig.readConf(self)
self.disable = self.getboolean("main", "disable")
Pulse2DatabaseConfig.setup(self, self.conffile)
if self.has_option("main", "location"):
self.location = self.get("main", "location")
示例8: readConf
# 需要导入模块: from mmc.support.config import PluginConfig [as 别名]
# 或者: from mmc.support.config.PluginConfig import readConf [as 别名]
def readConf(self):
PluginConfig.readConf(self)
self.journalctl_path = self.get('main', 'journalctl_path')
self.services = {}
for plugin, services in self.items('plugins'):
self.services[plugin] = services.split(",")
try:
self.blacklist = self.get('main', 'blacklist').split(',')
except:
self.blacklist = []
示例9: readConf
# 需要导入模块: from mmc.support.config import PluginConfig [as 别名]
# 或者: from mmc.support.config.PluginConfig import readConf [as 别名]
def readConf(self):
"""
Read web section of the imaging plugin configuration file
"""
PluginConfig.readConf(self)
if not self.disabled:
ImagingDatabaseConfig.setup(self, self.conffile)
if self.has_section("web"):
for option in self.options("web"):
# option variable is lowercase
setattr(self, option, self.get("web", option))
示例10: readConf
# 需要导入模块: from mmc.support.config import PluginConfig [as 别名]
# 或者: from mmc.support.config.PluginConfig import readConf [as 别名]
def readConf(self):
PluginConfig.readConf(self)
try: self.diskquotaenable = self.getboolean("diskquota", "enable")
except: pass
try: self.networkquotaenable = self.getboolean("networkquota", "enable")
except: pass
self.devicemap = self.get("diskquota", "devicemap").split(',')
self.inodesperblock = self.getfloat("diskquota", "inodesperblock")
self.softquotablocks = self.getfloat("diskquota", "softquotablocks")
self.softquotainodes = self.getfloat("diskquota", "softquotainodes")
self.setquotascript = self.get("diskquota", "setquotascript")
self.delquotascript = self.get("diskquota", "delquotascript")
self.runquotascript = self.get("diskquota", "runquotascript")
self.networkmap = self.get("networkquota", "networkmap").split(',')
示例11: readConf
# 需要导入模块: from mmc.support.config import PluginConfig [as 别名]
# 或者: from mmc.support.config.PluginConfig import readConf [as 别名]
def readConf(self):
"""
Read the module configuration
"""
PluginConfig.readConf(self)
# API Package
if self.has_option("user_package_api", "server"):
self.upaa_server = self.get("user_package_api", "server")
if self.has_option("user_package_api", "port"):
self.upaa_port = self.get("user_package_api", "port")
if self.has_option("user_package_api", "mountpoint"):
self.upaa_mountpoint = self.get("user_package_api", "mountpoint")
if self.has_option("user_package_api", "username"):
if not isTwistedEnoughForLoginPass():
logging.getLogger().warning("your version of twisted is not high enough to use login (user_package_api/username)")
self.upaa_username = ""
else:
self.upaa_username = self.get("user_package_api", "username")
if self.has_option("user_package_api", "password"):
if not isTwistedEnoughForLoginPass():
logging.getLogger().warning("your version of twisted is not high enough to use password (user_package_api/password)")
self.upaa_password = ""
else:
self.upaa_password = self.get("user_package_api", "password")
if self.has_option("user_package_api", "tmp_dir"):
self.tmp_dir = self.get("user_package_api", "tmp_dir")
if self.has_option("user_package_api", "enablessl"):
self.upaa_enablessl = self.getboolean("user_package_api", "enablessl")
if self.upaa_enablessl:
if self.has_option("user_package_api", "verifypeer"):
self.upaa_verifypeer = self.getboolean("user_package_api", "verifypeer")
if self.upaa_verifypeer: # we need twisted.internet.ssl.Certificate to activate certs
if self.has_option("user_package_api", "cacert"):
self.upaa_cacert = self.get("user_package_api", "cacert")
if self.has_option("user_package_api", "localcert"):
self.upaa_localcert = self.get("user_package_api", "localcert")
if not os.path.isfile(self.upaa_localcert):
raise Exception('can\'t read SSL key "%s"' % (self.upaa_localcert))
if not os.path.isfile(self.upaa_cacert):
raise Exception('can\'t read SSL certificate "%s"' % (self.upaa_cacert))
import twisted.internet.ssl
if not hasattr(twisted.internet.ssl, "Certificate"):
raise Exception('I need at least Python Twisted 2.5 to handle peer checking')
# Appstream settings
if self.has_option("appstream", "url"):
self.appstream_url = self.get("appstream", "url")
示例12: readConf
# 需要导入模块: from mmc.support.config import PluginConfig [as 别名]
# 或者: from mmc.support.config.PluginConfig import readConf [as 别名]
def readConf(self):
PluginConfig.readConf(self)
try: self.host = self.get("ldap", "host")
except (NoSectionError, NoOptionError): self.host = "127.0.0.1"
try: self.root = self.get("ldap", "rootName")
except (NoSectionError, NoOptionError): self.root = "uid=LDAP Admin, ou=System Accounts, dc=localdomain"
self.passw = self.get("ldap", "password")
try: self.userdn = self.get("ldap", "baseUsersDN")
except (NoSectionError, NoOptionError): self.userdn = "ou=People, dc=localdomain"
try: self.groupdn = self.get("ldap", "baseGroupsDN")
except (NoSectionError, NoOptionError): self.groupdn = "ou=Group, dc=localdomain"
示例13: readConf
# 需要导入模块: from mmc.support.config import PluginConfig [as 别名]
# 或者: from mmc.support.config.PluginConfig import readConf [as 别名]
def readConf(self):
PluginConfig.readConf(self)
DatabaseConfig.setup(self, self.conffile)
try:
self.historization = self.get('data', 'historization')
except (NoOptionError, NoSectionError):
self.historization = '15 2 * * *'
try:
self.indicators = self.get('data', 'indicators')
except (NoOptionError, NoSectionError):
self.indicators = 'indicators.xml'
try:
self.updateTemplate = self.get('data', 'updateTemplate')
except (NoOptionError, NoSectionError):
self.updateTemplate = 'default.xml'
示例14: readConf
# 需要导入模块: from mmc.support.config import PluginConfig [as 别名]
# 或者: from mmc.support.config.PluginConfig import readConf [as 别名]
def readConf(self):
PluginConfig.readConf(self)
self.external_zones_names = self.get('main', 'external_zones_names').split(" ")
self.internal_zones_names = self.get('main', 'internal_zones_names').split(" ")
try:
self.path = self.get('main', 'path')
except NoOptionError:
self.path = '/etc/shorewall'
try:
self.macros_path = self.get('main', 'macros_path')
except NoOptionError:
self.macros_path = '/usr/share/shorewall'
try:
self.macros_list = self.get('main', 'macros_list').replace(' ', '').split(',')
except NoOptionError:
self.macros_list = []
示例15: readConf
# 需要导入模块: from mmc.support.config import PluginConfig [as 别名]
# 或者: from mmc.support.config.PluginConfig import readConf [as 别名]
def readConf(self):
"""
Read the configuration file using the ConfigParser API.
"""
PluginConfig.readConf(self)
# Read LDAP Password Policy configuration
self.ppolicyAttributes = {}
self.ppolicydn = self.get("ppolicy", "ppolicyDN")
self.ppolicydefault = self.get("ppolicy", "ppolicyDefault")
self.ppolicydefaultdn = "cn=" + self.ppolicydefault + "," + self.ppolicydn
for attribute in self.items("ppolicyattributes"):
if attribute[1] == "True":
self.ppolicyAttributes[attribute[0]] = True
elif attribute[1] == "False":
self.ppolicyAttributes[attribute[0]] = False
else:
self.ppolicyAttributes[attribute[0]] = attribute[1]