diff --git a/debian/changelog b/debian/changelog index 079c0ec..d25738b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +python-libraclient (1.2.5-1) UNRELEASED; urgency=low + + * Adds support for Load Balancer log snapshotting + + -- Andrew Hutchings Wed, 27 Mar 2013 20:24:06 +0000 + python-libraclient (1.2.4-1) UNRELEASED; urgency=low * Adds input filtering and error handling for --node options diff --git a/libraclient/__init__.py b/libraclient/__init__.py index bd197bb..750389f 100644 --- a/libraclient/__init__.py +++ b/libraclient/__init__.py @@ -12,4 +12,4 @@ # License for the specific language governing permissions and limitations # under the License. -__version__ = "1.2.4" +__version__ = "1.2.5" diff --git a/libraclient/clientoptions.py b/libraclient/clientoptions.py index 5208a86..fac8eed 100644 --- a/libraclient/clientoptions.py +++ b/libraclient/clientoptions.py @@ -162,6 +162,15 @@ class ClientOptions(object): sp.add_argument('--nodeid', help='node ID to get status from', required=True) + sp = subparsers.add_parser( + 'logs', help='send a snapshot of logs to an object store' + ) + sp.add_argument('--id', help='load balancer ID', required=True) + sp.add_argument('--storage', help='storage type', choices=['Swift']) + sp.add_argument('--endpoint', help='object store endpoint to use') + sp.add_argument('--basepath', help='object store based directory') + sp.add_argument('--token', help='object store authentication token') + def run(self): self._generate() return self.options.parse_args() diff --git a/libraclient/libraapi.py b/libraclient/libraapi.py index 7c07614..f6f1013 100644 --- a/libraclient/libraapi.py +++ b/libraclient/libraapi.py @@ -188,6 +188,21 @@ class LibraAPI(object): columns = ['id', 'address', 'port', 'condition', 'status'] self._render_dict(column_names, columns, body) + def logs_lb(self, args): + data = {} + + if args.storage: + data['ObjectStoreType'] = args.storage + if args.endpoint: + data['ObjectStoreEndpoint'] = args.endpoint + if args.basepath: + data['ObjectStoreBasePath'] = args.basepath + if args.token: + data['ObjectStoreAuthToken'] = args.token + + resp, body = self._post('/loadbalancers/{0}/logs'.format(args.id), + body=data) + def _render_list(self, column_names, columns, data): table = prettytable.PrettyTable(column_names) for item in data: