Skip to content

Commit

Permalink
Don't install http_notary_list.txt use Notary.default() if a file is
Browse files Browse the repository at this point in the history
not specified. Part of addressing issue #45. Bumped version to 0.2
because this changes the behavior of Checker.__init__() when
notaries_file == None. Requires pyPerspecitves >= 0.2 for
Notaries.default() support.
  • Loading branch information
von committed Aug 5, 2011
1 parent 0d1afc7 commit dcbaf14
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 88 deletions.
73 changes: 0 additions & 73 deletions conf/http_notary_list.txt

This file was deleted.

9 changes: 6 additions & 3 deletions perproxy/Checker.py
Expand Up @@ -71,9 +71,12 @@ def __init__(self, cache=None, notaries_file=None,
else ServiceCache()
# Age at which entry in cache is stale and ignored
self.cache_stale_age = 24 * 3600
notaries_file = notaries_file if notaries_file is not None \
else "./http_notary_list.txt"
self.notaries = Notaries.from_file(notaries_file)
if notaries_file:
self.logger.debug("Reading notaries from %s" % notaries_file)
self.notaries = Notaries.from_file(notaries_file)
else:
self.logger.debug("Using default notaries")
self.notaries = Notaries.default()
self.quorum = int(len(self.notaries) * quorum_percentage / 100)
self.logger.debug(
"%d notaries, quorum is %d (%d%%)" % (len(self.notaries),
Expand Down
2 changes: 1 addition & 1 deletion perproxy/constants.py
Expand Up @@ -2,7 +2,7 @@
Used by PerProxy scripts and setup.py"""

VERSION="0.1"
VERSION="0.2"

# Default installation location
DEFAULT_INSTALL_PATH="/usr/local/perproxy"
Expand Down
9 changes: 7 additions & 2 deletions scripts/PerProxy
Expand Up @@ -48,7 +48,7 @@ def parse_args(argv):
"ca_key_file" : os.path.expanduser(os.path.join(DEFAULT_USER_CONF_PATH,"ca-key.pem")),
"error_template" : None,
"logging_config" : None,
"notaries_file" : os.path.join(DEFAULT_INSTALL_PATH, "etc", "http_notary_list.txt"),
"notaries_file" : None,
"perspectives_quorum_duration" : 86400, # One day
"perspectives_quorum_percentage" : 75,
"proxy_hostname" : "localhost",
Expand Down Expand Up @@ -182,8 +182,13 @@ def main(argv=None):
args.ca_key_file))
Handler.ca = CertificateAuthority.from_file(os.path.expanduser(args.ca_cert_file),
os.path.expanduser(args.ca_key_file))

notaries_file = args.notaries_file
if notaries_file:
notaries_file = os.path.expanduser(args.notaries_file)

Handler.checker = Checker(
notaries_file = os.path.expanduser(args.notaries_file),
notaries_file = notaries_file,
quorum_percentage=int(args.perspectives_quorum_percentage),
quorum_duration=int(args.perspectives_quorum_duration)
)
Expand Down
11 changes: 2 additions & 9 deletions setup.py
Expand Up @@ -5,14 +5,7 @@
except:
from distutils.core import setup

from perproxy import DEFAULT_INSTALL_PATH, DEFAULT_USER_CONF_PATH, VERSION

# Our configuration files

CONF_PATH = os.path.join(DEFAULT_INSTALL_PATH, "etc")
CONF_FILES = [
"conf/http_notary_list.txt",
]
from perproxy import DEFAULT_INSTALL_PATH, VERSION

#
# Our scripts
Expand All @@ -36,9 +29,9 @@
"conf/logging.config",
] },
data_files = [
(CONF_PATH, CONF_FILES),
(SCRIPT_PATH, SCRIPT_FILES),
],
install_requires=['pyPerspectives >= 0.2'],

author = "Von Welch",
author_email = "von@vwelch.com",
Expand Down

0 comments on commit dcbaf14

Please sign in to comment.