mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-08 09:19:09 -07:00
parent
2f33c1a1a1
commit
5553b20828
206 changed files with 1853 additions and 1870 deletions
|
@ -27,24 +27,21 @@
|
|||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
|
||||
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
# standard ansible imports
|
||||
from ansible.module_utils.basic import get_exception
|
||||
|
||||
# standard PG imports
|
||||
HAS_PSYCOPG2 = False
|
||||
try:
|
||||
import psycopg2
|
||||
import psycopg2.extras
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
HAS_PSYCOPG2 = True
|
||||
except ImportError:
|
||||
HAS_PSYCOPG2 = False
|
||||
|
||||
from ansible.module_utils.basic import get_exception
|
||||
from ansible.module_utils.six import iteritems
|
||||
|
||||
|
||||
class LibraryError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
def ensure_libs(sslrootcert=None):
|
||||
if not HAS_PSYCOPG2:
|
||||
raise LibraryError('psycopg2 is not installed. we need psycopg2.')
|
||||
|
@ -54,14 +51,14 @@ def ensure_libs(sslrootcert=None):
|
|||
# no problems
|
||||
return None
|
||||
|
||||
|
||||
def postgres_common_argument_spec():
|
||||
return dict(
|
||||
login_user = dict(default='postgres'),
|
||||
login_password = dict(default='', no_log=True),
|
||||
login_host = dict(default=''),
|
||||
login_unix_socket = dict(default=''),
|
||||
port = dict(type='int', default=5432),
|
||||
ssl_mode = dict(default='prefer', choices=['disable', 'allow', 'prefer', 'require', 'verify-ca', 'verify-full']),
|
||||
ssl_rootcert = dict(default=None),
|
||||
login_user=dict(default='postgres'),
|
||||
login_password=dict(default='', no_log=True),
|
||||
login_host=dict(default=''),
|
||||
login_unix_socket=dict(default=''),
|
||||
port=dict(type='int', default=5432),
|
||||
ssl_mode=dict(default='prefer', choices=['disable', 'allow', 'prefer', 'require', 'verify-ca', 'verify-full']),
|
||||
ssl_rootcert=dict(),
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue