summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Moreau Simard <dmsimard@redhat.com>2018-06-25 10:34:31 -0400
committerDavid Moreau Simard <dmsimard@redhat.com>2018-06-25 10:59:44 -0400
commitd54b3f8e5954b2ea42775dff3eb18125337a30d2 (patch)
treef11b4dd21468b14ecd6338ca77f6744a447630cd
parentc9a08e7680306ac3c23c5897fd3a07539811d858 (diff)
Add helper method to retrieve client instance
Notes
Notes (review): Code-Review+2: David Moreau Simard <dmsimard@redhat.com> Workflow+1: David Moreau Simard <dmsimard@redhat.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Mon, 25 Jun 2018 22:47:49 +0000 Reviewed-on: https://review.openstack.org/577842 Project: openstack/ara-clients Branch: refs/heads/master
-rw-r--r--ara/clients/utils.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/ara/clients/utils.py b/ara/clients/utils.py
new file mode 100644
index 0000000..99006a8
--- /dev/null
+++ b/ara/clients/utils.py
@@ -0,0 +1,25 @@
1# Copyright (c) 2018 Red Hat, Inc.
2#
3# This file is part of ARA Records Ansible.
4#
5# ARA is free software: you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation, either version 3 of the License, or
8# (at your option) any later version.
9#
10# ARA is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with ARA. If not, see <http://www.gnu.org/licenses/>.
17
18from ara.clients.offline import AraOfflineClient
19
20
21def get_client(client=None, **kwargs):
22 if client is None or client == 'offline':
23 return AraOfflineClient(**kwargs)
24 else:
25 raise ValueError('Unsupported client: %s' % client)