Changeset View
Standalone View
pykolab/setup/setup_roundcube.py
Show All 32 Lines | |||||
from pykolab import utils | from pykolab import utils | ||||
from pykolab.constants import * | from pykolab.constants import * | ||||
from pykolab.translate import _ | from pykolab.translate import _ | ||||
log = pykolab.getLogger('pykolab.setup') | log = pykolab.getLogger('pykolab.setup') | ||||
conf = pykolab.getConf() | conf = pykolab.getConf() | ||||
def __init__(): | def __init__(): | ||||
Lint: PEP8 E302: expected 2 blank lines, found 1 | |||||
components.register('roundcube', execute, description=description(), after=['mysql','ldap']) | components.register('roundcube', execute, description=description(), after=['mysql','ldap']) | ||||
Lint: PEP8 E501 line too long (96 > 79 characters) Lint: PEP8 E501: line too long (96 > 79 characters) | |||||
Lint: PEP8 E231 missing whitespace after ',' Lint: PEP8 E231: missing whitespace after ',' | |||||
def description(): | def description(): | ||||
Lint: PEP8 E302 expected 2 blank lines, found 1 Lint: PEP8 E302: expected 2 blank lines, found 1 | |||||
return _("Setup Roundcube.") | return _("Setup Roundcube.") | ||||
def execute(*args, **kw): | def execute(*args, **kw): | ||||
Lint: PEP8 E302 expected 2 blank lines, found 1 Lint: PEP8 E302: expected 2 blank lines, found 1 | |||||
print >> sys.stderr, utils.multiline_message( | print >> sys.stderr, utils.multiline_message( | ||||
_(""" | _(""" | ||||
Please supply a password for the MySQL user 'roundcube'. | Please supply a password for the MySQL user 'roundcube'. | ||||
This password will be used by the Roundcube webmail | This password will be used by the Roundcube webmail | ||||
interface. | interface. | ||||
""") | """) | ||||
) | ) | ||||
mysql_roundcube_password = utils.ask_question( | mysql_roundcube_password = utils.ask_question( | ||||
_("MySQL roundcube password"), | _("MySQL roundcube password"), | ||||
default=utils.generate_password(), | default=utils.generate_password(), | ||||
password=True, | password=True, | ||||
confirm=True | confirm=True | ||||
) | ) | ||||
conf.mysql_roundcube_password = mysql_roundcube_password | conf.mysql_roundcube_password = mysql_roundcube_password | ||||
rc_settings = { | rc_settings = { | ||||
'des_key': re.sub( | 'des_key': re.sub( | ||||
r'[^a-zA-Z0-9]', | r'[^a-zA-Z0-9]', | ||||
"", | "", | ||||
"%s%s" % ( | "%s%s" % ( | ||||
hashlib.md5("%s" % random.random()).digest().encode("base64"), | hashlib.md5("%s" % random.random()).digest().encode("base64"), | ||||
Lint: PEP8 E501 line too long (90 > 79 characters) Lint: PEP8 E501: line too long (90 > 79 characters) | |||||
hashlib.md5("%s" % random.random()).digest().encode("base64") | hashlib.md5("%s" % random.random()).digest().encode("base64") | ||||
Lint: PEP8 E501 line too long (89 > 79 characters) Lint: PEP8 E501: line too long (89 > 79 characters) | |||||
) | ) | ||||
)[:24], | )[:24], | ||||
'imap_admin_login': conf.get('cyrus-imap', 'admin_login'), | 'imap_admin_login': conf.get('cyrus-imap', 'admin_login'), | ||||
'imap_admin_password': conf.get('cyrus-imap', 'admin_password'), | 'imap_admin_password': conf.get('cyrus-imap', 'admin_password'), | ||||
'ldap_base_dn': conf.get('ldap', 'base_dn'), | 'ldap_base_dn': conf.get('ldap', 'base_dn'), | ||||
'ldap_group_base_dn': conf.get('ldap', 'group_base_dn'), | 'ldap_group_base_dn': conf.get('ldap', 'group_base_dn'), | ||||
'ldap_group_filter': conf.get('ldap', 'group_filter'), | 'ldap_group_filter': conf.get('ldap', 'group_filter'), | ||||
'ldap_ldap_uri': conf.get('ldap', 'ldap_uri'), | 'ldap_ldap_uri': conf.get('ldap', 'ldap_uri'), | ||||
'ldap_resource_base_dn': conf.get('ldap', 'resource_base_dn'), | 'ldap_resource_base_dn': conf.get('ldap', 'resource_base_dn'), | ||||
'ldap_resource_filter': conf.get('ldap', 'resource_filter'), | 'ldap_resource_filter': conf.get('ldap', 'resource_filter'), | ||||
'ldap_service_bind_dn': conf.get('ldap', 'service_bind_dn'), | 'ldap_service_bind_dn': conf.get('ldap', 'service_bind_dn'), | ||||
'ldap_service_bind_pw': conf.get('ldap', 'service_bind_pw'), | 'ldap_service_bind_pw': conf.get('ldap', 'service_bind_pw'), | ||||
'ldap_user_base_dn': conf.get('ldap', 'user_base_dn'), | 'ldap_user_base_dn': conf.get('ldap', 'user_base_dn'), | ||||
'ldap_user_filter': conf.get('ldap', 'user_filter'), | 'ldap_user_filter': conf.get('ldap', 'user_filter'), | ||||
'primary_domain': conf.get('kolab','primary_domain'), | 'primary_domain': conf.get('kolab','primary_domain'), | ||||
Lint: PEP8 E231 missing whitespace after ',' Lint: PEP8 E231: missing whitespace after ',' | |||||
'mysql_uri': 'mysqli://roundcube:%s@localhost/roundcube' % (mysql_roundcube_password), | 'mysql_uri': 'mysqli://roundcube:%s@localhost/roundcube' % (mysql_roundcube_password), | ||||
Lint: PEP8 E501 line too long (98 > 79 characters) Lint: PEP8 E501: line too long (98 > 79 characters) | |||||
'conf': conf | 'conf': conf | ||||
} | } | ||||
rc_paths = [ | rc_paths = [ | ||||
"/usr/share/roundcubemail/", | "/usr/share/roundcubemail/", | ||||
"/usr/share/roundcube/", | "/usr/share/roundcube/", | ||||
"/srv/www/roundcubemail/", | "/srv/www/roundcubemail/", | ||||
"/var/www/roundcubemail/" | "/var/www/roundcubemail/" | ||||
Show All 31 Lines | want_files = [ | ||||
'password.inc.php', | 'password.inc.php', | ||||
'recipient_to_contact.inc.php', | 'recipient_to_contact.inc.php', | ||||
'terms.html', | 'terms.html', | ||||
'terms.inc.php' | 'terms.inc.php' | ||||
] | ] | ||||
for want_file in want_files: | for want_file in want_files: | ||||
template_file = None | template_file = None | ||||
if os.path.isfile('/etc/kolab/templates/roundcubemail/%s.tpl' % (want_file)): | if os.path.isfile('/etc/kolab/templates/roundcubemail/%s.tpl' % (want_file)): | ||||
Lint: PEP8 E501 line too long (85 > 79 characters) Lint: PEP8 E501: line too long (85 > 79 characters) | |||||
template_file = '/etc/kolab/templates/roundcubemail/%s.tpl' % (want_file) | template_file = '/etc/kolab/templates/roundcubemail/%s.tpl' % (want_file) | ||||
Lint: PEP8 E501 line too long (85 > 79 characters) Lint: PEP8 E501: line too long (85 > 79 characters) | |||||
elif os.path.isfile('/usr/share/kolab/templates/roundcubemail/%s.tpl' % (want_file)): | elif os.path.isfile('/usr/share/kolab/templates/roundcubemail/%s.tpl' % (want_file)): | ||||
Lint: PEP8 E501 line too long (93 > 79 characters) Lint: PEP8 E501: line too long (93 > 79 characters) | |||||
template_file = '/usr/share/kolab/templates/roundcubemail/%s.tpl' % (want_file) | template_file = '/usr/share/kolab/templates/roundcubemail/%s.tpl' % (want_file) | ||||
Lint: PEP8 E501 line too long (91 > 79 characters) Lint: PEP8 E501: line too long (91 > 79 characters) | |||||
elif os.path.isfile(os.path.abspath(os.path.join(__file__, '..', '..', '..', 'share', 'templates', 'roundcubemail', '%s.tpl' % (want_file)))): | elif os.path.isfile(os.path.abspath(os.path.join(__file__, '..', '..', '..', 'share', 'templates', 'roundcubemail', '%s.tpl' % (want_file)))): | ||||
Lint: PEP8 E501 line too long (150 > 79 characters) Lint: PEP8 E501: line too long (150 > 79 characters) | |||||
template_file = os.path.abspath(os.path.join(__file__, '..', '..', '..', 'share', 'templates', 'roundcubemail', '%s.tpl' % (want_file))) | template_file = os.path.abspath(os.path.join(__file__, '..', '..', '..', 'share', 'templates', 'roundcubemail', '%s.tpl' % (want_file))) | ||||
Lint: PEP8 E501 line too long (148 > 79 characters) Lint: PEP8 E501: line too long (148 > 79 characters) | |||||
if not template_file == None: | if not template_file == None: | ||||
Lint: PEP8 E711 comparison to None should be 'if cond is None:' Lint: PEP8 E711: comparison to None should be 'if cond is None:' | |||||
log.debug(_("Using template file %r") % (template_file), level=8) | log.debug(_("Using template file %r") % (template_file), level=8) | ||||
fp = open(template_file, 'r') | fp = open(template_file, 'r') | ||||
template_definition = fp.read() | template_definition = fp.read() | ||||
fp.close() | fp.close() | ||||
t = Template(template_definition, searchList=[rc_settings]) | t = Template(template_definition, searchList=[rc_settings]) | ||||
log.debug( | log.debug( | ||||
_("Successfully compiled template %r, writing out to %r") % (template_file, want_file), | _("Successfully compiled template %r, writing out to %r") % (template_file, want_file), | ||||
Lint: PEP8 E501 line too long (107 > 79 characters) Lint: PEP8 E501: line too long (107 > 79 characters) | |||||
level=8 | level=8 | ||||
) | ) | ||||
fp = None | fp = None | ||||
if os.path.isdir('/etc/roundcubemail'): | if os.path.isdir('/etc/roundcubemail'): | ||||
fp = open('/etc/roundcubemail/%s' % (want_file), 'w') | fp = open('/etc/roundcubemail/%s' % (want_file), 'w') | ||||
elif os.path.isdir('/etc/roundcube'): | elif os.path.isdir('/etc/roundcube'): | ||||
fp = open('/etc/roundcube/%s' % (want_file), 'w') | fp = open('/etc/roundcube/%s' % (want_file), 'w') | ||||
if not fp == None: | if not fp == None: | ||||
Lint: PEP8 E711 comparison to None should be 'if cond is None:' Lint: PEP8 E711: comparison to None should be 'if cond is None:' | |||||
fp.write(t.__str__()) | fp.write(t.__str__()) | ||||
fp.close() | fp.close() | ||||
schema_files = [] | schema_files = [] | ||||
for root, directories, filenames in os.walk('/usr/share/doc/'): | for root, directories, filenames in os.walk('/usr/share/doc/'): | ||||
directories.sort() | directories.sort() | ||||
for directory in directories: | for directory in directories: | ||||
if directory.startswith("roundcubemail"): | if directory.startswith("roundcubemail"): | ||||
for nested_root, nested_directories, nested_filenames in os.walk(os.path.join(root, directory)): | for nested_root, nested_directories, nested_filenames in os.walk(os.path.join(root, directory)): | ||||
Lint: PEP8 E501 line too long (112 > 79 characters) Lint: PEP8 E501: line too long (112 > 79 characters) | |||||
for filename in nested_filenames: | for filename in nested_filenames: | ||||
if filename.startswith('mysql.initial') and filename.endswith('.sql'): | if filename.startswith('mysql.initial') and filename.endswith('.sql'): | ||||
Lint: PEP8 E501 line too long (94 > 79 characters) Lint: PEP8 E501: line too long (94 > 79 characters) | |||||
schema_filepath = os.path.join(nested_root,filename) | schema_filepath = os.path.join(nested_root,filename) | ||||
Lint: PEP8 E231 missing whitespace after ',' Lint: PEP8 E231: missing whitespace after ',' | |||||
Lint: PEP8 E501 line too long (80 > 79 characters) Lint: PEP8 E501: line too long (80 > 79 characters) | |||||
if not schema_filepath in schema_files: | if not schema_filepath in schema_files: | ||||
Lint: PEP8 E713 test for membership should be 'not in' Lint: PEP8 E713: test for membership should be 'not in' | |||||
schema_files.append(schema_filepath) | schema_files.append(schema_filepath) | ||||
if len(schema_files) > 0: | if len(schema_files) > 0: | ||||
break | break | ||||
if len(schema_files) > 0: | if len(schema_files) > 0: | ||||
break | break | ||||
for root, directories, filenames in os.walk(rcpath + 'plugins/calendar/drivers/kolab/'): | for root, directories, filenames in os.walk(rcpath + 'plugins/calendar/drivers/kolab/'): | ||||
Lint: PEP8 E501 line too long (92 > 79 characters) Lint: PEP8 E501: line too long (92 > 79 characters) | |||||
for filename in filenames: | for filename in filenames: | ||||
if filename.startswith('mysql') and filename.endswith('.sql'): | if filename.startswith('mysql') and filename.endswith('.sql'): | ||||
schema_filepath = os.path.join(root,filename) | schema_filepath = os.path.join(root,filename) | ||||
Lint: PEP8 E231 missing whitespace after ',' Lint: PEP8 E231: missing whitespace after ',' | |||||
if not schema_filepath in schema_files: | if not schema_filepath in schema_files: | ||||
Lint: PEP8 E713 test for membership should be 'not in' Lint: PEP8 E713: test for membership should be 'not in' | |||||
schema_files.append(schema_filepath) | schema_files.append(schema_filepath) | ||||
for root, directories, filenames in os.walk(rcpath + 'plugins/libkolab/'): | for root, directories, filenames in os.walk(rcpath + 'plugins/libkolab/'): | ||||
for filename in filenames: | for filename in filenames: | ||||
if filename.startswith('mysql') and filename.endswith('.sql'): | if filename.startswith('mysql') and filename.endswith('.sql'): | ||||
schema_filepath = os.path.join(root,filename) | schema_filepath = os.path.join(root,filename) | ||||
Lint: PEP8 E231 missing whitespace after ',' Lint: PEP8 E231: missing whitespace after ',' | |||||
if not schema_filepath in schema_files: | if not schema_filepath in schema_files: | ||||
Lint: PEP8 E713 test for membership should be 'not in' Lint: PEP8 E713: test for membership should be 'not in' | |||||
schema_files.append(schema_filepath) | schema_files.append(schema_filepath) | ||||
schema_files = [] | |||||
for root, directories, filenames in os.walk('/usr/share/doc/'): | for root, directories, filenames in os.walk('/usr/share/doc/'): | ||||
directories.sort() | directories.sort() | ||||
for directory in directories: | for directory in directories: | ||||
if directory.startswith("chwala"): | if directory.startswith("chwala"): | ||||
for nested_root, nested_directories, nested_filenames in os.walk(os.path.join(root, directory)): | for nested_root, nested_directories, nested_filenames in os.walk(os.path.join(root, directory)): | ||||
Lint: PEP8 E501 line too long (112 > 79 characters) Lint: PEP8 E501: line too long (112 > 79 characters) | |||||
for filename in nested_filenames: | for filename in nested_filenames: | ||||
if filename.startswith('mysql.initial') and filename.endswith('.sql'): | if filename.startswith('mysql.initial') and filename.endswith('.sql'): | ||||
Lint: PEP8 E501 line too long (94 > 79 characters) Lint: PEP8 E501: line too long (94 > 79 characters) | |||||
schema_filepath = os.path.join(nested_root,filename) | schema_filepath = os.path.join(nested_root,filename) | ||||
Lint: PEP8 E231 missing whitespace after ',' Lint: PEP8 E231: missing whitespace after ',' | |||||
Lint: PEP8 E501 line too long (80 > 79 characters) Lint: PEP8 E501: line too long (80 > 79 characters) | |||||
if not schema_filepath in schema_files: | if not schema_filepath in schema_files: | ||||
Lint: PEP8 E713 test for membership should be 'not in' Lint: PEP8 E713: test for membership should be 'not in' | |||||
schema_files.append(schema_filepath) | schema_files.append(schema_filepath) | ||||
if len(schema_files) > 0: | if len(schema_files) > 0: | ||||
break | break | ||||
if len(schema_files) > 0: | if len(schema_files) > 0: | ||||
break | break | ||||
if not os.path.isfile('/tmp/kolab-setup-my.cnf'): | if not os.path.isfile('/tmp/kolab-setup-my.cnf'): | ||||
Show All 12 Lines | |||||
password='%s' | password='%s' | ||||
""" % (mysql_root_password) | """ % (mysql_root_password) | ||||
fp = open('/tmp/kolab-setup-my.cnf', 'w') | fp = open('/tmp/kolab-setup-my.cnf', 'w') | ||||
os.chmod('/tmp/kolab-setup-my.cnf', 0600) | os.chmod('/tmp/kolab-setup-my.cnf', 0600) | ||||
fp.write(data) | fp.write(data) | ||||
fp.close() | fp.close() | ||||
p1 = subprocess.Popen(['echo', 'create database roundcube;'], stdout=subprocess.PIPE) | p1 = subprocess.Popen(['echo', 'create database roundcube;'], stdout=subprocess.PIPE) | ||||
Lint: PEP8 E501 line too long (89 > 79 characters) Lint: PEP8 E501: line too long (89 > 79 characters) | |||||
p2 = subprocess.Popen(['mysql', '--defaults-file=/tmp/kolab-setup-my.cnf'], stdin=p1.stdout) | p2 = subprocess.Popen(['mysql', '--defaults-file=/tmp/kolab-setup-my.cnf'], stdin=p1.stdout) | ||||
Lint: PEP8 E501 line too long (96 > 79 characters) Lint: PEP8 E501: line too long (96 > 79 characters) | |||||
p1.stdout.close() | p1.stdout.close() | ||||
p2.communicate() | p2.communicate() | ||||
p1 = subprocess.Popen(['echo', 'GRANT ALL PRIVILEGES ON roundcube.* TO \'roundcube\'@\'localhost\' IDENTIFIED BY \'%s\';' % (mysql_roundcube_password)], stdout=subprocess.PIPE) | p1 = subprocess.Popen(['echo', 'GRANT ALL PRIVILEGES ON roundcube.* TO \'roundcube\'@\'localhost\' IDENTIFIED BY \'%s\';' % (mysql_roundcube_password)], stdout=subprocess.PIPE) | ||||
Lint: PEP8 E501 line too long (180 > 79 characters) Lint: PEP8 E501: line too long (180 > 79 characters) | |||||
p2 = subprocess.Popen(['mysql', '--defaults-file=/tmp/kolab-setup-my.cnf'], stdin=p1.stdout) | p2 = subprocess.Popen(['mysql', '--defaults-file=/tmp/kolab-setup-my.cnf'], stdin=p1.stdout) | ||||
Lint: PEP8 E501 line too long (96 > 79 characters) Lint: PEP8 E501: line too long (96 > 79 characters) | |||||
p1.stdout.close() | p1.stdout.close() | ||||
p2.communicate() | p2.communicate() | ||||
for schema_file in schema_files: | for schema_file in schema_files: | ||||
p1 = subprocess.Popen(['cat', schema_file], stdout=subprocess.PIPE) | p1 = subprocess.Popen(['cat', schema_file], stdout=subprocess.PIPE) | ||||
p2 = subprocess.Popen(['mysql', '--defaults-file=/tmp/kolab-setup-my.cnf', 'roundcube'], stdin=p1.stdout) | p2 = subprocess.Popen(['mysql', '--defaults-file=/tmp/kolab-setup-my.cnf', 'roundcube'], stdin=p1.stdout) | ||||
Lint: PEP8 E501 line too long (113 > 79 characters) Lint: PEP8 E501: line too long (113 > 79 characters) | |||||
p1.stdout.close() | p1.stdout.close() | ||||
p2.communicate() | p2.communicate() | ||||
p1 = subprocess.Popen(['echo', 'FLUSH PRIVILEGES;'], stdout=subprocess.PIPE) | p1 = subprocess.Popen(['echo', 'FLUSH PRIVILEGES;'], stdout=subprocess.PIPE) | ||||
Lint: PEP8 E501 line too long (80 > 79 characters) Lint: PEP8 E501: line too long (80 > 79 characters) | |||||
p2 = subprocess.Popen(['mysql', '--defaults-file=/tmp/kolab-setup-my.cnf'], stdin=p1.stdout) | p2 = subprocess.Popen(['mysql', '--defaults-file=/tmp/kolab-setup-my.cnf'], stdin=p1.stdout) | ||||
Lint: PEP8 E501 line too long (96 > 79 characters) Lint: PEP8 E501: line too long (96 > 79 characters) | |||||
p1.stdout.close() | p1.stdout.close() | ||||
p2.communicate() | p2.communicate() | ||||
time.sleep(2) | time.sleep(2) | ||||
# Find Roundcube configuration that is not readable by the | # Find Roundcube configuration that is not readable by the | ||||
# webserver user/group. | # webserver user/group. | ||||
if os.path.isdir('/etc/roundcubemail/'): | if os.path.isdir('/etc/roundcubemail/'): | ||||
rccpath = "/etc/roundcubemail/" | rccpath = "/etc/roundcubemail/" | ||||
elif os.path.isdir('/etc/roundcube/'): | elif os.path.isdir('/etc/roundcube/'): | ||||
rccpath = "/etc/roundcube" | rccpath = "/etc/roundcube" | ||||
else: | else: | ||||
log.warning(_("Cannot find the configuration directory for roundcube.")) | log.warning(_("Cannot find the configuration directory for roundcube.")) | ||||
Lint: PEP8 E501 line too long (80 > 79 characters) Lint: PEP8 E501: line too long (80 > 79 characters) | |||||
rccpath = None | rccpath = None | ||||
root_uid = 0 | root_uid = 0 | ||||
for webserver_group in [ 'apache', 'www-data', 'www' ]: | for webserver_group in [ 'apache', 'www-data', 'www' ]: | ||||
Lint: PEP8 E201 whitespace after '[' Lint: PEP8 E201: whitespace after '[' | |||||
Lint: PEP8 E202 whitespace before ']' Lint: PEP8 E202: whitespace before ']' | |||||
try: | try: | ||||
(a,b,webserver_gid,c) = grp.getgrnam(webserver_group) | (a,b,webserver_gid,c) = grp.getgrnam(webserver_group) | ||||
Lint: PEP8 E231 missing whitespace after ',' Lint: PEP8 E231: missing whitespace after ',' | |||||
Lint: PEP8 E231 missing whitespace after ',' Lint: PEP8 E231: missing whitespace after ',' | |||||
Lint: PEP8 E231 missing whitespace after ',' Lint: PEP8 E231: missing whitespace after ',' | |||||
break | break | ||||
except Exception, errmsg: | except Exception, errmsg: | ||||
pass | pass | ||||
if not rccpath == None: | if not rccpath == None: | ||||
Lint: PEP8 E711 comparison to None should be 'if cond is None:' Lint: PEP8 E711: comparison to None should be 'if cond is None:' | |||||
for root, directories, filenames in os.walk(rccpath): | for root, directories, filenames in os.walk(rccpath): | ||||
for filename in filenames: | for filename in filenames: | ||||
os.chown(os.path.join(root, filename), root_uid, webserver_gid) | os.chown(os.path.join(root, filename), root_uid, webserver_gid) | ||||
httpservice = 'httpd.service' | httpservice = 'httpd.service' | ||||
if os.path.isfile('/usr/lib/systemd/system/apache2.service'): | if os.path.isfile('/usr/lib/systemd/system/apache2.service'): | ||||
httpservice = 'apache2.service' | httpservice = 'apache2.service' | ||||
if os.path.isfile('/bin/systemctl'): | if os.path.isfile('/bin/systemctl'): | ||||
subprocess.call(['/bin/systemctl', 'restart', httpservice]) | subprocess.call(['/bin/systemctl', 'restart', httpservice]) | ||||
elif os.path.isfile('/sbin/service'): | elif os.path.isfile('/sbin/service'): | ||||
subprocess.call(['/sbin/service', 'httpd', 'restart']) | subprocess.call(['/sbin/service', 'httpd', 'restart']) | ||||
elif os.path.isfile('/usr/sbin/service'): | elif os.path.isfile('/usr/sbin/service'): | ||||
subprocess.call(['/usr/sbin/service','apache2','restart']) | subprocess.call(['/usr/sbin/service','apache2','restart']) | ||||
Lint: PEP8 E231 missing whitespace after ',' Lint: PEP8 E231: missing whitespace after ',' | |||||
Lint: PEP8 E231 missing whitespace after ',' Lint: PEP8 E231: missing whitespace after ',' | |||||
else: | else: | ||||
log.error(_("Could not start the webserver server service.")) | log.error(_("Could not start the webserver server service.")) | ||||
if os.path.isfile('/bin/systemctl'): | if os.path.isfile('/bin/systemctl'): | ||||
subprocess.call(['/bin/systemctl', 'enable', httpservice]) | subprocess.call(['/bin/systemctl', 'enable', httpservice]) | ||||
elif os.path.isfile('/sbin/chkconfig'): | elif os.path.isfile('/sbin/chkconfig'): | ||||
subprocess.call(['/sbin/chkconfig', 'httpd', 'on']) | subprocess.call(['/sbin/chkconfig', 'httpd', 'on']) | ||||
elif os.path.isfile('/usr/sbin/update-rc.d'): | elif os.path.isfile('/usr/sbin/update-rc.d'): | ||||
subprocess.call(['/usr/sbin/update-rc.d', 'apache2', 'defaults']) | subprocess.call(['/usr/sbin/update-rc.d', 'apache2', 'defaults']) | ||||
else: | else: | ||||
log.error(_("Could not configure to start on boot, the " + \ | log.error(_("Could not configure to start on boot, the " + \ | ||||
Lint: PEP8 E502 the backslash is redundant between brackets Lint: PEP8 E502: the backslash is redundant between brackets | |||||
"webserver server service.")) | "webserver server service.")) | ||||
Lint: PEP8 E128 continuation line under-indented for visual indent Lint: PEP8 E128: continuation line under-indented for visual indent | |||||
expected 2 blank lines, found 1