Formatting fixes

This commit is contained in:
James Kasten 2014-12-20 03:43:39 -08:00
parent cc999d3654
commit d7a3ea443c
7 changed files with 10 additions and 14 deletions

View file

@ -480,8 +480,8 @@ class ApacheConfigurator(augeas_configurator.AugeasConfigurator):
ssl_addrs.add(ssl_addr)
# Add directives
vh_p = self.aug.match(("/files%s//* [label()=~regexp('%s')]" %
(ssl_fp, parser.case_i('VirtualHost'))))
vh_p = self.aug.match("/files%s//* [label()=~regexp('%s')]" %
(ssl_fp, parser.case_i('VirtualHost')))
if len(vh_p) != 1:
logging.error("Error: should only be one vhost in %s", avail_fp)
sys.exit(1)

View file

@ -23,8 +23,8 @@ class Addr(object):
return self.tup[0]
def __eq__(self, other):
if type(other) is type(self):
return self.__dict__ == other.__dict__
if isinstance(other, self.__class__):
return self.tup == other.tup
return False
def __hash__(self):

View file

@ -349,7 +349,7 @@ class ApacheParser(object):
# Basic check to see if httpd.conf exists and
# in heirarchy via direct include
# httpd.conf was very common as a user file in Apache 2.2
if (os.path.isfile(self.root + 'httpd.conf') and
if (os.path.isfile(os.path.join(self.root, 'httpd.conf')) and
self.find_dir(
case_i("Include"), case_i("httpd.conf"), root)):
return os.path.join(self.root, 'httpd.conf')

View file

@ -116,7 +116,7 @@ class TwoVhost80Test(unittest.TestCase):
self.assertEqual(ssl_vhost.path,
"/files" + ssl_vhost.filep + "/IfModule/VirtualHost")
self.assertEqual(len(ssl_vhost.addrs), 1)
self.assertTrue(set([obj.Addr.fromstring("*:443")]) == ssl_vhost.addrs)
self.assertEqual(set([obj.Addr.fromstring("*:443")]), ssl_vhost.addrs)
self.assertEqual(ssl_vhost.names, set(["encryption-example.demo"]))
self.assertTrue(ssl_vhost.ssl)
self.assertFalse(ssl_vhost.enabled)

View file

@ -41,7 +41,6 @@ class AddrTest(unittest.TestCase):
addr2b = obj.Addr.fromstring("192.168.1.1:*")
set_b = set([addr1b, addr2b])
self.assertTrue(addr1b in set_a)
self.assertEqual(set_a, set_b)
@ -59,4 +58,4 @@ class VirtualHostTest(unittest.TestCase):
self.assertEqual(vhost1b, self.vhost1)
self.assertEqual(str(vhost1b), str(self.vhost1))
self.assertTrue(vhost1b != 1234)
self.assertNotEqual(vhost1b, 1234)

View file

@ -12,7 +12,7 @@ from letsencrypt.client.apache import parser
from letsencrypt.client.tests import config_util
class BasicParseTests(unittest.TestCase):
class ApacheParserTest(unittest.TestCase):
def setUp(self):
display.set_display(display.FileDisplay(sys.stdout))
@ -55,8 +55,7 @@ class BasicParseTests(unittest.TestCase):
self.assertTrue(matches)
def test_find_dir(self):
test = self.parser.find_dir(
parser.case_i("Listen"), "443")
test = self.parser.find_dir(parser.case_i("Listen"), "443")
# This will only look in enabled hosts
test2 = self.parser.find_dir(
parser.case_i("documentroot"))
@ -65,8 +64,7 @@ class BasicParseTests(unittest.TestCase):
def test_add_dir(self):
aug_default = "/files" + self.parser.loc["default"]
self.parser.add_dir(
aug_default, "AddDirective", "test")
self.parser.add_dir(aug_default, "AddDirective", "test")
self.assertTrue(
self.parser.find_dir("AddDirective", "test", aug_default))

View file

@ -184,7 +184,6 @@ def determine_authenticator():
def determine_installer():
"""Returns a valid installer if one exists."""
try:
print "shouldn't ha;ppppen!!!!!!!!!!!!!!!!!!!"
return configurator.ApacheConfigurator()
except errors.LetsEncryptConfiguratorError:
logging.info("Unable to find a way to install the certificate.")