[freeipa PR#1379][opened] Prevent set_directive from clobbering other keys / safe directive setter
by tiran
URL: https://github.com/freeipa/freeipa/pull/1379
Author: tiran
Title: #1379: Prevent set_directive from clobbering other keys / safe directive setter
Action: opened
PR body:
"""
This PR combines @frasertweedale PR #1347 with a safe directive setter (https://pagure.io/freeipa/issue/7312)
## Original PR message
`set_directive` only looks for a prefix of the line matching the
given directive (key). If a directive is encountered for which the
given key is prefix, it will be vanquished.
This occurs in the case of `{ca,kra}.sslserver.cert[req]`; the
`cert` directive gets updated after certificate renewal, and the
`certreq` directive gets clobbered. This can cause failures later
on during KRA installation, and possibly cloning.
Match the whole directive to avoid this issue.
Fixes: https://pagure.io/freeipa/issue/7288
-----
Cause: corner case.
How to test:
1. ensure `ca.sslserver.certreq=<base64 CSR>` exists in `ca/CS.cfg`.
2. resubmit Certmonger tracking request for `Server-Cert cert-pki-ca` Dogtag system cert.
3. verify that `ca.sslserver.certreq=<base64 CSR>` still exists in `ca/CS.cfg`.
## safe DirectiveSetter
The new context manager ``DirectiveSetter`` avoids several possible issues that can lead to destroyed configuration files.
"""
To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1379/head:pr1379
git checkout pr1379
6 years, 4 months
[freeipa PR#1380][opened] make fastcheck -- run linters and tests in 30 seconds
by tiran
URL: https://github.com/freeipa/freeipa/pull/1380
Author: tiran
Title: #1380: make fastcheck -- run linters and tests in 30 seconds
Action: opened
PR body:
"""
Are you also annoyed by the fact that you have waited an hour for CI to finish -- only to find out that your PR has a PEP 8 violation in a file? ``make fastcheck`` to your rescue! It checks pylint, pep8 and ipatests' unit tests in about 30 seconds on both (!) Python 2 and 3:
```
$ time make fastcheck
...
real 0m29,417s
user 1m18,018s
sys 0m2,637s
```
## Add make targets for fast linting and testing
Fast linting only needs modified files with pylint and diff with
pycodestyle. It's good enough to detect most code errors very fast. It
typically takes less than 10 seconds. A complete full pylint run uses
all CPU cores for several minutes. PEP 8 violations are typically
reported after 30 minutes to several hours on Travis CI.
Fast lintings uses git diff and git merge-base to find all modified
files in a branch or working tree. There is no easy way to find the
branch source. On Travis the information is provided by Travis. For
local development it's a new variable IPA_GIT_BRANCH in VERSION.m4.
Fast testing execute all unit tests that do not depend on ipalib.api.
In total it takes about 30-40 seconds (!) to execute linting, PEP 8 checks
and unittests for both Python 2 and 3.
## Add marker needs_ipaapi and option to skip tests
The new marker needs_ipaapi is used to mark tests that needs an
initialized API (ipalib.api) or some sort of other API services (running
LDAP server) to work. Some packages use api.Command or api.Backend on
module level. They are not marked but rather skipped entirely.
A new option ``skip-ipaapi`` is added to skip all API based tests. With
the option, only simple unit tests are executed. As of now, freeIPA
contains more than 500 unit tests that can be executed in about 5
seconds.
"""
To pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/1380/head:pr1380
git checkout pr1380
6 years, 4 months