* Fix 'defaults' option in the nxos_config module
Nxos get_config is allways called with the 'all' option.
* Fix flag's calculation
* Add tests
* nxos_config: the 'backup' option take into account the value of 'defaults' option
If 'defaults' option is true, the running-config backup is done with the all
keyword.
* dataloader: unit tests
Based on work from Alikins (https://github.com/ansible/ansible/pull/16500)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* review comments
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* removed info declaration from documentation fragment as this is not implemented
* added optional headers for POST and PUT requests
* updated documentation
* added missing headers field decalaration
* removed info choice from state field
* added tests for the new utm_utils function
* fixed class invocation
* added missing required params
* fixed the pytests
* added timestamps to nxos_command module
nxos_command module now returns timestamps field, which shows command execution time
* fixed unit test failure for /lib/ansible/module_utils/basic
* cosmetic changes to align with PEP 8
* Fix encoding issues with file paths.
Discovered while testing with ANSIBLE_CONFIG env var set to a path
that contained unicode characters while LC_ALL=C.
* Fix unit tests.
* Fix another path encoding issue.
* Pluribus Networks port cos bw module
* Indentation fix
* Documentation fix
* Corrected indetentation for required_one_of
* Added maintainer name in BOTMETA.yml
* Removed maintainer name in BOTMETA.yml as my team is already there
* Add checkpoint httpapi plugin and access rule facts module
* WIP checkpoint_access_rule module
* Add publish and install policy, plus fix empty json object request for publish
* Refactor publish and install_policy onto module_utils
* Add update resource logic
* Add checkpoint_host_facts module
* Return code and response on get_acess_rule function
* Add checkpoint_host module
* Add checkpoint_run_script module
* Add checkpoint_task_facts module
* Show all tasks if no task id is passed
Note, this is only available on v1.3 of Checkpoint WS API
* Add update logic to checkpoint host
* Add full details on get task call
* Add checkpoint httpapi plugin
* Fix pep8
* Use auth instead of sid property and return False on handle_httperror method
* Fix version in docstring
* Remove constructor
* Remove Accept from base headers
* Do not override http error handler and assign Checkpoint sid to connection _auth
There is scaffolding in the base class to autoappend the token, given
it is assigned to connection _send
* Use new connection queue message method instead of display
* Remove unused display
* Catch ValueError, since it's a parent of JSONDecodeError
* Make static methods that are not used outside the class regular methods
* Add missing self to previously static methods
* Fix logout
Was carrying copy pasta from ftd plugin
* Remove send_auth_request
* Use BASE_HEADERS constant
* Simplify copyright header on httpapi plugin
* Remove access rule module
* Remove unused imports
* Add unit test
* Fix pep8
* Add test
* Add test
* Fix pep8
User module can contain Indentation errors or syntax errors.
Handle AST exceptions rather than showing traceback while importing such module.
Fixes: #21707
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* Note: Python2 is not as intelligent at detecting false import loops as
Python3. context_objects.py cannot be added to cli/arguments because it
would set up an import loop between cli/__init__.py,
cli/arguments/context_objects.py, and context.py on Python2.
ci_complete
The goal of breaking apart the base_parser() function is to get rid of
a bunch of conditionals and parameters in the code and, instead, make
code look like simple composition.
When splitting, a choice had to be made as to whether this would operate
by side effect (modifying a passed in parser) or side effect-free
(returning a new parser everytime).
Making a version that's side-effect-free appears to be fighting with the
optparse API (it wants to work by creating a parser object, configuring
the object, and then parsing the arguments with it) so instead, make it
clear that our helper functions are modifying the passed in parser by
(1) not returning the parser and (2) changing the function names to be
more clear that it is operating by side-effect.
Also move all of the generic optparse code, along with the argument
context classes, into a new subdirectory.
* Once cli args are parsed, they're constant. So, save the parsed args
into the global context for everyone else to use them from now on.
* Port cli scripts to use the CLIARGS in the context
* Refactor call to parse cli args into the run() method
* Fix unittests for changes to the internals of CLI arg parsing
* Port callback plugins to use context.CLIARGS
* Got rid of the private self._options attribute
* Use context.CLIARGS in the individual callback plugins instead.
* Also output positional arguments in default and unixy plugins
* Code has been simplified since we're now dealing with a dict rather
than Optparse.Value
* Move get_all_subclasses out of sys_info as it is unrelated to system
information.
* get_all_subclasses now returns a set() instead of a list.
* Don't port get_platform to sys_info as it is deprecated. Code using
the common API should just use platform.system() directly.
* Rename load_platform_subclass() to get_platform_subclass and do not
instantiate the rturned class.
* Test the compat shims in module_utils/basic.py separately from the new
API in module_utils/common/sys_info.py and module_utils/common/_utils.py
* Fix Issue #39598
Signed-off-by: Anas Badaha <anasb@mellanox.com>
* Fix unit test for onyx_config
Signed-off-by: Anas Badaha <anasb@mellanox.com>
* Add comments for save running config
Signed-off-by: Anas Badaha <anasb@mellanox.com>
* Enhance onyx_config bug fix
Signed-off-by: Anas Badaha <anasb@mellanox.com>
* Fix result['changed'] = True comment
Signed-off-by: Anas Badaha <anasb@mellanox.com>
* Refactoring of cnos_interface module like what followed by other vendors
* To remove cnos-interface from E326 validation ignore list
* Effect of default parameters impacted UT
* Revert "allow caller to deal with timeout (#49449)"
This reverts commit 63279823a7.
Flawed on many levels
* Adds poor API to a public function
* Papers over the fact that the public function is doing something bad
by catching exceptions it cannot handle in the first place
* Papers over the real cause of the issue which is a bug in the timeout
decorator
* Doesn't reraise properly
* Catches the wrong exception
Fixes#49824Fixes#49817
* Make the timeout decorator properly raise an exception outside of the function's scope
signal handlers which raise exceptions will never work well because the
exception can be raised anywhere in the called code. This leads to
exception race conditions where the exceptions could end up being
hanlded by unintended pieces of the called code.
The timeout decorator was using just that idiom. It was especially bad
because the decorator syntactically occurs outside of the called code
but because of the signal handler, the exception was being raised inside
of the called code.
This change uses a thread instead of a signal to manage the timeout in
parallel to the execution of the decorated function. Since raising of
the exception happens inside of the decorator, now, instead of inside of
a signal handler, the timeout exception is raised from outside of the
called code as expected which makes reasoning about where exceptions are
to be expected intuitive again.
Fixes#43884
* Add a common case test.
Adding an integration test driven from our unittests. Most of the time
we'll timeout in run_command which is running things in a subprocess.
Create a test for that specific case in case anything funky comes up
between threading and execve.
* Don't use OSError-based TimeoutError as a base class
Unlike most standard exceptions, OSError has a specific parameter list
with specific meanings. Instead follow the example of other stdlib
functions, concurrent.futures and multiprocessing and define a separate
TimeoutException.
* Add comment and docstring to point out that this is not hte Python3 TimeoutError
* Fix example in ini.py
* Fix unittest in test_ini.py to pass CI as latest ansible returns list in
different order. To prevent such issues in future results are sorted
* PEP8 E501 styling improvements
Co-Authored-By: Sergii Golovatiuk <sgolovat@redhat.com>
* Allow tags to be templated from a variable. Fixes#49825
* Restore _load_tags to ensure we do csv tag splitting
* Add tests for csv tags and templated tags
* evaluate_tags doesn't need to accept strings, because _load_tags handles this
Since the 'platform.dist()' and 'platform.linux_distribution()'
methods will be removed from future versions of python, this
provides an alternative to replace ansibles use of those
methods.
lib/ansible/module_utils/distro.py is a copy of
https://github.com/nir0s/distro/blob/master/distro.py
This module is originally from https://github.com/nir0s/distro
and is license under the Apache License, Version 2.0.
* In some cases, it appears that Exception should have been used instead
as there's no need to catch sys.exit KeyboardInterrupt and similar.
* In a few cases, it appears that BaseException is used because
a library we depend on calls sys.exit() contrary to good coding
design. Comment those so that we know that those have been audited
and found to be correct and change to use (Exception, SystemExit)
instead.
This work enables to add sit tunnel via nmcli module
Signed-off-by: Susant Sahani susant@redhat.com
SUMMARY
ISSUE TYPE
Feature Pull Request
COMPONENT NAME
nmcli
ANSIBLE VERSION
2.8
ADDITIONAL INFORMATION
- nmcli:
state: present
type: sit
conn_name: sit_test1
autoconnect: yes
ip_tunnel_dev: enp0s8
ip_tunnel_local: 192.168.1.2
ip_tunnel_remote: 192.168.1.5
- Require username and password for unregistering and avoid "cannot marshal None unless allow_none is enabled" error when using an activation key and no channels specified.
- Update test fixtures and add changelog
Co-authored-by: WhyIsThisOpen <WhyIsThisOpen@users.noreply.github.com>
* Pluribus Networks pn access list ip module with unit test cases
* Changes according to ansibot standards in unit test modules
* Remove unwanted variables
* Removed unwanted super call
* set ansible_os_family from name variable in os-release for clearlinux system
Signed-off-by: Josue David Hernandez Gutierrez <josue.d.hernandez.gutierrez@intel.com>
* Add os_family for clear linux and clear linux mixes
Signed-off-by: Josue David Hernandez Gutierrez <josue.d.hernandez.gutierrez@intel.com>
* Consolidate handler tracking
- Remove unused code. ci_complete
- unit test fixes. ci_complete
- Restore previous behavior of matching a single handler
- when notifying a host for a handler, return True if it was added, False otherwise, to reduce copied logic
- rename funcitons for clarity. ci_complete
- Remove handler logic for static includes which was disabled previously
* Simplify permission changing code for rabbitmq_user module
* Add check for multiple permission dicts for same host to rabbitmq_user module
* Add docstring for _get_permission method of rabbitmq_user
* Fix method that compares vhost permissions in rabbitmq_user
* Add tests for rabbitmq_user module
* Add helper function for simulating collections.Counter functionality
* Fix for changes in clearlinux
clearlinux is now providing /etc/os-release file and ansible is identifying as NA
then this change allow ansible to find it
Signed-off-by: Josue David Hernandez Gutierrez <josue.d.hernandez.gutierrez@intel.com>
* Add changelog fragment for clearlinux changes
Signed-off-by: Josue David Hernandez Gutierrez <josue.d.hernandez.gutierrez@intel.com>
* Add error message for k=v and YAML in a single task
Find the correct line, column, and position for k=v errors since they are different than the position reported initially.
Document bug in quoting syntax check.
* Change tense or error message
Since the error still exists, switch to present tense rather than past tense.
* Remove double spaces after periods in error messages.
http://www.slate.com/articles/technology/technology/2011/01/space_invaders.html
* Add changelog fragment
* Add tests for new error message
* Fix tests
* Add clarifying comments to unit test
* VMware: Fix module usages in module_utils
* Skip test for Python 2.6 as SSL context is not available in Python 2.6
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
* add redshift_cross_region_snapshots module, unit tests.
* fix errors
* use ec2_argument_spec as the basis for the argument spec. fixed
metadata_version
* follow best practices by naming example tasks.
* code review changes
* fix linting errors
* Update version added
* add new options for na_ontap_aggregate
* add gpl line
* remove dup option
* Put files in wrong directory
* change unit test to match the request from PR 48941
* Changed for review comments
* pep8
* templar: ensure that exceptions are handled
* Fix AttributeError: object has no attribute 'message'
'message' attribute is deprecated since Python 2.6 and not available
with Python 3.
Simple reproducer:
- hosts: localhost
vars:
not_json: "{{ 'test str' | from_json }}"
tasks:
- command: "echo {{ not_json }}"
* test for openstack inventory constructed functionality
this adds unit tests for the compose, groups, and keyed_var features
of the openstack inventory plugin
* fix constructed functionality in openstack inventory plugin
The compose, groups, and keyed_groups functionality of the openstack
inventory plugin was broken:
- the plugin was not passing the correct variables to the
Constructable methods for compose and groups
- the plugin was simply never calling the appropriate method for
implementing keyed_groups
This commit fixes both issues.
* Initial Commit
* Initial Commit
* Initial Commit
* Fixing syntax errors
* After running sanity tests, fixed pylint and pep8 errors
* After running sanity tests, fixed pylint and pep8 errors
* Fixing more syntax issues
* Fixing more syntax issues
* Adding username to doc block
* PR candidate
* PR candidate
* fixed pep8 and docs issues
* fixed 2.6 function issues
* fixed 2.6 function issues part duex
* Initial commit for security profile group module
* Adding better playbook example to module
* Adding another commit to test shippable tests
* Fixing shippable errors, pep8 in unit test file and doc block problem in main module
* Fixing documentation module error
* Fixing pep8 line too long in unit test
* Fixing utility function with nested dictionaries
* Fixing utility function with pep8 issue
* Adding change to allow for multiple list of dictionaries to be submitted via a single playbook
* Fixing review changes
* Adding @ in author names per @Gundalow's request per Ansible's guidelines
* Initial Commit
* Initial Commit
* Initial Commit
* Fixing syntax errors
* After running sanity tests, fixed pylint and pep8 errors
* After running sanity tests, fixed pylint and pep8 errors
* Fixing more syntax issues
* Fixing more syntax issues
* Adding username to doc block
* PR candidate
* PR candidate
* fixed pep8 and docs issues
* fixed 2.6 function issues
* fixed 2.6 function issues part duex
* Initial commit for security profile group module
* Adding better playbook example to module
* Initial commit for FMG DNS security profile
* Fixing pep8 line too long in unit test
* Removing excess modules and unit tests
* Fixing trailing white space for dns module
* Fixing utility function with nested dictionaries
* Fixing utility function with pep8 issue
* Adding change to allow for multiple list of dictionaries to be submitted via a single playbook
* Fixing review changes
* Adding @ in author names per @Gundalow's request per Ansible's guidelines
* Needs unit test fix -- the "delete" calls a GET command and another function to get policy ID of a firewall policy before deleting it. Nested functions like this, where a GET occurs to determine a new call, breaks the unitTestGen output. Need to figure out what's going on, and adjust the generator.
* PR Candidate
* PR Candidate (fixes)
* Reverting
* Fixing Edits.
* Fixing Authors - Fixing Requested Changes
* Initial Commit
* Initial Commit
* Initial Commit
* Fixing syntax errors
* After running sanity tests, fixed pylint and pep8 errors
* After running sanity tests, fixed pylint and pep8 errors
* Fixing more syntax issues
* Fixing more syntax issues
* Adding username to doc block
* PR candidate
* PR candidate
* fixed pep8 and docs issues
* fixed 2.6 function issues
* fixed 2.6 function issues part duex
* Initial commit for security profile group module
* Adding better playbook example to module
* Adding another commit to test shippable tests
* Fixing shippable errors, pep8 in unit test file and doc block problem in main module
* Fixing documentation module error
* Fixing pep8 line too long in unit test
* Fixing utility function with nested dictionaries
* Fixing utility function with pep8 issue
* Adding change to allow for multiple list of dictionaries to be submitted via a single playbook
* Initial commit for FMG Security Profile Web Application Firewall
* adding extra line at bottom for pep8 conditions
* Adding descriptions to documentation
* Fixing more pep8 issues
* New commit for new PR
* Removing todo in documentation
* Changing module name in documentation to match actual module name
* Fixing yaml syntax for long choices list
* Fixing yaml syntax for long choices list
* Fixing review changes
* Adding @ in author names per @Gundalow's request per Ansible's guidelines
* Initial Commit
* Initial Commit
* Initial Commit
* Fixing syntax errors
* After running sanity tests, fixed pylint and pep8 errors
* After running sanity tests, fixed pylint and pep8 errors
* Fixing more syntax issues
* Fixing more syntax issues
* Adding username to doc block
* PR candidate
* PR candidate
* fixed pep8 and docs issues
* fixed 2.6 function issues
* fixed 2.6 function issues part duex
* Initial commit for security profile group module
* Adding better playbook example to module
* Adding another commit to test shippable tests
* Fixing shippable errors, pep8 in unit test file and doc block problem in main module
* Fixing documentation module error
* Fixing pep8 line too long in unit test
* Fixing utility function with nested dictionaries
* Fixing utility function with pep8 issue
* Adding change to allow for multiple list of dictionaries to be submitted via a single playbook
* Initial commit for FMG Security Profile Web Application Firewall
* adding extra line at bottom for pep8 conditions
* Adding descriptions to documentation
* Fixing more pep8 issues
* New commit for new PR
* Removing todo in documentation
* Changing module name in documentation to match actual module name
* Fixing yaml syntax for long choices list
* Fixing yaml syntax for long choices list
* Initial commit for fmgr web filter security profile
* Fixing pep8 syntax issues
* Fixing documentation yaml syntax errors with choices on new lines
* Fixing documentation yaml syntax errors, removing Todo comments
* Fixing choices additional tab
* Fixing choices on multiple lines
* Fixing choices on multiple lines
* Adding yaml block scalar for multiline choices
* Changing YAML syntax for multiline to YAML sequence for choices
* Fixing all sanity test errors
* Fixing review changes
* Adding @ in author names per @Gundalow's request per Ansible's guidelines
* Initial Commit
* Initial Commit
* Initial Commit
* Fixing syntax errors
* After running sanity tests, fixed pylint and pep8 errors
* After running sanity tests, fixed pylint and pep8 errors
* Fixing more syntax issues
* Fixing more syntax issues
* Adding username to doc block
* PR candidate
* PR candidate
* fixed pep8 and docs issues
* fixed 2.6 function issues
* fixed 2.6 function issues part duex
* Initial commit for security profile group module
* Adding better playbook example to module
* Adding another commit to test shippable tests
* Fixing shippable errors, pep8 in unit test file and doc block problem in main module
* Fixing documentation module error
* Fixing pep8 line too long in unit test
* Fixing utility function with nested dictionaries
* Fixing utility function with pep8 issue
* Adding change to allow for multiple list of dictionaries to be submitted via a single playbook
* Initial commit for FMG Security Profile Web Application Firewall
* adding extra line at bottom for pep8 conditions
* Adding descriptions to documentation
* Fixing more pep8 issues
* New commit for new PR
* Removing todo in documentation
* Changing module name in documentation to match actual module name
* Fixing yaml syntax for long choices list
* Fixing yaml syntax for long choices list
* Initial commit for fmgr web filter security profile
* Initial commit for SSL and SSH security profiles in FMG
* Fixing pep8 syntax issues
* Adding better playbook example
* Fixing review changes
* Adding @ in author names per @Gundalow's request per Ansible's guidelines
* FTD modules: bug fixes and upsert functionality
* Fix sanity checks
* Fix unit tests for Python 2.6
* Log status code for login/logout
* Use string formatting in logging
This will allow tests to be carried out condtionally if necessary
using regexp include and/or exclude filters
Reorganize imports into alphabetical order for easier insertion
* win_update: Add post search category matching to support product matching
* win_updates: Return categories of each update
* win_updates: Documentation fix-up
* win_updates: Adjusted documentation to reflect regex vs sub-string match of post-cat strings
* win_updates: Sped up post-category checking
* win_updates: Updated documentation to suggest querying post-category strings
* win_updates: Simplified saving and checking post-categories
* fixed some issues and added filtered categories to return value
* win_updates: Moved all category matching to occur after initial search
* win_updates: Adjustments to satisfy PowerShell lint checks
* win_updates: Dropped category validation from action plugin
* win_updates: Documentation updates
* win_updates: Fixed plugin unit tests
* yum also parse obsolete package output
This is a rebase of the patch originally proposed in
https://github.com/ansible/ansible/pull/40001 by machacekondra
Fixes#39978
Signed-off-by: Adam Miller <admiller@redhat.com>
* properly parse the obsoletes, provide a new output entry, add changelog
Signed-off-by: Adam Miller <admiller@redhat.com>
* make pep8 happy
Signed-off-by: Adam Miller <admiller@redhat.com>
* remove q debugging output
Signed-off-by: Adam Miller <admiller@redhat.com>
* More generic comparison code from docker_container to docker_common.
* More flexibility if a is None and method is allow_to_present.
Note that this odes not affect docker_container, as there a is never None.
* Update docker_secret and docker_config: simplify labels comparison.
* Added unit tests.
* Use proper subsequence test for allow_more_present for lists.
Note that this does not affect existing code in docker_container, since lists
don't use allow_more_present. Using allow_more_present will only be possible
in Ansible 2.8.
* pep8