Changeset View
Changeset View
Standalone View
Standalone View
pykolab/setup/setup_mta.py
Show First 20 Lines • Show All 237 Lines • ▼ Show 20 Lines | """ % { | ||||
if not os.path.isfile('/etc/postfix/main.cf'): | if not os.path.isfile('/etc/postfix/main.cf'): | ||||
if os.path.isfile('/usr/share/postfix/main.cf.debian'): | if os.path.isfile('/usr/share/postfix/main.cf.debian'): | ||||
shutil.copy( | shutil.copy( | ||||
'/usr/share/postfix/main.cf.debian', | '/usr/share/postfix/main.cf.debian', | ||||
'/etc/postfix/main.cf' | '/etc/postfix/main.cf' | ||||
) | ) | ||||
if not os.path.isdir('/etc/postfix/ldap'): | if not os.path.isdir('/etc/postfix/ldap'): | ||||
os.mkdir('/etc/postfix/ldap/', 0770) | os.mkdir('/etc/postfix/ldap/', 0o770) | ||||
for filename in files.keys(): | for filename in files: | ||||
fp = open(filename, 'w') | fp = open(filename, 'w') | ||||
fp.write(files[filename]) | fp.write(files[filename]) | ||||
fp.close() | fp.close() | ||||
fp = open('/etc/postfix/transport', 'a') | fp = open('/etc/postfix/transport', 'a') | ||||
fp.write("\n# Shared Folder Delivery for %(domain)s:\nshared@%(domain)s\t\tlmtp:unix:/var/lib/imap/socket/lmtp\n" % {'domain': conf.get('kolab', 'primary_domain')}) | fp.write("\n# Shared Folder Delivery for %(domain)s:\nshared@%(domain)s\t\tlmtp:unix:/var/lib/imap/socket/lmtp\n" % {'domain': conf.get('kolab', 'primary_domain')}) | ||||
fp.close() | fp.close() | ||||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | for hc_file in [ 'inbound', 'internal', 'submission' ]: | ||||
shutil.copy(input_file, "/etc/postfix/header_checks.%s" % (hc_file)) | shutil.copy(input_file, "/etc/postfix/header_checks.%s" % (hc_file)) | ||||
subprocess.call(["postmap", "/etc/postfix/header_checks.%s" % (hc_file)]) | subprocess.call(["postmap", "/etc/postfix/header_checks.%s" % (hc_file)]) | ||||
myaugeas = Augeas() | myaugeas = Augeas() | ||||
setting_base = '/files/etc/postfix/main.cf/' | setting_base = '/files/etc/postfix/main.cf/' | ||||
for setting_key in postfix_main_settings.keys(): | for setting_key in postfix_main_settings: | ||||
setting = os.path.join(setting_base,setting_key) | setting = os.path.join(setting_base,setting_key) | ||||
current_value = myaugeas.get(setting) | current_value = myaugeas.get(setting) | ||||
if current_value == None: | if current_value == None: | ||||
try: | try: | ||||
myaugeas.set(setting, postfix_main_settings[setting_key]) | myaugeas.set(setting, postfix_main_settings[setting_key]) | ||||
except: | except: | ||||
insert_paths = myaugeas.match('/files/etc/postfix/main.cf/*') | insert_paths = myaugeas.match('/files/etc/postfix/main.cf/*') | ||||
▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | if os.path.isfile(amavis_conf): | ||||
if not template_file == None: | if not template_file == None: | ||||
fp = open(template_file, 'r') | fp = open(template_file, 'r') | ||||
template_definition = fp.read() | template_definition = fp.read() | ||||
fp.close() | fp.close() | ||||
if os.path.isfile('/etc/clamd.d/amavisd.conf'): | if os.path.isfile('/etc/clamd.d/amavisd.conf'): | ||||
amavisdconf_content = file('/etc/clamd.d/amavisd.conf') | amavisdconf_content = file('/etc/clamd.d/amavisd.conf') | ||||
for line in amavisdconf_content: | for line in amavisdconf_content: | ||||
if line.startswith('LocalSocket'): | if line.startswith('LocalSocket'): | ||||
Lint: PEP8 E111: indentation is not a multiple of four | |||||
amavisd_settings['clamdsock'] = line[len('LocalSocket '):].strip() | amavisd_settings['clamdsock'] = line[len('LocalSocket '):].strip() | ||||
Lint: PEP8 E111 indentation is not a multiple of four Lint: PEP8 E111: indentation is not a multiple of four | |||||
t = Template(template_definition, searchList=[amavisd_settings]) | t = Template(template_definition, searchList=[amavisd_settings]) | ||||
fp = None | fp = None | ||||
fp = open(amavis_conf, 'w') | fp = open(amavis_conf, 'w') | ||||
if not fp == None: | if not fp == None: | ||||
fp.write(t.__str__()) | fp.write(t.__str__()) | ||||
▲ Show 20 Lines • Show All 128 Lines • Show Last 20 Lines |
indentation is not a multiple of four