aboutsummaryrefslogtreecommitdiff
path: root/rcynic
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2012-08-02 14:59:22 +0000
committerRob Austein <sra@hactrn.net>2012-08-02 14:59:22 +0000
commit5420f7dd561f0730163866b7ea887f487398688c (patch)
treea1c75270cc65cdb6f1c0fc91987d6fc0170d654c /rcynic
parentb1acd4c4453e667167c2f95dc487ff654945d89d (diff)
Check for 404 errors, allow specification of username and password for
transmission daemon. Also allow SSH hostkeys to be optional, which is a bad idea, but is needed in certain automated test environments where the hostkey isn't available without heroic effort (read: don't run without a hostkey in any kind of production environment). svn path=/trunk/; revision=4618
Diffstat (limited to 'rcynic')
-rw-r--r--rcynic/rpki-torrent.py28
1 files changed, 25 insertions, 3 deletions
diff --git a/rcynic/rpki-torrent.py b/rcynic/rpki-torrent.py
index 54b18d81..cd210b46 100644
--- a/rcynic/rpki-torrent.py
+++ b/rcynic/rpki-torrent.py
@@ -437,10 +437,13 @@ class ZipFile(object):
self.changed = True
log_email("Downloading %s" % self.url)
except urllib2.HTTPError, e:
- if e.code != 304:
+ if e.code == 304:
+ syslog.syslog("%s has not changed" % self.url)
+ elif e.code == 404:
+ syslog.syslog("%s does not exist" % self.url)
+ else:
raise
r = None
- syslog.syslog("%s has not changed" % self.url)
self.check_subjectAltNames()
@@ -540,6 +543,8 @@ class TransmissionClient(transmissionrpc.client.Client):
def __init__(self, **kwargs):
kwargs.setdefault("address", "127.0.0.1")
+ kwargs.setdefault("user", cfg.transmission_username)
+ kwargs.setdefault("password", cfg.transmission_password)
transmissionrpc.client.Client.__init__(self, **kwargs)
@@ -646,7 +651,10 @@ class MyConfigParser(ConfigParser.RawConfigParser):
@property
def sftp_hostkey_file(self):
- return self.get(self.rpki_torrent_section, "sftp_hostkey_file")
+ try:
+ return self.get(self.rpki_torrent_section, "sftp_hostkey_file")
+ except ConfigParser.Error:
+ return None
@property
def sftp_private_key_file(self):
@@ -670,6 +678,20 @@ class MyConfigParser(ConfigParser.RawConfigParser):
def log_email(self):
return self.get(self.rpki_torrent_section, "log_email")
+ @property
+ def transmission_username(self):
+ try:
+ return self.get(self.rpki_torrent_section, "transmission_username")
+ except ConfigParser.Error:
+ return None
+
+ @property
+ def transmission_password(self):
+ try:
+ return self.get(self.rpki_torrent_section, "transmission_password")
+ except ConfigParser.Error:
+ return None
+
def multioption_iter(self, name, getter = None):
if getter is None:
getter = self.get