summaryrefslogtreecommitdiff
path: root/lib/ansible/constants.py
Commit message (Collapse)AuthorAgeFilesLines
* add_host/group_by: fix using changed_when in a loop (#71719)Martin Krizek2022-02-041-0/+1
| | | | Fixes #71627 Fixes #75971
* force version on deprecation (#74338)Brian Coca2021-04-261-6/+3
|
* All lookups ported to config system (#74108)Brian Coca2021-04-131-4/+7
| | | | | | | | | | | | | | | | * all lookups to support config system - added get_options to get full dict with all opts - fixed tests to match new error messages - kept inline string k=v parsing methods for backwards compat - placeholder depredation for inline string k=v parsing - updated tests and examples to also show new way - refactored and added comments to most custom k=v parsing - added missing docs for template_vars to template - normalized error messages and exception types - fixed constants default - better details value errors Co-authored-by: Felix Fontein <felix@fontein.de>
* [playbook] error on empty, error on 'include' (remove two deprecations) (#74172)Rick Elrod2021-04-091-1/+0
| | | | | | | | | | | | | | | | | | Change: - Remove two deprecated features - We now error if a playbook is an empty list instead of just skipping - We now error if using 'include' instead of 'import_playbook' Test Plan: - Added new tests for new errors Tickets: - Fixes #74133 Signed-off-by: Rick Elrod <rick@elrod.me> * sanity & changelog Signed-off-by: Rick Elrod <rick@elrod.me>
* Fix notify on import_tasks (#73572)Brian Coca2021-03-031-25/+25
| | | | | * Fix notify on import_tasks also able to apply to blocks now.
* Allow restricting config values to enumerated list (#73162)Brian Coca2021-01-141-0/+13
| | | | | | | * Allow restricting config values to enumerated list * dont document internal entries * also ignore private defs for ansible-config * remove invalid value from tests * added porting entry
* Replace some more FQCNs.Felix Fontein2020-11-051-1/+2
|
* Fix missing ansible.builtin FQCNs in hardcoded action names (#71824)Felix Fontein2020-11-031-4/+29
| | | | * Make sure hard-coded action names also check for FQCN. * Use _add_internal_fqcn() to avoid hardcoded lists and typoes.
* rethink wording (#70028)Brian Coca2020-10-301-1/+1
| | | | | | | * rethink wording * removed unrequired requirement * fix tests * fixed versions Co-authored-by: Sloane Hertel <shertel@redhat.com>
* Remove some constants.py deprecated items (#70466)Rick Elrod2020-07-071-35/+0
| | | | | | | | | | | | | | Change: - Remove mk_boolean - Remove BECOME_METHODS - Remove get_config Test Plan: - CI, removed mk_boolean unit tests Tickets: - Fixes #69678 Signed-off-by: Rick Elrod <rick@elrod.me>
* avoid constant checking controlpersist (#69910)Brian Coca2020-06-091-1/+1
| | | | * avoid constant checking controlpersist
* add collection plugin listing to ansible-doc (#68522)Brian Coca2020-03-311-0/+1
| | | | | - listing from collections - able to filter by namespace or collection - masks dupes just as normal collection loading does
* Revert "ansilbe-doc list collections plugins (#67928)"Matt Clay2020-03-281-1/+0
| | | | This reverts commit 0f5a63f1b99e586f86932907c49b1e8877128957.
* ansilbe-doc list collections plugins (#67928)Brian Coca2020-03-271-0/+1
| | | | | Now -l and -F will list plugins from discover-able collections
* prevent ansible_facts injection (#68431)Brian Coca2020-03-241-1/+1
| | | | | | | - also only replace when needed - switched from replace to index - added test to verify bogus_facts are not accepted CVE-2020-10684
* win - Allow FQCN for win_command and win_shellJordan Borean2020-03-051-2/+4
|
* Fix netconf plugin related to collections (#65718)Ganesh Nalawade2019-12-201-1/+1
| | | | | | | | | | | | | | | | | | | | | * Fix netconf plugin related to collections Fixes #65655 (partly) * Make netconf plugins configurable so that the information of ncclient device handler for give platform resides in the platform specific netconf plugin. * If the device handler value in ncclient is different from the ansible_network_os value the right value of `ncclient_device_handler` should be set in the plugin documentation. * Fix review comments * Fix CI issue * Fix review comment
* Support vars plugins in collections (#61078)Sloane Hertel2019-11-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | * Move var plugins handling to a separate file * Allow var plugins to require whitelisting * Add global configuration ('demand', 'start') for users to control when they execute * Add 'stage' configuration ('all', 'task', 'inventory') for users to control on a per-plugin basis when they execute * Update ansible-inventory and InventoryManager to the global and stage configuration * Update host_group_vars to use stage configuration and whitelisting * Add documentation for using new options and to the developer's guide * Add integration tests to exercise whitelisting and the new configuration options, using vars plugins in collections, and maintain backward compatibility * Changelog Co-Authored-By: Brian Coca <brian.coca+git@gmail.com> Co-Authored-By: Sandra McCann <samccann@redhat.com>
* removed previouslly deprecated settings (#55662)Brian Coca2019-05-151-15/+0
| | | | | | | | * removed previouslly deprecated settings fixes #55304 * also removed from play context
* Fine tune sanity (#53544)Brian Coca2019-03-111-1/+2
| | | | | | | | | * modify regex to use implicit charsets this should solve issues in py3 and unicode names * fix issue with subgroups in yaml inventory * clarify deprecation message * separated per name warning from deprecation * move noise to verbosity, simplify warnings * fix docs to reflect actual 'good' practice * change toggle to choice list to give users more options
* Add toggle to control invalid character substitution in group names (#52748)Brian Coca2019-03-061-0/+4
| | | | | | | | | | | | | | * make add_group return proper name * ensure central transform/check * added 'silent' option to avoid spamming current users those already using the plugins were used to the transformations, so no need to alert them * centralized valid var names * dont display dupes * comment on regex * added regex tests ini and script will now warn about deprecation * more complete errormsg
* Become plugins (#50991)Matt Martz2019-02-111-26/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * [WIP] become plugins Move from hardcoded method to plugins for ease of use, expansion and overrides - load into connection as it is going to be the main consumer - play_context will also use to keep backwards compat API - ensure shell is used to construct commands when needed - migrate settings remove from base config in favor of plugin specific configs - cleanup ansible-doc - add become plugin docs - remove deprecated sudo/su code and keywords - adjust become options for cli - set plugin options from context - ensure config defs are avaialbe before instance - refactored getting the shell plugin, fixed tests - changed into regex as they were string matching, which does not work with random string generation - explicitly set flags for play context tests - moved plugin loading up front - now loads for basedir also - allow pyc/o for non m modules - fixes to tests and some plugins - migrate to play objects fro play_context - simiplify gathering - added utf8 headers - moved option setting - add fail msg to dzdo - use tuple for multiple options on fail/missing - fix relative plugin paths - shift from play context to play - all tasks already inherit this from play directly - remove obsolete 'set play' - correct environment handling - add wrap_exe option to pfexec - fix runas to noop - fixed setting play context - added password configs - removed required false - remove from doc building till they are ready future development: - deal with 'enable' and 'runas' which are not 'command wrappers' but 'state flags' and currently hardcoded in diff subsystems * cleanup remove callers to removed func removed --sudo cli doc refs remove runas become_exe ensure keyerorr on plugin also fix backwards compat, missing method is attributeerror, not ansible error get remote_user consistently ignore missing system_tmpdirs on plugin load correct config precedence add deprecation fix networking imports backwards compat for plugins using BECOME_METHODS * Port become_plugins to context.CLIARGS This is a work in progress: * Stop passing options around everywhere as we can use context.CLIARGS instead * Refactor make_become_commands as asked for by alikins * Typo in comment fix * Stop loading values from the cli in more than one place Both play and play_context were saving default values from the cli arguments directly. This changes things so that the default values are loaded into the play and then play_context takes them from there. * Rename BECOME_PLUGIN_PATH to DEFAULT_BECOME_PLUGIN_PATH As alikins said, all other plugin paths are named DEFAULT_plugintype_PLUGIN_PATH. If we're going to rename these, that should be done all at one time rather than piecemeal. * One to throw away This is a set of hacks to get setting FieldAttribute defaults to command line args to work. It's not fully done yet. After talking it over with sivel and jimi-c this should be done by fixing FieldAttributeBase and _get_parent_attribute() calls to do the right thing when there is a non-None default. What we want to be able to do ideally is something like this: class Base(FieldAttributeBase): _check_mode = FieldAttribute([..] default=lambda: context.CLIARGS['check']) class Play(Base): # lambda so that we have a chance to parse the command line args # before we get here. In the future we might be able to restructure # this so that the cli parsing code runs before these classes are # defined. class Task(Base): pass And still have a playbook like this function: --- - hosts: tasks: - command: whoami check_mode: True (The check_mode test that is added as a separate commit in this PR will let you test variations on this case). There's a few separate reasons that the code doesn't let us do this or a non-ugly workaround for this as written right now. The fix that jimi-c, sivel, and I talked about may let us do this or it may still require a workaround (but less ugly) (having one class that has the FieldAttributes with default values and one class that inherits from that but just overrides the FieldAttributes which now have defaults) * Revert "One to throw away" This reverts commit 23aa883cbed11429ef1be2a2d0ed18f83a3b8064. * Set FieldAttr defaults directly from CLIARGS * Remove dead code * Move timeout directly to PlayContext, it's never needed on Play * just for backwards compat, add a static version of BECOME_METHODS to constants * Make the become attr on the connection public, since it's used outside of the connection * Logic fix * Nuke connection testing if it supports specific become methods * Remove unused vars * Address rebase issues * Fix path encoding issue * Remove unused import * Various cleanups * Restore network_cli check in _low_level_execute_command * type improvements for cliargs_deferred_get and swap shallowcopy to default to False * minor cleanups * Allow the su plugin to work, since it doesn't define a prompt the same way * Fix up ksu become plugin * Only set prompt if build_become_command was called * Add helper to assist connection plugins in knowing they need to wait for a prompt * Fix tests and code expectations * Doc updates * Various additional minor cleanups * Make doas functional * Don't change connection signature, load become plugin from TaskExecutor * Remove unused imports * Add comment about setting the become plugin on the playcontext * Fix up tests for recent changes * Support 'Password:' natively for the doas plugin * Make default prompts raw * wording cleanups. ci_complete * Remove unrelated changes * Address spelling mistake * Restore removed test, and udpate to use new functionality * Add changelog fragment * Don't hard fail in set_attributes_from_cli on missing CLI keys * Remove unrelated change to loader * Remove internal deprecated FieldAttributes now * Emit deprecation warnings now
* become_method: make dzdo more like sudo (#47946)James Cassell2018-12-041-1/+1
| | | | | | | dzdo is basically a drop-in replacement for sudo and supports the same command line options. There is no become_flags set for dzdo like there is for sudo, so users will have to set that separately to have exactly the same functionality.
* Add a Singleton metaclass, use it with Display (#48935)Matt Martz2018-11-201-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | * Add a Singleton class, use it with Display * update six import * Move remaining failes to display singleton * Fix rebase issues * Singleton improvements * Add code-smell for 'from __main__ import display'. ci_complete * s/self/cls/g * Add docs for no-main-display * Address linting issues * Add changelog fragment. ci_complete * Implement reentrant lock for class instantiation in Singleton * Add Display singleton porting guide
* fix typo in constants.py (#48877)Lukas Grossar2018-11-201-1/+1
| | | * CONTROLER_LANG => CONTROLLER_LANG
* Update ansible-doc for invariants in the metadata/plugin_doc apiToshio Kuratomi2018-10-311-1/+1
| | | | | | | * There will always be metadata returned so no need to check for its existence first. * There won't be version or metadata_version as those are being removed by the api. So all checks for those need to be removed.
* Fix from sivel for ansible-docToshio Kuratomi2018-10-251-1/+1
| | | | | | * Major slow down due to using the wrong loader for plugin_types * traceback due to adding httpapi and cliconf plugins to the plugins we allow ansible-doc to process
* cisco firepower : Make API endpoints configurable via hostvars (#44952)Deepak Agrawal2018-08-311-1/+1
| | | | | | | | * httpapi host vars * Make configurable end-points for firepower * pep8 fix
* We can create a frozenset from a tupleToshio Kuratomi2018-08-131-3/+3
| | | | No need to create an intermediate set.
* Fix spelling of ansbile to ansible (#43898)Ryan Brown2018-08-091-1/+1
|
* Fix fact cleaning (#42595)Brian Coca2018-07-121-4/+8
| | | | | | * fix fact cleanup fixes #41684
* Update eos, ios, vyos cliconf plugin (#42300)Ganesh Nalawade2018-07-041-1/+1
| | | | | | | | | | | * Update eos cliconf plugin methods * Refactor eos cliconf plugin * Changes in eos module_utils as per cliconf plugin refactor * Fix unit test and sanity failures * Fix review comment
* ignore ansible.cfg in world writable cwd (#42070)Brian Coca2018-06-291-1/+14
| | | | | * ignore ansible.cfg in world writable cwd * also added 'warnings' to config * updated man page template
* adds ansible-doc JSON plugin data dumpMatt Davis2018-06-041-1/+1
| | | | * used for changelog generation of new plugins
* Fix error reporting on bad type for config settingBrian Coca2018-06-011-1/+2
|
* Add a 'machinectl shell' become_method (#39826)Antoine Pietri2018-05-251-1/+3
| | | | | | | | * Add a 'machinectl shell' become_method * docs: add explanations for the machinectl become_method * docs: machinectl become_method: specify this part is specific to Linux+systemd setups
* centralize doc/config plugin lists (#38775)Brian Coca2018-04-161-0/+4
| | | | | | | | | | | | | * centralize doc/config plugin lists also update list for generation in docsite added note to ensure they are in sync * updated shell page to list plugins added some more docs hinting at plugins being configurable * fix edit link for plugins
* Move module_set_locale and module_lang back to globalToshio Kuratomi2018-01-221-3/+3
| | | | | These config settings are being deprecated so we don't want people to think they need to implement them for their new shell plugin.
* Temporary (#31677)Brian Coca2018-01-151-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * allow shells to have per host options, remote_tmp added language to shell removed module lang setting from general as plugins have it now use get to avoid bad powershell plugin more resilient tmp discovery, fall back to `pwd` add shell to docs fixed options for when frags are only options added shell set ops in t_e and fixed option frags normalize tmp dir usag4e - pass tmpdir/tmp/temp options as env var to commands, making it default for tempfile - adjusted ansiballz tmpdir - default local tempfile usage to the configured local tmp - set env temp in action add options to powershell shift temporary to internal envvar/params ensure tempdir is set if we pass var ensure basic and url use expected tempdir ensure localhost uses local tmp give /var/tmp priority, less perms issues more consistent tempfile mgmt for ansiballz made async_dir configurable better action handling, allow for finally rm tmp fixed tmp issue and no more tempdir in ballz hostvarize world readable and admin users always set shell tempdir added comment to discourage use of exception/flow control * Mostly revert expand_user as it's not quite working. This was an additional feature anyhow. Kept the use of pwd as a fallback but moved it to a second ssh connection. This is not optimal but getting that to work in a single ssh connection was part of the problem holding this up. (cherry picked from commit 395b714120522f15e4c90a346f5e8e8d79213aca) * fixed script and other action plugins ensure tmpdir deletion allow for connections that don't support new options (legacy, 3rd party) fixed tests
* Fixes eos sending 'None' to device (#33015)Nathaniel Case2017-11-171-3/+5
| | | | | | * Fix network_cli sometimes sending 'None' to device * Also fix `--become-method=enable`
* updated chlog, moved missed commentBrian Coca2017-11-091-0/+5
|
* namespace factsBrian Coca2017-11-091-0/+55
| | | | | | updated action plugins to use new guranteed facts updated tests to new data clean added cases for ansible_local and some docstrings
* Make newer stuff PEP8 compliant (#26951)Dag Wieers2017-11-051-6/+5
| | | | | | | | | So we fixed everything that was not a module to be PEP8 compliant, and in the meantime these 5 new files were additionally disabled from PEP8 testing. This fixes it. Also update Copyright/License statements.
* Fix backwards compatibility of constants.get_configDavid Moreau-Simard2017-10-031-2/+2
| | | | | | | get_config would use ConfigManager.get_ini_value which does not exist. What we are meant to use is ansible.config.manager.get_ini_config_value and this method does not expect a list, only a dictionary with a section and a key.
* moved from eval to templating + literal_evalBrian Coca2017-09-201-8/+15
|
* constants as tuples instead of lists/setsBrian Coca2017-09-201-6/+6
|
* fixed 'typing' for deprecated get_configBrian Coca2017-09-141-4/+2
|
* only eval values if set from defaultsBrian Coca2017-09-121-5/+11
|
* Fix handling of config vars with eval expression (#29536)Ricardo Carrillo Cruz2017-09-111-1/+1
| | | | | | The config variables defined with eval, like INVENTORY_IGNORE_EXTS, are not stored properly once the eval is processed. This causes references to the constant to still have the eval in the value.
* fixes to config/setting retrievalBrian Coca2017-09-091-10/+11
| | | | | | | | | | | | | | | | | | | | | | - better variable precedence management - universal plugin option handling - also updated comments for future directions - leverage fragments for plugins - removed fact namespacing - added 'firendly name' field - updated missing descriptions - removed some unused yaml entries, updated others to reflect possible future - documented more plugins - allow reading docs using alias - short licenses - corrected args for 'all plugins' - fixed -a option for ansible-doc - updated vars plugins to allow docs - fixed 'gathering' - only set options IF connection - added path list and renamed pathspec mostly the diff is , vs : as separator - readded removed config entries that were deprecated but had no message ... and deprecated again - now deprecated entries give warning when set