Diaspora: Update domain name in Apache config

This commit is contained in:
Joseph Nuthalpati 2017-07-18 14:17:07 +05:30 committed by James Valleroy
parent 276dac2df2
commit b109507e0a
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -21,6 +21,7 @@ Configuration helper for diaspora* pod.
"""
import argparse
import augeas
import subprocess
from plinth import action_utils
@ -62,7 +63,6 @@ def set_domain_name(domain_name):
# This did not set the domain_name
# action_utils.dpkg_reconfigure('diaspora-common',
# {'url': domain_name})
# Manually changing the domain name in the conf files.
conf_file = '/etc/diaspora.conf'
with open(conf_file, 'r') as conf:
@ -78,6 +78,17 @@ def set_domain_name(domain_name):
with open(conf_file, 'w') as conf:
conf.write("\n".join(env_vars))
aug = augeas.Augeas(flags=augeas.Augeas.NO_LOAD +
augeas.Augeas.NO_MODL_AUTOLOAD)
aug.set('/augeas/load/Httpd/lens', 'Httpd.lns')
aug.set('/augeas/load/Httpd/incl[last() + 1]',
'/etc/apache2/conf-available/*')
aug.load()
aug.set('/files/etc/apache2/conf-available/diaspora-plinth.conf/VirtualHost/arg', domain_name)
aug.set("/files/etc/apache2/conf-available/diaspora-plinth.conf/VirtualHost/directive[1]/arg", domain_name)
aug.save()
action_utils.service_start('diaspora')