Commit graph

195 commits

Author SHA1 Message Date
Matt Davis
f7dfa817ae
collection routing (#67684)
* `meta/` directory in collections
* runtime metadata for redirection/deprecation/removal of plugin loads
* a compatibility layer to keep existing content working on ansible-base + collections
* a Python import redirection layer to keep collections-hosted (and otherwise moved) content importable by things that don't know better
* supported Ansible version validation on collection loads
2020-05-26 09:42:06 -07:00
Brian Coca
06ecdaa7b1
comment heavy playbook (#68981)
* create examples/play.yml


Co-authored-by: flowerysong <junk+github@flowerysong.com>
2020-05-19 17:27:08 -04:00
Rick Elrod
98fbd1b72f lint
Signed-off-by: Rick Elrod <rick@elrod.me>
2020-05-07 21:44:13 -05:00
Toshio Kuratomi
39b3942048 Remove left hand side slicing
Left hand side slicing is confusing and slower but maybe more memory
efficient in some circumstances.  There is one case where it adds to
code safety: when it's used to substitute a different list in place of a
slice of the original list and the original list could have been bound
to a different variable in some other code.  (The most likely case of
this is when it's a global variable and some other code might import
that variable name).

Because of the confusion factor we think it should only be used for the
safety case or where it's been benchmarked and shown to have some sort
of documentatble improvement.  At the moment, only one piece of code
falls into those categories so this PR removes all the other instances
of left hand side slicing.
2020-05-06 09:56:40 -07:00
Matt Clay
122743ae30
Update ansible-test handling of delegation paths. (#69056) 2020-04-20 22:04:25 -07:00
jctanner
f11b1454bb
prepare for future ansibot collection changes (#68944) 2020-04-14 13:11:05 -04:00
Matt Clay
4fc10186b9
Move coding guidelines links to readme. (#68479) 2020-03-26 15:19:01 -04:00
Matt Clay
206896e9b2
Cleanup refs to deleted files/dirs. (#68480)
* Remove deleted contrib dir from MANIFEST.in

* Update package-data sanity test.

Remove deleted files and directories.

* Remove aws_config dirs.
2020-03-25 19:10:27 -07:00
jctanner
c067beecda
disable bot notification spam (#68460)
* disable bot notification spam

* add new key to botmeta sanity
2020-03-25 11:45:53 -04:00
Jordan Borean
48bef155fd
Ignore test files in new package-data sanity test (#68452) 2020-03-25 10:57:14 +10:00
Matt Davis
ed9de94ad9
remove azure extras and extras_require support (#67822)
* remove azure extras and extras_require support

* Since Azure will be collectionized, the requirements will float more frequently than Ansible releases; the Azure collection needs to host the requirements now.
* Removed the dynamic extras support as well, since Azure was the only thing using it. If we need it again, it's easy to pull back from history.

* Mark azure-requirements as orhpaned.

This keeps the docs around so that existing links from old test runs remain valid.

Co-authored-by: Matt Clay <matt@mystile.com>
2020-03-23 13:07:33 -07:00
Matt Clay
f963c8ca3d Update no-unwanted-files sanity test.
This prepares for an additional path to be present after migration.
2020-03-04 14:03:35 -08:00
Matt Clay
b26ceb57ce Remove file exists check from botmeta sanity test.
Many of the paths in botmeta will no longer exist after migration, making this check pointless.
2020-03-04 14:03:09 -08:00
Matt Clay
b68e55da26
Remove test/legacy/ directory. (#67786)
* Remove `test/legacy/` directory.

* Remove references to `test/legacy/` directory.

* Update the remaining valid legacy reference.

* Remove outdated legacy references.
2020-02-26 11:48:30 -08:00
Matt Clay
19f6fc68d4
Relocate Shippable tools. (#67556)
* Move Shippable tools to hacking directory.

These limits the `test/utils/shippable/` directory to scripts required for CI.

* Fix `test/utils/shippable/` file classification.

* Update package-data sanity test.
2020-02-19 09:55:34 -08:00
John R Barker
322a4dc691
BOTMETA migrated_to should be namespace.collection (#64029) 2019-12-03 19:20:58 +00:00
Martin Krizek
c4b83619a6 botmeta sanity: check migrated_to on non-existing file (#64551) 2019-11-07 14:12:10 -05:00
John R Barker
1e8765f0d9
BOTMETA support migrated_to (#63952)
* BOTMETA support migrated_to

Allow BOTMETA to define if this part of the codebase has moved
into a Collection on Galaxy.
See also https://github.com/ansible/ansible/pull/63935

* Enforce migrated_to URL format

* pep8
2019-10-28 11:02:31 +00:00
Toshio Kuratomi
f58899eef7 Update release name for 2.10
Add a list of previously used release names to make it easy to tell what
release names are no longer usable.

Add a test that new release names have been added to the used list.

Fixes #61616
2019-09-05 18:36:06 -07:00
Matt Clay
cca4eb71e3
Update sanity tests for collections. (#61352)
* Remove pointless sanity tests on `bin` dir.

* Update action-plugin-docs test for collections.

* Update no-main-display test for collections.

* Update empty-init test for collections.

* Update no-assert test for collections.

* Move required-and-default-attributes test.

This test only applies to Ansible itself.

* Update use-argspec-type-path test for collections.
2019-08-26 20:40:53 -07:00
Matt Clay
02c38ed4fd
Relocate ansible-test self tests outside package. (#61255)
* Relocate ansible-test self tests outside package.

We don't want to include the tests for verifying ansible-test within the ansible-test package.

* Add `test/ansible_test/` to classification.py.

* Fix test invocation.

* Relocate tests in MANIFEST.in.

* Improve package-data sanity test error checking.

* Only use includes for ansible-test in MANIFEST.in.

* Improve readability of MANIFEST.in.
2019-08-24 11:38:30 -07:00
Matt Clay
6ec0b4ec86
Sanity test updates for collections support. (#61248)
* Run no-unwanted-files sanity test only on Ansible.

Since collections should be able to use binary modules there is not really any limit on what could exist in a collection `plugins` directory.

* Add support for symlinks in sanity target lists:

- Sanity tests that need to analyze symlinks can do so using the supplied target list.
- Tests that analyze directories will now only look at symlinks if requested.
- Directory symlinks will now be seen as directories instead of files.

* Enable symlinks on filename based sanity tests.

Sanity tests that evalulate filenames instead of content should include symlinks.

* Update symlinks sanity test.

Use the sanity test target list now that it can include symlinks.
2019-08-23 18:08:21 -07:00
Toshio Kuratomi
5f227fe260 Install ansible-test (#60718)
* Install ansible-test

Modify the install script to install ansible-test and its supporting
code.  Alternative to #60701 that doesn't change package_dir ansible for
fear that it might regress https://github.com/ansible/ansible/issues/10437

Also:
* No longer use package_data.  Everything in the package dirs is going
  to be installed.  Anything that shouldn't be installed needs to be
  moved elsewhere.
* modify the algorithm to store symlinks which are in the same tree
  instead of same directory

* Add ansible_test files to package-data sanity test

* MANIFEST.in cleanups

* Add lib/ansible/config/*.yml
* Make most things in code directories (lib/ansible and test/lib/ansible_test/)
  use explicit file extensions instead of wildcards for maintainability
* Exclude common file extensions that we don't want included in the code
  directories

* Change package-data test to be more complete

* Now compares the repository, sdist, and install
* Compares both that everything in the sdist is in the repo and
  everything in the install is in the sdist in addition to comparing that
  everything in the repo that we want is in the install

* Leave out test artifacts

Only include the directory structure for test/results and test/cache not
any files that may have been generated by test runs

Remove test/utils files from the sdist as these are only needed for our CI

cleanup of docs in MANIFEST.in; getting rid of build files.

* Add the ability to output sdist and snapshot to specific directory

* Add a warning about modifying the heuristic to setup.py

* Address generated files

* Use make snapshot instead of sdist to generate changelog and man pages
  and make sure they're included
* Ignore both the test/utils and generated test files (results, cache)
* Deal with Python3 __pycache__ byte code caches
* Don't check documentation, that isn't built for the sdist
* Restructure for clarity

* Add cli web docs to make clean

This was causing problems when attempting to test that the sdist didn't
have extra files

* Fix bug constructing python names from __pycache__ names

* Create a clean repo to work from

* Exclude test/legacy and be more explicit on extensions

* Exclude the legacy directory from sdist
2019-08-20 23:53:35 -07:00
Matt Clay
32b0a72547
Support windows-integration on collections. (#60984)
* Support windows-integration on collections.

* Update configure-remoting-ps1 sanity test.

* Add copy of ConfigureRemotingForAnsible.ps1.

* Add ignore entry for copied file.
2019-08-20 22:23:28 -07:00
Matt Clay
5a50fb35df Add sanity test for obsolete files.
This will help prevent accidental merging of content to recently obsoleted directories when adding new files.

It may also help contributors who have modified obsolete files understand where their changes should now be made.
2019-08-09 11:22:59 -07:00
Matt Clay
18867847f4
Split up "code smell" sanity tests. (#60174)
* Relocate ansible-only sanity tests.

* Get "code smell" sanity tests from multiple dirs.

- `test/lib/ansible_test/_data/sanity/code-smell/` - General purpose tests used for both Ansible and Ansible Collections.
- `test/sanity/code-smell/` - Tests specific to Ansible, will not be used for Ansible Collections.
2019-08-06 17:17:57 -07:00
Matt Clay
d651bda123
Relocate ansible-test code. (#60147)
* Initial move of `test/runner/` content.

`test/runner/lib/` -> `test/lib/ansible_test/_internal/`
`test/runner/`     -> `test/lib/ansible_test/_internal/data/`

* Initial move of `test/sanity/` content.

`test/sanity/` -> `test/lib/ansible_test/_internal/data/sanity/` (except `test/sanity/ignore.txt`)

* Initial move of `test/units/pytest/` content.

`test/units/pytest/` -> `test/lib/ansible_test/_internal/data/pytest/`

* Follow-up move of `test/runner/unit/` content.

`test/lib/ansible_test/_internal/data/unit/` -> `test/lib/ansible_test/tests/unit/`

* Initial move of `ansible.cfg` content.

`test/units/ansible.cfg` -> `test/lib/ansible_test/_internal/data/units/ansible.cfg`
`test/env/ansible.cfg` -> `test/lib/ansible_test/_internal/data/env/ansible.cfg`

* Follow-up move of `data` directory.

`test/lib/ansible_test/_internal/data/` -> `test/lib/ansible_test/_data/`

* Update import statements.

* Add missing __init__.py for unit tests.

* Fix path references and miscellaneous issues.
2019-08-06 14:43:29 -07:00
Matt Clay
fa2adf3b7b
More prep for ansible-test relocation. (#60114)
* Update pytest plugins.
* Fix update-bundled sanity test.
* Remove old validate-modules comment.
* Fix ansible-test plugin loading
* Update code coverage comments.
* Fix Makefile ansible-test reference.
* Remove incorrect path from lint output.
* Update ansible-test unit tests.
* Make ansible-test's own unit tests singular.
2019-08-05 16:38:21 -07:00
Matt Clay
32fa4b15d1
More sanity test updates for collections. (#59841)
* Move action-plugin-docs ignores into ignore file.

* Update package-data sanity test.

The test now uses the file list provided by ansible-test.
2019-07-30 22:36:03 -07:00
Matt Clay
f61b044bf0 Support directories in sanity tests. 2019-07-30 18:22:09 -07:00
Matt Clay
e07c4f41d7 Standardize ansible-test sanity test filters. 2019-07-30 15:31:33 -07:00
Matt Clay
5d7cc993dd
Clean up sanity test ignore handling. (#59749)
* Allow sanity tests to easily ignore themselves.

Useful for simple regex based sanity tests that error on their own script due to the regex or error message generated.

* Simplify no-smart-quotes sanity test.

Pruning of unversioned directories is handled by ansible-test.

* Remove directory pruning from boilerplate tests.

Files not passing these tests should be ignored instead.

* Add missing sanity ignore entries.
2019-07-29 14:37:44 -07:00
Matt Clay
f274cefa59
Consolidate sanity test ignore entries. (#59665)
* Update empty-init test.
* Update future-import-boilerplate test.
* Update line-endings test.
* Update metaclass-boilerplate test.
* Update no-assert test.
* Update no-basestring test.
* Update no-dict-iteritems test.
* Update no-dict-iterkeys test.
* Update no-dict-itervalues test.
* Update no-get-exception test.
* Update no-main-display test.
* Update no-smart-quotes test.
* Update no-unicode-literals test.
* Update no-unwanted-files test.
* Update replace-urlopen test.
* Update required-and-default-attributes test.
* Update shebang test.
* Update test-constraints test.
* Update use-argspec-type-path test.
* Update use-compat-six test.
2019-07-26 15:26:39 -07:00
Matt Martz
95f4282c42
Verify package data in setup.py installs all files (#59537)
* Add sanity test to ensure all non-py files are installed

* Fix mode and regex

* Fix role skel inventory package_data

* Add docs

* Update package_data for inventory files

* Address pylint concerns

* Another tweak to package_data

* Address review feedback

* Change index to 1

* add to ansible-only.txt
2019-07-24 13:58:13 -05:00
Matt Clay
79eca9c8fb
Initial ansible-test support for collections. (#59197)
* Initial ansible-test support for collections.
* Include cloud config in delegation payload.
* Add missing types import and fix `t` shadowing.
* Fix plugin traceback when config_path not set.
* Fix encoding issues.
* Remove unused imports.
* More encoding fixes.
* Handle delegation outside exception handler.
* Inject ssh keys only if not already in place.
* More defensive approach to getting remote pwd.
* Add missing string format var.
* Correct PowerShell require regex.
* Rename `is_install` and `INSTALL_ROOT`.
2019-07-22 19:24:48 -07:00
Jordan Borean
65049620ee
Generate galaxy.yml based on single source of truth (#59170)
* Generate galaxy.yml based on single source of truth

* Fix up tests and align file names

* Minor Makefile tweak

* Remove link in galaxy.yml file and make it a template file

* Moved collections docs to dev_guide

* change Makefile clean path

* Added readme to example meta file

* review fixes

* Use newer style for doc generation script

* Fix mistake in dev_guide index

* removed uneeded file, fixed links and added preview banner

* Moved banner for sanity test
2019-07-23 06:50:46 +10:00
Matt Clay
6645054329
Code cleanup for test infrastructure. (#59046)
* Remove useless object inheritance in test code.
* Remove unnecessary pass statements from test code.
* Comment on why certain pylint rules are ignored.
* Add more pylint test contexts.
* Fix import order.
* Remove unused variables.
* Remove unnecessary pass statement.
* Fix bad continuations.
* Remove unnecessary elif.
* Allow legitimate broad except statements.
* Allow legitimate protected access.
* Clean up names to make pylint pass.
2019-07-12 13:17:20 -07:00
Toshio Kuratomi
dd2755e0b4 Fix pylint warnings for update-bundled 2019-07-12 12:35:56 -07:00
Matt Clay
3f2b766d10 Add future and metaclass boilerplate to test code.
Continue to ignore:

- test/integration/
- test/legacy/
- test/units/
2019-07-12 09:18:24 -07:00
Toshio Kuratomi
33d2728879 Rename python files in hacking/ directory to have .py suffix
ansible-test only passes files which have the .py suffix for sanity
tests on python files.  This change will allow sanity tests to run on
the Python files in hacking/

* Rename test-module to test-module.py
* Symlink test-module for backwards compat since end users may be using
  test-module
* Fix test-module sanity errors that are now triggered
* Rename ansible_profile to ansible-profile.py
* Rename build-ansible
2019-07-10 22:17:35 -07:00
Toshio Kuratomi
146a7f8ff6 Split the metaclass == type and from future boilerplate code.
The metaclass boilerplate is safe to apply en masse.  The future import
boilerplate needs code to be inspected to be sure that there aren't any
py2isms that need to be fixed.  Split these two checks so that we can
fix them independently

Be explicit about which files are grandfathered so we can fix them up one by one
2019-07-10 22:17:35 -07:00
Matt Clay
1e1463401d
Prepare ansible-test for supporting collections. (#58886)
This is a small but incomplete set of the initial changes for supporting testing of collections with ansible-test.
2019-07-09 17:31:04 -07:00
Matt Martz
0e9cfd3ee8
Fix sanity tests that are failing with LC_ALL set (#58604) 2019-07-02 10:56:12 -05:00
Matt Clay
d5542afd97 Properly enforce shebang on collections. 2019-06-25 19:21:05 -07:00
Alicia Cozine
118cf3ece6
Cloud dev docs to rst (#56485)
* Moves developer docs for AWS, ovirt, and openstack modules out of lib/ansible/, integrates them with dev_guide, with abadger's fix to make python snippets pass rstcheck
2019-05-16 09:05:12 -05:00
Matt Clay
f9b56a5b56 Add sanity test to check for unwanted files. 2019-05-14 09:13:51 -07:00
Toshio Kuratomi
3161a91d7e
Implement a framework for having common code for release scripts (#55893)
* Implement a framework for having common code for release scripts

* Release scripts will go through hacking/build-ansible.  build-ansible is
  a pluggable script which will set a directory that has common code for
  non-enduser scripts.  It will then invoke the plugin which implements
  that subcommand.  Uses straight.plugin for loading each sub-command.

* We're going to add tools which are needed to test ansible (the changelog
  generation, for instance) so we need to include the pieces relevant to
  that in the tarball.

* Add straight.plugin to the sanity test requirements for the same
  reason

* Skip compile test just for build-ansible plugins which won't be run as
  part of sanity tests.
2019-05-01 13:57:03 -05:00
Matt Martz
9f83139dcb
Don't register tests as filters (#55332)
* Don't register tests as filters. Fixes #55319

* Remove tests for deprecated functionality

* Remove no-tests-as-filters sanity tests

* Remove docs too

* Revert "Remove docs too"

This reverts commit 7daf457a74.

* Make no-tests-as-filters doc an orphan
2019-04-16 14:10:14 -05:00
Toshio Kuratomi
e5a31e81b6 Add a script to generate a new porting guide
* porting-guide.py is allowed to be Python-3.6+ as it will only be run
  by release engineers
2019-04-12 12:57:35 -07:00
Matt Davis
1dc8436ed9
module_utils fixes in collections (#55118)
* module_utils fixes in collections

* fixed Windows module_utils in collections
* fixed more Python module_utils cases (from X import module)
* "medium style" Ansiballz modules now work properly with collections (ie, non-replacer but also not using basic.py)
* added more tests
* split Windows/POSIX exec

* sanity
2019-04-10 22:59:53 -07:00