Commit graph

411 commits

Author SHA1 Message Date
Till Maas
0258ee8575 travis: Upgrade to bionic 2020-05-05 11:14:01 +02:00
Rich Megginson
a9407a4803 use selectattr instead of json_query
Some tests were getting the following error:
```
Unexpected templating type error occurred on ({{
     network_connections |
       json_query('[*][ieee802_1x]') | flatten | count > 0 }}): 'NoneType'
       object is not iterable"
```
In general it is better to avoid the use of `json_query` and use
the older built-in jinaj2 filters such as `selectattr`, unless you
need to perform a complex query of complex json data.  In this
case, not sure what the problem was with the input json, but
using `selectattr` seems to have fixed it.
2020-05-04 18:46:42 +02:00
Jack Adolph
939772fdc1 Add support for domain-suffix-match 802.1x option
Role now supports validating the domain name of the EAP server certificate.
Regenerated the CA certificate as the private key for the original CA has been lost.
Updated test certificates to include a domain name in the CN so the domain-suffix-match
feature can be tested.
2020-05-04 13:01:41 +02:00
Harsh Jain
9d561ea915 Add commit message guidelines to contributing 2020-04-26 17:03:57 +02:00
Jack Adolph
97129717a5 Rename files to be valid python identifiers 2020-04-22 17:40:03 +02:00
Jack Adolph
330729c6dd Change 802.1x parameters to be valid python identifiers 2020-04-21 08:11:15 +02:00
Till Maas
16ba71f303 Integration tests: Explicitly select provider
Instead of determining the non-default provider, run all integration
tests explicitly for both providers or only the providers that are
required. Since Ansible does not allow to pass variables to playbooks
imported with `import_playbook` to select another playbook to import,
generate the files instead of using a shared playbook like
`run_with_nm.yml` or `run_with_initscripts.yml`.
2020-04-19 21:08:56 +02:00
Till Maas
ebbec7708f runpylint.sh: Export RUN_PYLINT_* variables
Some of the RUN_PYLINT_* variables are evaluated in a python script. To
ensure that they are passed to it, they need to be exported.
2020-04-19 21:08:56 +02:00
Till Maas
c398f401f9 Travis/tox: Run coveralls for all unit tests
Run coveralls after the unit tests to ensure that coverage data is
available
2020-04-18 16:20:52 +02:00
Till Maas
20a20b60fb Module/NM: Try to reapply connections 2020-04-18 11:02:59 +02:00
Till Maas
1554c4a6a3 Library/NM: Always rollback checkpoint on failure
If there is a NetworkManager checkpoint, roll it back on any failure.
Otherwise future invocations of the role fail until the checkpoint timed
out.
2020-04-18 01:14:07 +02:00
Till Maas
da35b81b2b Meta: Update minimum Ansible version 2020-04-17 17:25:07 +02:00
Till Maas
d9ea229a6a 802.1x tests: Fix cleanup
The runtime state needs to be down.
2020-04-17 17:25:07 +02:00
Akash Saini
255aed57a4 Coverage: Use find and file module instead of shell command 2020-04-16 18:48:11 +02:00
Till Maas
185075fdfb Integration tests: Fix coverage collection
Update coverage helpers for changes in newer Ansible versions (tested
with 2.9.6) and with using module_utils.
2020-04-15 22:12:22 +02:00
Till Maas
f01cb8f657 Update gitignore 2020-04-14 16:46:18 +02:00
Pavel Cahyna
33f68c5e49 Add ansible-lint config, now turns off the silly rule 602
See https://github.com/linux-system-roles/timesync/issues/31
2020-04-08 13:16:43 +02:00
Rich Megginson
05a9223a33 move flake8 args to [flake8] section of tox.ini
tox supports a `[flake8]` section, so move the default
settings there rather than having them passed in on the
command line.  Projects can still override flake8 arguments
by using `RUN_FLAKE8_EXTRA_ARGS` in `.travis/config.sh`

Signed-off-by: Till Maas <opensource@till.name>
2020-04-08 13:16:43 +02:00
Till Maas
b9e19fb2be config.sh/custom.sh: Sync with template 2020-04-08 13:16:43 +02:00
Rich Megginson
92519644ba python 2.6 support for pytest and ansible 2.6
Removed `mock` from the `testenv` `deps`.
Added `mock` to the template pytest_extra_requirements.txt,
commented out.  Projects such as network that need it can uncomment it.
2020-04-07 11:02:28 +02:00
Rich Megginson
7fdfa3204e update to latest template code
These changes don't directly affect network, or don't actually
change the behavior of existing code that network uses (coveralls),
but are intended to sync with the latest template code.

Adds `LSR_PUBLISH_COVERAGE=normal` to `.travis/config.sh` because
network wants to publish coverage normally (as opposed to `strict`
or not at all).
2020-04-07 11:01:26 +02:00
Rich Megginson
dec163940e support testing/linting module_utils code
This does not directly affect network because network has its own
solution for dealing with testing/linting module_utils code, but
it gets network to feature/code parity with the template and
other repos.

Defines a shell function in utils.sh - lsr_setup_module_utils -
that allows configuring a tox venv installed ansible to have
the repo module_utils code in the default pythonpath for the
venv, which allows testing and linting the module_utils code
without having to otherwise munge or mock the pythonpath.

Projects needing this functionality can set in `.travis/config.sh`
the variable `RUN_PYTEST_SETUP_MODULE_UTILS` to setup
module_utils/ for pytest, and `RUN_PYLINT_SETUP_MODULE_UTILS`
to setup module_utils/ for pylint.
2020-04-06 19:14:42 +02:00
a-mere-peasant
11a03f0ceb Add documentation for existing team type support
Add no other configurability available
2020-04-06 15:23:58 +02:00
Rich Megginson
7863e08e9b allow more overrides of template code
NOTE: I don't think this commit directly affects network, since
network doesn't use any of these - this PR is more for parity
with template and other repos.

Centralize the setting of `ME` and `TOPDIR` in utils.sh

Add support for `RUN_FLAKE8_EXTRA_ARGS` and `RUN_BLACK_EXTRA_ARGS`
2020-04-06 15:17:14 +02:00
Rich Megginson
23937b6360 use python instead of envpython
Many of the tests and tasks invoked from `tox` would try to use
the path to the `python` executable in the tox virtualenv, and
in some cases, would try to follow the symlink if the `python`
command were a symlink, in some cases, following the symlink to
the system python, and trying to use the absolute path.  This
would fail in some cases because when using the system python
with the absolute path, the python modules installed in the
tox venv could not be found.  So instead, just use the `python`
command from the venv with no path.

also enable travis 3.8-dev testing, since this fix allows that
platform to work correctly.
2020-04-01 20:57:09 +02:00
Rich Megginson
d6196106a8 Yamllint: Allow to customize settings
Move default settings from template to .yamllint_defaults.yml and allow
customizations in .yamllint.yml.
2020-04-01 09:33:54 +02:00
Till Maas
b5ae5380ad Travis: Update Ansible versions 2020-03-30 15:25:29 +02:00
Jack Adolph
4af8f23955 Add support for 802.1x wired connections (EAP-TLS only)
Only EAP-TLS method is supported. Must use NetworkManager as the network_provider.
Also fixed bug in do_connections_validate_nm() function.
2020-03-25 10:49:10 +01:00
Till Maas
d32f4e5a7b molecule/tox: Support yamllint without molecule
With molecule v3, the linter config needs to be changed. To prepare for
this, run yamllint with tox as molecule would do it for V3.
2020-03-24 13:55:27 +01:00
Till Maas
8cd37ac873 tests: Fix yamllint issues
Fix as many issues as feasible. Ignore the errors in generated
"other_provider" tests since they are going to be removed, soon.
2020-03-24 13:55:27 +01:00
a-mere-peasant
1a81c3d2da Update tests_default to have explicit providers
The network providers for tests_default are to be selected explicitly
Add tests_default_nm.yml
Add tests_default_initscripts.yml

Since the providers are listed explicitly ,there is no need for a other_provider playbook
Remove tests_default_other_provider.yml

Add tests_default and tests_default(nm/initscripts).yml to ingnore list for ensure_other_provider script
2020-03-23 14:42:31 +01:00
a-mere-peasant
14d3f56887 fixed typo
just fixing a small typo
2020-03-16 14:40:09 +01:00
Till Maas
51fa1146b4 README: Mention mtu option 2020-03-13 11:02:21 +01:00
Till Maas
19414b5db1
Merge pull request #153 from linux-system-roles/lsr-template-sync
Synchronize files from linux-system-roles/template
2020-02-26 15:02:10 +01:00
systemroller
5a5ae4b662 Synchronize files from linux-system-roles/template 2020-02-25 22:09:32 +01:00
Till Maas
83703b0184 README: Update Travis URL 2020-02-25 22:07:38 +01:00
Till Maas
fcae2dee61
Merge pull request #156 from tyll/py38-dev
Travis: Disable Python 3.8-dev
2020-02-25 20:23:05 +01:00
Till Maas
ffc0c89e23 Travis: Disable Python 3.8-dev
Python 3.8-dev seems to be broken on Travis, disable it for now.
2020-02-25 19:23:03 +01:00
Till Maas
8077521882
Merge pull request #155 from tyll/molecule_ci
Tox: Pin molecule to version 2
2020-02-24 21:23:51 +01:00
Till Maas
446d78d373 Tox: Pin molecule to version 2
Molecule version 3 and later needs a different configuration file for
linters. This breaks the CI. Pin molecule to version 2 for now to
fix the CI until we have a proper fix.
2020-02-24 18:53:34 +01:00
Till Maas
d36a393313
Merge pull request #151 from i386x/lsr-template-refactored--part-8
Onboard refactored tox & Travis CI setup and configuration vol. 8
2020-02-03 17:02:52 +01:00
Jiri Kucera
4b05c201db Support more Ansible versions
Support running the molecule tests against more versions of Ansible.
By typing

  LSR_ANSIBLE_DEP=<ansible> LSR_MSCENARIO=<scenario> tox -e molecule

one can run molecule inside tox with <ansible> version installed
under <scenario> scenario. For example

  LSR_ANSIBLE_DEP='ansible==2.7.*' LSR_MSCENARIO=foo tox -e molecule

will run molecule under scenario 'foo' and the recent Ansible 2.7
installed. `tox -e molecule` run molecule under default scenario
with the latest Ansible (from pypi) installed.

Travis runs molecule tests for Ansible 2.6, 2.7, and 2.8 installed
and under default scenario (can be overriden by user in config.sh).

Additional changes: Remove useless comment from custom.sh.
2020-02-03 12:41:30 +01:00
Jiří Kučera
d7905c1790
Merge pull request #149 from i386x/lsr-template-refactored--part-7
Onboard refactored tox & Travis CI setup and configuration vol. 7
2020-01-30 21:40:28 +01:00
Jiri Kucera
cb518856c4 Run molecule via runsyspycmd.sh
runsyspycmd.sh script runs a given command only if venv Python
matches the system Python (this prevents failing when some command
depends on binary libraries).

Also put `molecule --version` and `ansible --version` to a standalone
testenv ([testenv:molecule_version]) so a user can display molecule
and ansible version by typing `tox -e molecule_version` without
running `molecule lint`.
2020-01-30 10:11:42 +01:00
Till Maas
09be8c407e
Merge pull request #148 from i386x/lsr-template-refactored--part-6
Onboard refactored tox & Travis CI setup and configuration vol. 6
2020-01-21 14:23:37 +01:00
Jiri Kucera
ad6cffe19d tox: molecule extra requirements
Pass extra molecule dependencies via file and not via environment
variable. Also add selinux as a permanent molecule dependency
(molecule needs it on selinux enabled systems to setup containers).
2020-01-20 13:23:38 +01:00
Till Maas
8c5baff2a6
Merge pull request #147 from i386x/lsr-template-refactored--part-5
Onboard refactored tox & Travis CI setup and configuration vol. 5
2020-01-20 12:07:36 +01:00
Jiri Kucera
fc0c37efc1 Wrap flake8
Wrapping flake8 give a possibility to a user to dissable flake8 via
setting environment variable in config.sh.
2020-01-20 10:10:14 +01:00
Till Maas
7007a0ec1f
Merge pull request #146 from i386x/lsr-template-refactored--part-4
Onboard refactored tox & Travis CI setup and configuration vol. 4
2020-01-16 17:19:28 +01:00
Jiri Kucera
677f7b8918 Wrap pylint runner
Prior this change, RUN_PYLINT_* environment variables set by config.sh
have effect only while running in Travis (because runtox script sets
them by including config.sh). By wrapping pylint runner with shell
script, RUN_PYLINT_* environment variables have effect also while
running tox locally.
2020-01-16 16:19:50 +01:00