Add interactive flag to should_auto{renew,deploy}

This commit is contained in:
Seth Schoen
2015-12-11 22:02:46 -08:00
parent 8e36115f4a
commit 8fdff540b5
+12 -4
View File
@@ -471,7 +471,7 @@ class RenewableCert(object): # pylint: disable=too-many-instance-attributes
return ("autodeploy" not in self.configuration or return ("autodeploy" not in self.configuration or
self.configuration.as_bool("autodeploy")) self.configuration.as_bool("autodeploy"))
def should_autodeploy(self): def should_autodeploy(self, interactive=False):
"""Should this lineage now automatically deploy a newer version? """Should this lineage now automatically deploy a newer version?
This is a policy question and does not only depend on whether This is a policy question and does not only depend on whether
@@ -480,12 +480,16 @@ class RenewableCert(object): # pylint: disable=too-many-instance-attributes
exists, and whether the time interval for autodeployment has exists, and whether the time interval for autodeployment has
been reached.) been reached.)
:param bool interactive: set to True to examine the question
regardless of whether the renewal configuration allows
automated deployment (for interactive use). Default False.
:returns: whether the lineage now ought to autodeploy an :returns: whether the lineage now ought to autodeploy an
existing newer cert version existing newer cert version
:rtype: bool :rtype: bool
""" """
if self.autodeployment_is_enabled(): if interactive or self.autodeployment_is_enabled():
if self.has_pending_deployment(): if self.has_pending_deployment():
interval = self.configuration.get("deploy_before_expiry", interval = self.configuration.get("deploy_before_expiry",
"5 days") "5 days")
@@ -529,7 +533,7 @@ class RenewableCert(object): # pylint: disable=too-many-instance-attributes
return ("autorenew" not in self.configuration or return ("autorenew" not in self.configuration or
self.configuration.as_bool("autorenew")) self.configuration.as_bool("autorenew"))
def should_autorenew(self): def should_autorenew(self, interactive=False):
"""Should we now try to autorenew the most recent cert version? """Should we now try to autorenew the most recent cert version?
This is a policy question and does not only depend on whether This is a policy question and does not only depend on whether
@@ -540,12 +544,16 @@ class RenewableCert(object): # pylint: disable=too-many-instance-attributes
Note that this examines the numerically most recent cert version, Note that this examines the numerically most recent cert version,
not the currently deployed version. not the currently deployed version.
:param bool interactive: set to True to examine the question
regardless of whether the renewal configuration allows
automated renewal (for interactive use). Default False.
:returns: whether an attempt should now be made to autorenew the :returns: whether an attempt should now be made to autorenew the
most current cert version in this lineage most current cert version in this lineage
:rtype: bool :rtype: bool
""" """
if self.autorenewal_is_enabled(): if interactive or self.autorenewal_is_enabled():
# Consider whether to attempt to autorenew this cert now # Consider whether to attempt to autorenew this cert now
# Renewals on the basis of revocation # Renewals on the basis of revocation