From dc15f33618704de8c13d56fdd3a1243ac7497593 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 12 May 2016 09:03:49 -0400 Subject: [PATCH] Add support for Untangle v10 (the same as v11 and v12). --- doc/man8/untangle-https-backup.8 | 7 ++++--- src/untangle/untangle.py | 14 ++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/doc/man8/untangle-https-backup.8 b/doc/man8/untangle-https-backup.8 index 419112e..931095d 100644 --- a/doc/man8/untangle-https-backup.8 +++ b/doc/man8/untangle-https-backup.8 @@ -33,7 +33,8 @@ username = testuser password = hunter2 .fi -There are currently five parameters that may be set for each installation: +There are currently five parameters that may be set for each +installation: .IP \fBhost\fR\ (required) The hostname or IP address where the Untangle web UI is available. @@ -42,8 +43,8 @@ The Untangle admin username. .IP \fBpassword\fR\ (required) The Untangle admin password. .IP \fBversion\fR\ (default:\ \fI12\fR) -The version of Untangle running on this host. Currently only \fI9\fR, -\fI11\fR, and \fI12\fR are supported. +The major version of Untangle running on this host. Versions \fI9\fR, +\fI10\fR, \fI11\fR, and \fI12\fR are supported. .IP \fBverify_cert\fR\ (default:\ False) Whether or not to verify the site's SSL certificate, either \fITrue\fR or \fIFalse\fR. diff --git a/src/untangle/untangle.py b/src/untangle/untangle.py index 39eeeaa..05df722 100644 --- a/src/untangle/untangle.py +++ b/src/untangle/untangle.py @@ -22,7 +22,7 @@ class Untangle: self.base_url = 'https://' + self.host + '/' # This never changes # Sanity check the numerical version. - if self.version not in [9, 11, 12]: + if self.version not in [9, 10, 11, 12]: msg = 'Invalid version "' + str(self.version) + '" ' msg += 'in section "' + s.name + '"' raise configparser.ParsingError(msg) @@ -79,11 +79,9 @@ class Untangle: """ if self.version == 9: return self.get_backup_v9() - elif self.version == 11: - return self.get_backup_v11() - elif self.version == 12: - # The procedure for v12 is the same as for v11. - return self.get_backup_v11() + elif self.version in [10, 11, 12]: + # The procedure for v11 or v12 is the same as for v10. + return self.get_backup_v10() def get_backup_v9(self): @@ -104,9 +102,9 @@ class Untangle: return response.read() - def get_backup_v11(self): + def get_backup_v10(self): """ - Retrieve a backup from Untangle version 11. + Retrieve a backup from Untangle version 10. Returns the binary HTTPS response (i.e. the file). """ -- 2.44.2