Based on the documentation, 'wait_timeout' is 'Used in conjunction with instance_ids option'. This lead me to believe that I could not use this parameter to try and solve the 'Waited too long for ELB instances to be healthy' error I was experiencing.
This seems a little like duplicating code since all of the called
functions need it but prev_state isn't part of argument parsing so it
doesn't belong in the toplevel main() function.
It feels like this repeats itself because it pulls the creation of
a byte string for path into every state function. However, it actually
cleans the API by only passing a single parameter for a thing (the path)
instead of sending it in twice.
Well organized programs should only have a few successful exit points.
This commit moves all of the successful exit points for the file module
into the main() function. Other functions return their results to the
main function which can then choose whether there is more procesing to
do before exit or not.
Use an exception to return failures rather than fail_json(). This way
we can easily catch the failures if the calling code decides it can deal
with it. This has the side effect of making it easier to unittest this
code as we can catch the expected exceptions instead of having to catch
the interpreter exiting and then parse stdout for the expected data.
* Separate the logic for each state into separate functions
* Start the process of separating out initialization (pre-processing of
parameters that cannot be done via arg spec) from the logic to
implement each state.
* Start the process of raising exceptions for errors and returning
result values from each state implementing function Goal is for all
fail_json's to be consolidated into exception handlers at the toplevel
and for there to be only one exit_json() at the toplevel.
* Remove use of six.b as Python-2.6+ have byte literals.
* Make AnsibleModule a global object so we'll have access to it in all
the functions we're going to break this up into.
* Rework the parameters so things that are in file_common_args are used
from file_common_args or the reason for deviation is documented.
* Remove validate as a parameter: this should be taken care of by
removing it from params before the copy and template action plugin
invoke file.
* Rename diff_peek to _diff_peek as it is an internal parameter.
* add module_name execute_module call to assemble so that it is more greppable
* Removed forwarders parameter that did not work
* Updated coding conventions
* Added ssl_cipher_suite and ssl_protocols to bigip_device_httpd
* Added more unit tests
This PR includes:
- Fixes to the majority of module validation issues
(deliberate inconsistencies between docs and arg_spec)
- Removal of deprecated parameters 'method' and 'protocols'
- A few typos in the documentation
There are still some left-over validation errors, some are deliberate
(like doc strings as default to indicate ranges, etc.)