Age | Commit message (Collapse) | Author |
|
|
|
Hopefully this will save some ~pointless round trips on CLA PRs.
|
|
|
|
And add an example of providing a list of assertions.
|
|
This allows tests to be configured to permit some commands to be run via
util.subp, while still rejecting any unexpected calls. See the
documentation for further details.
|
|
|
|
Specifically, ensure that given values are either strings, or arrays of strings.
|
|
and slower.
and since we're making it slower, let's cache it, in case boottime gets
called more than once.
|
|
We are longer using lxd.readthedocs.io
Signed-off-by: Thomas Parrott thomas.parrott@canonical.com
|
|
|
|
We recently discovered that pylint is failing to report some errors when
invoked across our entire codebase (see
https://github.com/PyCQA/pylint/issues/3611). I've run pylint across
every Python file under cloudinit/[0], and this commit fixes the issues
so-discovered.
[0] find cloudinit/ -name "*.py" | xargs -n 1 -t .tox/pylint/bin/python -m pylint
|
|
We live in the future now.
|
|
|
|
This ensures that Travis will not kill our tests if fetching images is
taking a long time.
In implementation terms, this introduces a context manager which will
spin up a multiprocessing.Process in the background and print a dot to
stdout every 10 seconds. The process is terminated when the context
manager exits.
This also drop the use of travis_wait, which was being used to work
around this issue.
|
|
Create a schema object for the `apt_configure` module and
validate this schema in the `handle` function of the module.
There are some considerations regarding this PR:
* The `primary` and `security` keys have the exact same properties. I
tried to eliminate this redundancy by moving their properties to a
common place and then just referencing it for both security and
primary. Similar to what is documented here:
https://json-schema.org/understanding-json-schema/structuring.html
under the `Reuse` paragraph. However, this approach does not work,
because the `#` pointer goes to the beginning of the file, which is
a python module instead of a json file, not allowing the pointer to
find the correct definition. What I did was to create a separate dict
for the mirror config and reuse it for primary and security, but
maybe there are better approaches to do that.
* There was no documentation for the config `debconf_selections`. I
tried to infer what it supposed to do by looking at the code and the
`debconf-set-selections` manpage, but my description may not be
accurate or complete.
* Add a _parse_description function to schema.py to render multi-line
preformatted content instead of squashing all whitespace
LP: #1858884
|
|
And raise TypeError when subp called with no args, which more accurately mirrors normal behaviour:
>>> from cloudinit.util import subp
>>> subp()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: subp() missing 1 required positional argument: 'args'
|
|
|
|
|
|
|
|
This (a) gives people an easy way of getting a commit into the codebase,
and (b) saves us from having to explain this process (or do it
ourselves) for every new contributor.
|
|
Specifically:
* include warning against general use of mock assert methods (and suggestions on how to replace them)
* add guidelines on test decorator/param ordering
* add test guideline for module-level mock variables
|
|
As we only look at these logs when there's an error, and lintian
failures don't cause the package build to error out, we never examine
this lintian output. Let's save ourselves some CI time by skipping it.
(We aren't lintian clean, otherwise a better change here would be to
make lintian warnings cause the package build to fail.)
|
|
Also update all examples to include the cloud-config header if they don't have it
LP: #1876414
|
|
Move from 127.0.0.1 to 127.0.1.1 for localhost IP addr for opensuse and sles
|
|
Mapped from chcheng
|
|
Add a unit test to validate if the examples provided in the config
modules are conforming to the concatenated schema of all config
modules. The rationale behind that is not only to verify if the
examples are correctly written but to assert that no config schema
is interfering with each other.
Failures in validate_cloudconfig_schema raise the
SchemaValidationError by using strict=True, so I have
only called the function passing the right schema examples to
validate.
This branch also fixes an invalid schema example in cc_snap.
LP: #1876412
|
|
Amazon Linux 2 is configured with a log format different to the one
shipped by upstream, which means analyze fails to parse any of the log
lines. This updates the code to know how to parse such lines.
LP: #1876323
|
|
Implement the upgrade support:
- FreeBSD: using `pkg upgrade`
- NetBSD: with `pkgin`
|
|
|
|
|
|
Since upstream cloud-init has dropped python2 support,
adapt remaining package build scripts and tools to python3 only
Changes:
* Do not template debian/rules as python3 is the only supported version
* Drop six from requirements.txt
* Makefile: drop everything related to Python 2
* run-container: install the CI deps only on ubuntu|debian
* read-version: update the shebang to use Python 3
* brpm: read_dependencies(): drop unused argument
* read-dependencies: switch to Py3 and drop the --python-version option
* pkg-deps.json: drop the Python version field and update the redhat deps
* pkg-deps.json: drop the unittest2 and contextlib2 renames
* Update RPM the spec file to use Python 3 when building the RPM
* bddeb: drop support for Python 2
|
|
We want to set route-metrics such that NICs are configured with the priority that they are given in the network metadata that we receive from the IMDS. (This switches away from using MAC ordering.)
This also required the following test changes:
* reverse the sort order of the MACs in test data (so that they would trigger the bug being fixed)
* fix up the key names in `NIC2_MD` (which were under_scored instead of dash-separated)
* use a full interface dict (rather than a minimal one) for `TestConvertEc2MetadataNetworkConfig`
LP: #1876312
|
|
cloud-images.ubuntu.com can sometimes be under heavy load; caching the
images helps avoid that affecting our build times (or causing build
failures entirely).
|
|
|
|
|
|
Users of Centos who want to add yum repos, like they do on Fedora
or RHEL get this unfortunate message:
Skipping modules 'yum-add-repo' because they are not verified
on distro 'centos'. To run anyway, add them to
'unverified_modules' in config
Centos certainly supports yum, add it to the supported distro
list in the module.
|
|
Bump the version in cloudinit/version.py to 20.2 and
update ChangeLog.
LP: #1875951
|
|
`make-mime.py` is a more recent version of the inline script that this
link is replacing.
|
|
Clarify in documentation that write_files will create parent folders
for paths that do not already exist.
This obfuscates what the problem is when people erroneously create
files in /tmp despite the warnings in the documentation not to do so.
People naturally assume that their file is absent because the parent folder
did not exist for it to be created in, causing them to add a runcmd block
to create the folder, even though execution order means that this will not
occur until after write_files have all finished.
|
|
I don't believe this has ever been supported, looking at the git
history, but it certainly isn't at the moment.
LP: #1875470
|
|
The line in question is in the code path handling older versions of
jsonschema. In that context it _is_ correct, but when pylint analyses
it against the latest jsonschema it (incorrectly) detects an error.
|
|
Add schema definition to cc_write_files.py
Cloud-config containing write_files config directives will now
emit warnings for invalid config keys or values for the write_files
module.
Add an extension to JSON schema's draft4validator to permit either
binary or text values for 'string' objects.
This allows for JSON schema validating the YAML declaration of binary
valiues in cloud-config using YAML's '!!binary' syntax.
Add the ability to pass a specific module name to
`cloud-init devel schema --docs <module_name>|all` to optionally
limit doc output during development to a single schema doc.
|
|
Refactoring of the `find_devs_with_*bsd()` methods:
- centralize everything in `util.py`
- add test coverage
|
|
These two lines were a requirement for RHEL6, and they have been added 7
years ago:
- https://github.com/canonical/cloud-init/commit/984c72e522c585c6d3f6b3d3aec39fb21dd84028
- https://github.com/canonical/cloud-init/commit/48a3b4ca0ba55699825d6eabe75d843286c23545
RHEL6 comes with Python 2.6, since Python3 is now a strong requirement, I
think it's safe to remove.
|
|
These libraries provide backports of Python 3's stdlib components to Python 2. As we only support Python 3, we can simply use the stdlib now. This pull request does the following:
* removes some unneeded compatibility code for the old spelling of `assertRaisesRegex`
* replaces invocations of the Python 2-only `assertItemsEqual` with its new name, `assertCountEqual`
* replaces all usage of `unittest2` with `unittest`
* replaces all usage of `contextlib2` with `contextlib`
* drops `unittest2` and `contextlib2` from requirements files and tox.ini
It also rewrites some `test_azure` helpers to use bare asserts. We were seeing a strange error in xenial builds of this branch which appear to be stemming from the AssertionError that pytest produces being _different_ from the standard AssertionError. This means that the modified helpers weren't behaving correctly, because they weren't catching AssertionErrors as one would expect. (I believe this is related, in some way, to https://github.com/pytest-dev/pytest/issues/645, but the only version of pytest where we're affected is so far in the past that it's not worth pursuing it any further as we have a workaround.)
|
|
As written, it's possible that the first transformation for a mirror
hostname could be passed None if the parsed mirror URL didn't have a
hostname component, when the defined interface is that the
transformations will be passed strings.
This isn't an error currently, because the first transformation happens
to gracefully handle being passed None. It returns None, so the
pipeline processing ends there.
This was caught when testing out mypy on the cloud-init codebase.
|
|
logging.NullHandler has been present since Python 3.1, we don't need to
handle its absence.
|
|
The integration test doesn't work against the ubuntu/* branches because
it uses the tooling designed to work against master. This means that
ubuntu/* branches always report failures in Travis, which doesn't give
us any signal.
|
|
* HACKING.rst: add list of available pytest fixtures
* HACKING.rst: capture common mock naming pattern in codebase
|
|
This mirrors the behaviour of CiTestCase.allowed_subp, by causing all
calls to util.subp to raise an AssertionError.
|