summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-05-14cloud_tests: emit dots on Travis while fetching images (#347)Daniel Watkins
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.
2020-05-13Add schema to apt configure config (#357)lucasmoura
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
2020-05-12conftest: add docs and tests regarding CiTestCase's subp functionality (#343)Daniel Watkins
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'
2020-05-11analyze/dump: refactor shared string into variable (#350)Daniel Watkins
2020-05-11doc: update boot.rst with correct timing of runcmd (#351)Daniel Watkins
2020-05-11HACKING.rst: change contact info to Rick Harding (#359)lucasmoura
2020-05-11HACKING.rst: guide people to add themselves to the CLA file (#349)Daniel Watkins
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.
2020-05-11HACKING.rst: more unit testing documentation (#354)Daniel Watkins
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
2020-05-08.travis.yml: don't run lintian during integration test package builds (#352)Daniel Watkins
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.)
2020-05-08Add test to ensure docs examples are valid cloud-init configs (#355)James Falcon
Also update all examples to include the cloud-config header if they don't have it LP: #1876414
2020-05-07make suse and sles support 127.0.1.1 (#336)chengcheng-chcheng
Move from 127.0.0.1 to 127.0.1.1 for localhost IP addr for opensuse and sles
2020-05-07lp-to-git-users: adding chengcheng-chcheng (#356)chengcheng-chcheng
Mapped from chcheng
2020-05-06Create tests to validate schema examples (#348)lucasmoura
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
2020-05-06analyze/dump: add support for Amazon Linux 2 log lines (#346)Daniel Watkins
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
2020-05-04bsd: upgrade support (#305)Gonéri Le Bouder
Implement the upgrade support: - FreeBSD: using `pkg upgrade` - NetBSD: with `pkgin`
2020-05-04Add lucasmoura as contributor (#345)lucasmoura
2020-05-04Add "therealfalcon" as contributor (#344)James Falcon
2020-05-01Adapt the package building scripts to use Python 3 (#231)Paride Legovini
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
2020-05-01DataSourceEc2: use metadata's NIC ordering to determine route-metrics (#342)Daniel Watkins
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
2020-04-30.travis.yml: introduce caching (#329)Daniel Watkins
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).
2020-04-30cc_locale: introduce schema (#335)Daniel Watkins
2020-04-30doc/rtd/conf.py: bump copyright year to 2020 (#341)Daniel Watkins
2020-04-30yum_add_repo: Add Centos to the supported distro list (#340)Ryan Harper
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.
2020-04-29Release 20.2 (#337)Chad Smith
Bump the version in cloudinit/version.py to 20.2 and update ChangeLog. LP: #1875951
2020-04-29doc/format: reference make-mime.py instead of an inline script (#334)Daniel Watkins
`make-mime.py` is a more recent version of the inline script that this link is replacing.
2020-04-28Add docs about creating parent folders (#330)Adrian Wilkins
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.
2020-04-28DataSourceNoCloud/OVF: drop claim to support FTP (#333)Daniel Watkins
I don't believe this has ever been supported, looking at the git history, but it certainly isn't at the moment. LP: #1875470
2020-04-27schema: ignore spurious pylint error (#332)Daniel Watkins
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.
2020-04-24schema: add json schema for write_files module (#152)Chad Smith
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.
2020-04-24BSD: find_devs_with_ refactoring (#298)Gonéri Le Bouder
Refactoring of the `find_devs_with_*bsd()` methods: - centralize everything in `util.py` - add test coverage
2020-04-24nocloud: drop work around for Linux 2.6 (#324)Gonéri Le Bouder
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.
2020-04-24cloudinit: drop dependencies on unittest2 and contextlib2 (#322)Daniel Watkins
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.)
2020-04-23distros: handle a potential mirror filtering error case (#328)Daniel Watkins
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.
2020-04-23log: remove unnecessary import fallback logic (#327)Daniel Watkins
logging.NullHandler has been present since Python 3.1, we don't need to handle its absence.
2020-04-23.travis.yml: don't run integration test on ubuntu/* branches (#321)Daniel Watkins
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.
2020-04-23More unit test documentation (#314)Daniel Watkins
* HACKING.rst: add list of available pytest fixtures * HACKING.rst: capture common mock naming pattern in codebase
2020-04-23conftest: introduce disable_subp_usage autouse fixture (#304)Daniel Watkins
This mirrors the behaviour of CiTestCase.allowed_subp, by causing all calls to util.subp to raise an AssertionError.
2020-04-22YAML align indent sizes for docs readability (#323)Tak Nishigori
This proposal has been aligned in a human readable. There are no changes to this except for spac The indentation size is not specifically defined in the YAML RFC $ make yaml has passed on my-machine I set the indentation size to the largest number of articles in the repository (dictionary: 2) (And also include nishigori as a CLA signer.)
2020-04-21network_state: add missing space to log message (#325)Daniel Watkins
2020-04-20tests: add missing mocks for get_interfaces_by_mac (#326)Daniel Watkins
We currently have a test system where get_interfaces_by_mac raises an exception, which is causing these tests to fail as they aren't mocking get_interfaces_by_mac out. LP: #1873910
2020-04-16test_mounts: expand happy path test for both happy paths (#319)Daniel Watkins
2020-04-15cc_mounts: fix incorrect format specifiers (#316)Daniel Watkins
LP: #1872836
2020-04-14swap file "size" being used before checked if str (#315)Eduardo Otubo
Swap file size variable was being used before checked if it's set to str "auto". If set to "auto", it will break with: failed to setup swap: unsupported operand type(s) for /: 'str' and 'int' Signed-off-by: Eduardo Otubo <otubo@redhat.com> RHBZ: 1772505
2020-04-14HACKING.rst: add pytest version gotchas section (#311)Daniel Watkins
And document that we can't yield in pytest.fixture functions due to the age of xenial's pytest.
2020-04-10docs: Add steps to re-run cloud-id and cloud-init (#313)Joshua Powers
2020-04-06readme: OpenBSD is now supported (#309)Gonéri Le Bouder
Add OpenBSD in the list of supported Operating System.
2020-04-03net: ignore 'renderer' key in netplan config (#306)Ryan Harper
LP: #1870421
2020-04-02Add support for NFS/EFS mounts (#300)Andrew Beresford
The cc_mounts module does not support NFS mounts in the form of hostname:/ or hostname:/path. This PR adds support for NFS-style paths in the fs_spec field. LP: #1870370
2020-04-02openbsd: set_passwd should not unlock user (#289)Gonéri Le Bouder
Decouple unlocking passwords when also setting passwords. On OpenBSD skip unlocking password as `usermode -C no foo` does not work.
2020-04-02tools/.github-cla-signers: add beezly as CLA signer (#301)Daniel Watkins