diff --git a/letsencrypt/client/storage.py b/letsencrypt/client/storage.py index 218b0e6a9..6f1f96199 100644 --- a/letsencrypt/client/storage.py +++ b/letsencrypt/client/storage.py @@ -35,29 +35,19 @@ class RenewableCert(object): # pylint: disable=too-many-instance-attributes associated renewal configuration file.""" def __init__(self, configfile, defaults=DEFAULTS): - if isinstance(configfile, str): - if not os.path.exists(configfile): - raise ValueError( - "renewal config file {0} doesn't exist".format(configfile)) - if not configfile.endswith(".conf"): + if isinstance(configfile, configobj.ConfigObj): + if not os.path.basename(configfile.filename).endswith(".conf"): raise ValueError("renewal config file name must end in .conf") - self.lineagename = os.path.basename(configfile)[:-5] - self.configfilename = os.path.basename(configfile) - elif isinstance(configfile, configobj.ConfigObj): self.lineagename = os.path.basename(configfile.filename)[:-5] - self.configfilename = os.path.basename(configfile.filename) - if not self.configfilename.endswith(".conf"): - raise ValueError("renewal config file name must end in .conf") else: - raise TypeError("RenewableCert config must be file path " - "or ConfigObj object") + raise TypeError("RenewableCert config must be ConfigObj object") # self.configuration should be used to read parameters that # may have been chosen based on default values from the # systemwide renewal configuration; self.configfile should be # used to make and save changes. + self.configfile = configfile self.configuration = copy.deepcopy(defaults) - self.configfile = configobj.ConfigObj(configfile) self.configuration.merge(self.configfile) if not all(self.configuration.has_key(x) for x in ALL_FOUR): diff --git a/letsencrypt/client/tests/renewer_test.py b/letsencrypt/client/tests/renewer_test.py index c08c7dc74..43854c281 100644 --- a/letsencrypt/client/tests/renewer_test.py +++ b/letsencrypt/client/tests/renewer_test.py @@ -73,14 +73,6 @@ class RenewableCertTests(unittest.TestCase): config["fullchain"] = "/tmp/fullchain.pem" config.filename = "/tmp/sillyfile" self.assertRaises(ValueError, storage.RenewableCert, config, defaults) - self.assertRaises(ValueError, storage.RenewableCert, "/tmp", defaults) - - def test_renewal_config_filename_exists(self): - """Test that the RenewableCert constructor will complain if - the renewal configuration file doesn't exist.""" - from letsencrypt.client import storage - defaults = configobj.ConfigObj() - self.assertRaises(ValueError, storage.RenewableCert, "XXXXX", defaults) def test_consistent(self): # pylint: disable=too-many-statements oldcert = self.test_rc.cert