Commit Graph

273 Commits (c18da65089e396ac2e459654398b32f68aecfc98)

Author SHA1 Message Date
Matt Martz 02f66b9369 E1 legacy pep8 fixes (#21933)
* E1 pep8 fixes

* e111 fix for rds.py
2017-03-21 21:19:40 -05:00
Toshio Kuratomi eb1214baad New metadata 1.0 (#22587)
Changes to the metadata format were approved here:
https://github.com/ansible/proposals/issues/54
* Update documentation to the new metadata format
* Changes to metadata-tool to account for new metadata
  * Add GPL license header
  * Add upgrade subcommand to upgrade metadata version
  * Change default metadata to the new format
  * Fix exclusion of non-modules from the metadata report
* Fix ansible-doc for new module metadata
* Exclude metadata version from ansible-doc output
* Fix website docs generation for the new metadata
* Update metadata schema in valiate-modules test
* Update the metadata in all modules to the new version
2017-03-14 09:07:22 -07:00
John R Barker e5b990a55a Fix invalid fields in module DOCUMENATION (#22297)
* fix module doc fields

* More module docs corrections

* More module docs corrections

* More module docs corrections

* More module docs corrections

* correct aliases

* Review comments

* Must quote ':'

* More authors

* Use suboptions:

* restore type: bool

* type should be in the same place

* More tidyups

* authors

* Use suboptions

* revert

* remove duplicate author

* More issues post rebase
2017-03-09 16:20:25 +00:00
Lujeni d942196666 Use a dedicated directory for the mongodb modules (#22187)
* Use a dedicated directory for the mongodb modules
* Missing the RETURN documentation in mongodb_user
2017-03-06 13:14:14 -08:00
Matt Martz 305c88700d PEP8 E712 fixes (#21916) 2017-02-24 16:49:43 -06:00
Matt Clay 4554e8d769 Remove unnecessary shebangs and execute bits. 2017-02-22 18:13:46 -08:00
Pierrick Caillon a1b3664ec4 Fix: mysql_user - permission string with column privileges
MySQL returns privileges on columns as "PRIVILEGES (column)".
For permissions to be correctly matched, it must be specified exactly the
same in the module argument. A resulting string is like
"dbname.dbtable:PRIVILEGES (column)". Thus, the space before the opening
parenthesis must also be removed when creating the set of privileges for
validation.
2017-02-21 10:51:03 -08:00
Ted Timmons 5d9df86b42 Postgres ssl mode prefer (#21498)
* refactor postgres,
* adds a basic unit test module
* first step towards a common utils module
* set postgresql_db doc argument defaults to what the code actually uses

* unit tests that actually test a missing/found psycopg2, no dependency needed

* add doc fragments, use common args, ansible2ify the imports

* update dict

* add AnsibleModule import

* mv AnsibleModule import to correct file

* restore some database utils we need

* rm some more duplicated pg doc fragments

* change ssl_mode from disable to prefer, add update docs

* use LibraryError pattern for import verification

per comments on #21435. basically LibraryError and touching up its usage in pg_db and the tests.
2017-02-16 11:29:43 -08:00
Ted Timmons a000594436 fix failing fail_json call in postgresql_schema (#21495)
fix failing fail_json call in postgresql_schema

- Bugfix Pull Request

modules/database/postgresql/postgresql_schema

```
2.3.0
```

Here's an example of the error that was coming out. Massaged some linebreaks and backslashes to make it more readable:

    "module_stderr": "Traceback (most recent call last):
      File "/tmp/ansible_3X05GE/ansible_module_postgresql_schema.py", line 274, in <module>
        main()
      File "/tmp/ansible_3X05GE/ansible_module_postgresql_schema.py", line 265, in main
        module.fail_json(msg="Database query failed: %s" %(text, str(e)))
      NameError: global name 'text' is not defined
    ",

Now it triggers with the correct exception and shows the traceback. This duplication of str(e) and traceback seems to be the best design pattern.

Sample of the new output:

    An exception occurred during task execution. The full traceback is:
    Traceback (most recent call last):
      File "/tmp/ansible_gp4v1Q/ansible_module_postgresql_schema.py", line 254, in main
        changed = schema_create(cursor, schema, owner)
    ...
        return super(DictCursor, self).execute(query, vars)
    ProgrammingError: permission denied for database schemadb

    fatal: [localhost]: FAILED! => {
        "changed": false,
        "failed": true,
    ...
        },
        "msg": "Database query failed: permission denied for database schemadb\n"
2017-02-16 11:26:40 -08:00
Matt Martz 7c00346714 Validate EXAMPLES as YAML 2017-02-15 13:01:43 -08:00
Wilfrido Vidana e89259dbd0 Fixes #19835: enable role attribute change when not changing password (#19834)
Fixes #19835
2017-02-15 13:47:15 -05:00
Brian Coca 74e8aa22af no log passwords (#21229)
* no log passwords

* removed unneeded no_log
2017-02-10 15:13:59 -05:00
Tatsuya Hoshino 41f3680dfd Mask login_password in log (#21199) 2017-02-09 10:16:54 -08:00
Toshio Kuratomi f75ffe46db Make configparser imports python3 ready
the ConfigParser module was renamed to configparser in Python3.  Use
six.moves to import it so that the modules will function on Python3.
2017-02-03 21:15:34 -08:00
Matt Martz 829c0b8f62 Update validate-modules (#20932)
* Update validate-modules

* Validates ANSIBLE_METADATA
* Ensures imports happen after documentation vars
* Some pep8 cleanup

* Clean up some left over unneeded code

* Update modules for new module guidelines and validate-modules checks

* Update imports for ec2_vpc_route_table and ec2_vpc_nat_gateway
2017-02-02 11:45:22 -08:00
Matt Clay cb76200c7d PEP 8 E111 & E114 cleanup. (#20838) 2017-01-30 15:01:47 -08:00
Matt Clay 10d9318de7 PEP 8 indent cleanup. (#20800)
* PEP 8 E121 cleanup.

* PEP 8 E126 cleanup.

* PEP 8 E122 cleanup.
2017-01-29 07:28:53 +00:00
Matt Clay e2c0b375d3 PEP 8 cleanup. (#20790)
* PEP 8 E115 cleanup.
* PEP 8 E131 cleanup.
2017-01-28 01:39:40 -08:00
Matt Clay d0d1158c5e PEP 8 cleanup. (#20789)
* PEP 8 E703 cleanup.
* PEP 8 E701 cleanup.
* PEP 8 E711 cleanup.
* PEP 8 W191 and E101 cleanup.
2017-01-28 00:12:11 -08:00
Matt Clay d913f69ba1 PEP 8 W291 whitespace cleanup. 2017-01-27 17:08:02 -08:00
Matt Clay 95789f3949 PEP 8 whitespace cleanup. (#20783)
* PEP 8 E271 whitespace cleanup.
* PEP 8 W293 whitespace cleanup.
* Fix whitespace issue from recent PR.
2017-01-27 15:45:23 -08:00
Maarten Bezemer 1f1379ea61 Support forced SSL-verified connection with given CA certificate 2017-01-16 12:17:10 -08:00
Toshio Kuratomi a33e34894b Move some modules into proper categories 2017-01-04 18:09:45 -08:00
Jonathan Juares Beber 0bf7a7321a fix mongodb_parameter
This is broken the module when using str parameters.

Value is already converted to int, if necessary at line 193
2017-01-02 07:46:21 -08:00
Carlos E. Garcia 0b8011436d minor spelling changes 2016-12-13 13:51:13 -05:00
Andrea Tartaglia ef391a11ec Removed dict.iteritems() in modules. (#18859)
This is for py3 compatibility, addressed in #18506
2016-12-12 15:16:23 -08:00
Toshio Kuratomi df9059936b Metadata Status needs to be a list, not a scalar.
The default metadata was specified with a string "preview" instead of
the list ["preview"].
2016-12-08 11:35:19 -05:00
James Cammarata 011ea55a8f Relocating extras into lib/ansible/modules/ after merge 2016-12-08 11:35:18 -05:00
James Cammarata 8afa090417 Resolving differences in core modules post-merge 2016-12-08 11:25:36 -05:00
Toshio Kuratomi 7319104552 Refreshed metadata for core modules 2016-12-08 11:25:35 -05:00
Fabio Alessandro Locati 8855b3274c Call main in conditional way - databases 2016-12-08 11:25:35 -05:00
Wouter Oosterveld 61060f4b5f mysql_user: fix user_mod on MySQL(-like) 5.7+ (Fixes #3003) (#5388) 2016-12-08 11:25:33 -05:00
Sam Doran 895179929c Examples syntax batch6 (#5623)
* Change example syntax on os_auth module

* Change example syntax on os_client_config module

* Change example syntax on os_image_facts module

* Change example syntax on os_networks_facts module

* Change example syntax on os_nova_flavor module

* Change example syntax on os_object module

* Change example syntax on os_server module

* Change example syntax on os_subnet_facts module

* Change example syntax on rax_files module

* Change example syntax on rax_files_objects module

* Change example syntax on mysql_db module

* Change example syntax on file module

* Change example syntax on uri module

* Change example syntax on cl_bond module

* Change example syntax on cl_bridge module

* Change example syntax on cl_img_install module

* Change example syntax on cl_interface module

* Change example syntax on cl_license module

* Change example syntax on cl_ports module

* Remove trailing colon
2016-12-08 11:25:31 -05:00
John R Barker 5945b19ad3 double quotes for consistency 2016-12-08 11:25:29 -05:00
John R Barker 1d00dd80f1 Need to quote if there is a `:` 2016-12-08 11:25:29 -05:00
Sam Doran 6d06f80097 Change examples syntax on postgresql_user module 2016-12-08 11:25:28 -05:00
Sam Doran 13c827a31c Change examples syntax on postgresql_privs module 2016-12-08 11:25:28 -05:00
Sam Doran 8edd2673b2 > Change examples syntax on postgresql_db module 2016-12-08 11:25:28 -05:00
Sam Doran e0cfe14901 Change examples syntax on mysql_variables module 2016-12-08 11:25:28 -05:00
Sam Doran db723af8aa Change examples syntax on mysql_user module 2016-12-08 11:25:28 -05:00
Sam Doran 119a767cd2 Change examples syntax on mysql_db module 2016-12-08 11:25:28 -05:00
Michael Scherer 5e1dfa9485 Do not leak the password in log (#5189) 2016-12-08 11:25:20 -05:00
Michael Scherer 996ccca82f Do not leak various passwords in log (#5202) 2016-12-08 11:25:20 -05:00
John R Barker 25b6492d37 Bulk spelling improvement to modules-core (#5225)
* Correct spelling mistakes

* Correct more spelling issues

* merge conflict

* Revert typo in parms
2016-12-08 11:25:20 -05:00
Søren Kröger 61144f4da9 Added single_transaction and quick to db_dump (#3687)
It was missing before, ...
2016-12-08 11:25:12 -05:00
Marius Gedminas 9509224768 postgresql_db: fix inverted 'changed' logic when state=absent (#4934)
Fixes #4933.
2016-12-08 11:25:12 -05:00
Tobias Wolf cda78382b6 Fix database table quoting in privileges_unpack() (#3858)
In Ansible 2.x this module gives `changed = True` for all privileges
that are specified including a table with

    priv: "database.table:GRANT"

Mysql returns escaped names in the format

    `database`.`tables`:GRANT

However in PR #1358, which was intended to support dotted database names
(a crazy idea to begin with), the quotes for the table name were left
out, leading to `curr_priv != new_priv`.

This means that the idempotency comparison between new_priv and
curr_priv is always 'changed'.

This PR re-introduces quoting to the table part of the priv.
2016-12-08 11:24:57 -05:00
Jean Prat ed246a328f if user is empty, it is not converted to tuple when using host_all (#3038) 2016-12-08 11:24:57 -05:00
Michael Scherer f59af7d29e Port postgresql module to python3 (#4579)
Iteritems is no longer a dict method in Python3, replace it with
the six wrapper.
2016-12-08 11:24:56 -05:00
Michael Scherer 839d5b6de4 Fix mysql_user for python3 (#4576)
dict no longer have a iteritems method, it was replaced
by items. So we need to use six.

    Traceback (most recent call last):
      File \"/tmp/ansible_hjd7d65c/ansible_module_mysql_user.py\", line 587, in <module>
        main()
      File \"/tmp/ansible_hjd7d65c/ansible_module_mysql_user.py\", line 571, in main
        changed = user_add(cursor, user, host, host_all, password, encrypted, priv, module.check_mode)
      File \"/tmp/ansible_hjd7d65c/ansible_module_mysql_user.py\", line 239, in user_add
        for db_table, priv in new_priv.iteritems():
    AttributeError: 'dict' object has no attribute 'iteritems'
2016-12-08 11:24:56 -05:00
René Moser 03022875c4 mysql_db: use new exception handling, fixes build (#4373) 2016-12-08 11:24:49 -05:00
Saurabh Sharma a5695c8b24 error handling for importing non-existent db. Fixes ##2068 (#3617)
* error handling for importing non-existent db

* creating db on import state and suitable message on deleting db

* handling all possible cases when db exists/not-exists
2016-12-08 11:24:49 -05:00
Michael Scherer 09066f1518 Convert all databases modules to python3 and 2.4 syntax (#3688) 2016-12-08 11:24:29 -05:00
Rene Moser 9f1cfe07bb mysql_user: fix unresolved reference
L282, module is used but not passed into function. Replaced check_mode reference and used module instead since check_mode is also in module.
2016-12-08 11:24:26 -05:00
Rene Moser 6a7682c7ea mysql_variables: fix inconsistent params, fixes ubuntu 16.04 support
In the mysql_user module, login_host is defined as "localhost". Setting this to localhost also fixes Ubuntu 16.04 support.

To make it more consistent in the future, the params in all mysql modules should move to module utils. I'll take care.

Also fixed a few other things along.
2016-12-08 11:24:26 -05:00
Jeroen Geusebroek 54e62c2022 Allow an empty password when adding a new MySQL user. (#3445) 2016-12-08 11:24:19 -05:00
jjshoe d3623c8148 Give encoding examples (#3436) 2016-12-08 11:24:18 -05:00
hyperized 51e2813ae4 Set --quick to True by default and make it selectable (#3418)
As indicated by @jmainguy in eb1cb94380 (commitcomment-17077470), this will allow the user to set the option quick, which is True by default (as it was before).

This is in reference to: https://github.com/ansible/ansible-modules-core/pull/3402
2016-12-08 11:24:18 -05:00
hyperized 075edf7bb2 Add single_transaction and quick options to MySQL DB module (#3402) 2016-12-08 11:24:16 -05:00
Michael Scherer 8b125f8c2c Mark path as type='path', do not leak login_password by error (#3396) 2016-12-08 11:24:16 -05:00
Michael Scherer c0179330c9 Update the type of some arguments in mysql_db module (#3285)
login_password should not be logged, so mark it as 'no_log'
the others arguments are path to file, and so should be type='path',
which permit to remove the line handling '~' and shell variables.
2016-12-08 11:24:16 -05:00
Tom Paine 7422ada2c8 Update mysql_db.py
* Update mysql_db.py

Resubmission of https://github.com/ansible/ansible-modules-core/pull/2961 in single commit.

* Update mysql_db.py
2016-12-08 11:24:16 -05:00
Matt Clay b7a5e1e0c8 Add optional connect timeout to mysql* modules. 2016-12-08 11:24:12 -05:00
Kenny Gryp 69b07aaf9d added sql_log_bin setting to disable binary logging as option 2016-12-08 11:24:11 -05:00
Tobias Wolf 75e8b365b4 Add supports_check_mode=True to mysql_db module
The most important cases are state=present and state=absent.

Future work: import and dump could be simulated and hence checked.
2016-12-08 11:24:09 -05:00
Matt Martz aaf762573e Various simple linting type cleanups on modules 2016-12-08 11:24:06 -05:00
Toshio Kuratomi 50eda6c62e password needs to be type str.
In 1.9 this was the default.  In 2.0.0 and 2.0.1 this doesn't get set.
2.1.0 will fix the default but we should fix this now.
2016-12-08 11:24:05 -05:00
Toshio Kuratomi f6aa1ff9a4 Remove duplicate documentation fields 2016-12-08 11:24:01 -05:00
Lee H 8e84ba71ae - fix check_mode test to avoid errors
- correct test mode check to ensure it returns and doesnt apply changes
  (via jmainguy)
2016-12-08 11:24:00 -05:00
Mark van Driel a24cdbe15e Fixed "invalid privileges string: set expected at most 1 arguments, got 2" 2016-12-08 11:23:58 -05:00
Jonathan Mainguy e9a752f769 add ansi support 2016-12-08 11:23:58 -05:00
Mark van Driel d67f2eb104 Fixes require ssl in combination with other privileges
Fixes require ssl in combination with grant option

Refactoring: code cleanup to make it easier to understand

Code rewritten inspired by @willthames

Added WITH GRANT OPTION as exception; when only REQUIRESSL and/or GRANT are specified we have to add USAGE
2016-12-08 11:23:57 -05:00
KIKUCHI Koichiro 2974358b2b Add check_mode support to mysql_user. 2016-12-08 11:23:56 -05:00
Jonathan Mainguy 47d0719cfe Fix bad merge 2016-12-08 11:23:56 -05:00
Josh Rendek bddcf737c9 Fix quote on grants of more than one word
Fixed a quote location on the grants composed of more than one word. Current docs will raise an error with a invalid privilege command.
2016-12-08 11:23:55 -05:00
Toshio Kuratomi 65b9243056 mariadb isn't always the last elemen of the version string 2016-12-08 11:23:53 -05:00
Toshio Kuratomi 0a64899eba Fix mysqldump usage of config_file 2016-12-08 11:23:53 -05:00
Toshio Kuratomi dafb39da2e Account for mariadb versioning 2016-12-08 11:23:53 -05:00
Jonathan Mainguy 0cdb2719e5 Unify all 3 mysql modules.
Use same connection method, use config_file, and add ssl support
2016-12-08 11:23:53 -05:00
Lee H 7feb64d31c - add version_added as requested to host_all 2016-12-08 11:23:53 -05:00
Lee H 5606197c28 - remove user_anonymous as the same thing can be accomplished by user='', but leave in the examples for removing anonymous users 2016-12-08 11:23:53 -05:00
Lee H 95895177d0 - add example showing removal of anonymous user accounts 2016-12-08 11:23:52 -05:00
Jonathan Mainguy b86224a7ec Add Jmainguy as author, fix hash check 2016-12-08 11:23:52 -05:00
Lee Hardy f2f0f83ee6 - fix user_exists statement with host_all to use only username parameter 2016-12-08 11:23:52 -05:00
Lee Hardy 1113975741 - mysql: add user_anonymous parameter, which interacts with anonymous users - mysql; add host_all parameter, which forces iteration over all 'user'@... matches 2016-12-08 11:23:51 -05:00
Derek Smith b9baed507b updated examples
added mysql 5.7 user password modification support with backwards compatibility

resolved mysql server version check and differences in user authentication management

explicitly state support for mysql_native_password type and no others. fixed some failing logic and updated samples

updated comment to actually match logic.

simplified conditionals and a little refactor
2016-12-08 11:23:51 -05:00
trevoro b5a3dd4818 adding password_hash support to mysql_user module
fixing user_add arguments error

fixing user_mod arguments error
2016-12-08 11:23:51 -05:00
Mark Theunissen c3450d542f Remove Mark Theunissen as maintainer 2016-12-08 11:23:50 -05:00
Jonathan Mainguy caf6115f43 Update documentation to reflect need for mysql client 2016-12-08 11:23:46 -05:00
wtanaka.com c31a6fd23f Update target parameter documentation
xz support was only added recently (2015-05-15), so referring to it
unqualified in the online documentation is confusing.
2016-12-08 11:23:46 -05:00
Greg DeKoenigsberg 742b452dc1 @lorin stepping down as maintainer 2016-12-08 11:23:45 -05:00
Brian Coca 3906fd426b document mysql collation can only be set during creation 2016-12-08 11:23:44 -05:00
Jonathan Mainguy 833676960d Update doc to reflect password is required if adding a new user 2016-12-08 11:23:44 -05:00
Jonathan Mainguy 346c9ab80e Update error message to be more explicit 2016-12-08 11:23:44 -05:00
Sam Yaple f2c1eeb54c Actually remove the section we are replacing 2016-12-08 11:23:32 -05:00
Sam Yaple 52d364b74c Refix bug 1226 after revert
This patch properly fixes bug 1226 without introducing a breaking
change to idempotency which was introduced in PR #1358

We can properly assign permissions to databases with a '.' in the name
of the database as well as assign priviliges to all databases as
specified with '*'
2016-12-08 11:23:32 -05:00
Sam Yaple f8bcdffa36 Revert "escapeds changes"
While this change doesn't break the creation, it does break
idempotency. This change will convert '*.*' to '`*`.*' which is
functionally the same, however when the user_mod() function looks up
the current privileges with privileges_get() it will read '*.*'

Since '*.*' != '`*`.*' it will go through the process of updating the
privleges always resulting in a 'changed' result.

This reverts commit db9ab9b2629f00350a743a4eca72fb5ee8dc8c77.
2016-12-08 11:23:31 -05:00
Guilherme Carlos aaac05c96c Fix login_user on mysql_user
`login_username` was provided but `login_user` is the correct option
2016-12-08 11:23:24 -05:00
Will Thames e5d96dc934 Correct handling of empty role_attr_flags
role_attr_flags is the empty string by default, not None.
2016-12-08 11:23:24 -05:00
Jesse Sandberg 807feb3ac4 Validate variable, return only the found variable value instead of tuple
Docs imply the mysql_variables is used to operate a single variable therefore
- fail before making any db connections if variable is not set
- validate chars for mysql variable name with re.match(^[a-z0-9_]+)
- use "SHOW VARIABLE WHERE Variable_name" instead of LIKE search
- getvariable() returns only the value or None if variable is not found
- the module returns only the found variable value instead of tuple for easier operation eg. as registere variable in tasks
2016-12-08 11:23:24 -05:00
sysadmin75 9bd58bd224 Fix to revoke privileges for mysql user = '' Issue #9848 2016-12-08 11:23:24 -05:00
acaveroc dda41fd95a Add version_added and type of parameter 2016-12-08 11:23:19 -05:00
acaveroc 2c6f69c95e Assorted minor bug fixes
- Modified data type for port definition from string to integer
- Modified login_host default value for compatibilize with port definition according with MySQL Documentation (https://dev.mysql.com/doc/refman/5.0/en/connecting.html)
2016-12-08 11:23:19 -05:00
acaveroc 1283fdd118 Add port definition support for mysql_vars module 2016-12-08 11:23:19 -05:00
Matt Martz 3d28efaf7e Replace tabbed indentation with spaces for mysql_db module 2016-12-08 11:23:16 -05:00
ToBeReplaced 5e259a8dd9 Make ALL_IN_SCHEMA for tables affect views
ALL TABLES is considered to include views, so we must check for reltypes
'r' and 'v', not just 'r'. This bug was introduced due to using a
custom, backwards-compatible version of "ALL TABLES IN SCHEMA".
2016-12-08 11:23:15 -05:00
Bryan Fleming 6f8d60a5ed fixes #1120 - privileges using columns 2016-12-08 11:23:13 -05:00
Sergei Antipov e62f870859 mysql_user | Hide password 2016-12-08 11:23:08 -05:00
Greg DeKoenigsberg eb881d7d5d Proper author info for all remaining modules 2016-12-08 11:23:07 -05:00
Louis-Michel Couture 03240cfcb6 Update example to remove outdated information 2016-12-08 11:23:05 -05:00
Toshio Kuratomi fa60891f68 Fix a problem introduced with #1101 and optimize privilege handling
* If a db user belonged to a role which had a privilege, the user would
  not have the privilege added as the role gave the appearance that the
  user already had it.  Fixed to always check the privileges specific to
  the user.
* Make fewer db queries to determine if privileges need to be changed
  and change them (was four for each privilege.  Now two for each object
  that has a set of privileges changed).
2016-12-08 11:23:03 -05:00
Toshio Kuratomi 5027fc0642 Expand tildes and vars in the config file path 2016-12-08 11:23:03 -05:00
Will Thames 34e0e17090 Perform privilege grants/revokes only when required
Use `has_table_privileges` and `has_database_privileges`
to test whether a user already has a privilege before
granting it, or whether a user doesn't have  a privilege
before revoking it.
2016-12-08 11:23:03 -05:00
Toshio Kuratomi 4f42e752e6 Allow playbook specified login_user and login_password to override config file settings 2016-12-08 11:23:03 -05:00
Toshio Kuratomi 0af631499a Use a list comprehension instead of map and lambda 2016-12-08 11:23:02 -05:00
Toshio Kuratomi c291c2dfea Fix for the new import code when password is empty 2016-12-08 11:23:02 -05:00
Dennis Rowe 5109628693 Strip spaces around perms 2016-12-08 11:23:02 -05:00
Johann Schmitz 8f8109f1e0 Improved output of mysql_db plugin
Show error number and error description on connect error to ease debugging.
2016-12-08 11:23:02 -05:00
Jonathan Mainguy 7ab2ddbe2a escapeds changes
fixed merge conflict

remove uneeded regexs

arrays
2016-12-08 11:23:02 -05:00
Robin Miller a2f685a134 Replaced lambda functions with list comprehensions. 2016-12-08 11:23:02 -05:00
Robin Miller 8859a7cf8e Only revoke actually granted permissions, not 'ALL'.
This prevents errors when the login_user does not have 'ALL'
permissions, and the 'priv' value contains fewer permissions than are
held by an existing user. This is particularly an issue when using an
Amazon Web Services RDS instance, as there is no (accessible) user with
'ALL' permissions on *.*.
2016-12-08 11:23:01 -05:00
fdupoux e34c7f31dc Refactoring to avoid duplication of code which manages the decompression of database dumps in various formats 2016-12-08 11:23:01 -05:00
fdupoux 9b83311471 Simplify code which prepares the decompression command 2016-12-08 11:23:01 -05:00
Toshio Kuratomi dd4838e4aa Refactor dump compression and use get_bin_path for finding the compressors 2016-12-08 11:23:01 -05:00
fdupoux aa79810cc8 Decompress mysql dumps on the fly using python subprocess during an import to simplify operation 2016-12-08 11:23:01 -05:00
Jonathan Mainguy b25bc20d3d changes hostname to lowercase 2016-12-08 11:23:00 -05:00
Brian Coca 831af880f0 minor doc fix and made sure check_implicit_admin is true boolean 2016-12-08 11:23:00 -05:00
Toshio Kuratomi 5c96c5c9c2 Fix splitting of role_attrs 2016-12-08 11:23:00 -05:00
fdupoux 6f2f07ef51 Add support for xz compression (for dump and import) in mysql_db module 2016-12-08 11:22:59 -05:00
Jonathan Mainguy 1ba2e34ae1 Adds all_databases option which allows a user to dump or import all databases at once, identical to mysqldump --all-databases
fix line 132

Update to name=all

cleaned up all_database per abadger's suggestions
2016-12-08 11:22:57 -05:00
Will Thames 9aff204f63 Usage is not a valid database or table privilege
Remove `USAGE` from the `VALID_PRIVS` dict for both database and
table because it is not a valid privilege for either (and
breaks the implementation of `has_table_privilege` and
`has_database_privilege`

See http://www.postgresql.org/docs/9.0/static/sql-grant.html
2016-12-08 11:22:57 -05:00
Will Thames 43bad27948 Update postgresql users only when necessary
For read-only databases, users should not change when no changes
are required.

Don't issue ALTER ROLE when role attribute flags, users password
or expiry time is not changing.

In certain cases (hashed passwords in the DB, but the password
argument is not hashed) passlib.hash is required to avoid
running ALTER ROLE.
2016-12-08 11:22:56 -05:00
Julia Kreger 6f7cd5c307 Set default for mysql_user config_file
The default value set by the module was a value of None for the
config_file parameter, which propogates into the connect method
call overriding the stated default in the method.

Instead, the default should be set with-in the parameter
specification so the file check is not requested to check None.
2016-12-08 11:22:56 -05:00
Sven Schliesing 90d434d66d use default value for parameter config_file in connect() 2016-12-08 11:22:55 -05:00
muffl0n 62bc6f2ba6 Use MySQLdbs read_default_file 2016-12-08 11:22:55 -05:00
tedder 9fd568f655 code review fixes per #957 2016-12-08 11:22:52 -05:00
tedder 35ce9fb095 skip password changes so pg_authid isn't needed
Some places ([AWS RDS](https://forums.aws.amazon.com/thread.jspa?threadID=151248)) don't have, or don't allow, access to the `pg_authid` table. The only reason that is necessary is to check for a password change.

This flag is a workaround so passwords can only be set at creation time. It isn't as elegant as changing the password down the line, but it fixes the longstanding issue #297 that prevented this from being useful on AWS RDS.
2016-12-08 11:22:52 -05:00
Solomon Gifford d14bbf514e mysql_user #829: add update_password to mysql_user 2016-12-08 11:22:52 -05:00
Toshio Kuratomi e5ba4e87d8 Fix for int port assignment in a playbook failing
Ports are integer values but the old code was assuming they were
strings.  When login_port is put into playbook complex_args as an
integer the code would fail.  This update should make the argument
validating make sure we have an integer and then we can send that value
directly to the relevant APIs.

Fixes #818
2016-12-08 11:22:46 -05:00
Jonathan Mainguy 1608163b26 Now correctly gzip/bzips file back up in case of import failure
Removed gunzip and bunzip2 dependency
2016-12-08 11:22:46 -05:00
Toshio Kuratomi b9984b1dfe Fix documentation to have correct param name 2016-12-08 11:22:45 -05:00
David Hummel 63e9de3170 Fix issue #793: mysql_db: for state={absent,present} connections to database mysql fail for users other than root 2016-12-08 11:22:42 -05:00
Johannes Steger 1a440d6a06 Fix function identifier quoting 2016-12-08 11:22:39 -05:00
Toshio Kuratomi e11ea4b402 Also catch mysql errors so we can give the error message back through json rather than tracebacking 2016-12-08 11:22:37 -05:00
Bruce Pennypacker 605a5a5b53 requested changes 2016-12-08 11:22:37 -05:00
Bruce Pennypacker 9cbe3eb8ae Added support for 'REQUIRE SSL' grant option 2016-12-08 11:22:37 -05:00
Michael J. Schultz 588d03db8d Build the db connection on `"postgres"` instead of `"template1"`
According to the postgresql docs[1], you should not have a connection with
`"template1"` when copying multiple databases.

[1]: http://www.postgresql.org/docs/9.1/static/manage-ag-templatedbs.html
2016-12-08 11:22:36 -05:00
Jonathan Mainguy 13990e9479 adds error message if socket does not exist 2016-12-08 11:22:35 -05:00
kustodian 8621f9a7cd Fixed postgresql_db failing on Python 2.4 with --check
This reverts commit 81cbdb6c8cf54c41ba2ee3330c968e2feea05a5c and adds ignoring of the SystemExit exception because of Python 2.4.
2016-12-08 11:22:33 -05:00
Petros Moisiadis 63b18ae618 mysql_user: Added missing privileges
Added missing privileges 'CREATE TABLESPACE' and 'PROXY' (see: http://dev.mysql.com/doc/refman/5.5/en/privileges-provided.html).
2016-12-08 11:22:32 -05:00