summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-06-08Move subp into its own module. (#416)Scott Moser
This was painful, but it finishes a TODO from cloudinit/subp.py. It moves the following from util to subp: ProcessExecutionError subp which target_path I moved subp_blob_in_tempfile into cc_chef, which is its only caller. That saved us from having to deal with it using write_file and temp_utils from subp (which does not import any cloudinit things now). It is arguable that 'target_path' could be moved to a 'path_utils' or something, but in order to use it from subp and also from utils, we had to get it out of utils.
2020-06-08readme: point at travis-ci.com (#417)Joshua Powers
2020-06-04New feature flag functionality and fix includes failing silently (#367)James Falcon
Build time feature flags are now defined in cloudinit/features.py. Feature flags can be added to toggle configuration options or deprecated features. Feature flag overrides can be placed in cloudinit/feature_overrides.py. Further documentation can be found in HACKING.rst. Additionally, updated default behavior to exit with an exception if #include can't retrieve resources as expected. This behavior can be toggled with a feature flag. LP: #1734939
2020-06-03Enhance poll imds logging (#365)Moustafa Moustafa
Improving the debugability of this code path by logging the thrown exception details for the non 404 exceptions. Retry IMDS on HTTP Error 404 and 410, re-run DHCP on other exceptions.
2020-06-02test: fix all flake8 E121 and E123 errors (#404)Joshua Powers
This fixes issues with closing brackets not matching the opening bracket's line and continuation line under-idented for hanging indent.
2020-06-02test: fix all flake8 E241 (#403)Joshua Powers
Remove extra spaces after a ','
2020-06-02test: ignore flake8 E402 errors in main.py (#402)Joshua Powers
This puts an ignore on the imports not at the top of the file errors. The reason for the ignore instead of fix is that the file is using imp to grab a lock and patch logging before further imports are completed.
2020-06-01cc_grub_dpkg: determine idevs in more robust manner with grub-probe (#358)Matthew Ruffell
Replace the hardcoded list of devices with a more robust way of determining the device which grub is installed to. We use grub-probe to fetch the underlying disk the /boot directory is located on, and attempt to match the disk with its /dev/disk/by-id value. If no such /dev/disk/by-id/ value exists, we fallback to the plain disk name. The changes are robust to unstable kernel device names and ordering, and use /dev/disk/by-id values to populate grub-pc/install_devices where possible. LP: #1877491
2020-06-01test: fix all flake8 E741 errors (#401)Joshua Powers
This removes the use of variables named ‘l’, ‘O’, or ‘I’. Generally these are used in list comprehension to read the line of lines.
2020-05-28tests: add groovy integration tests for ubuntu (#400)Chad Smith
2020-05-27Enable chef_license support for chef infra client (#389)Bipin Bachhao
Co-authored-by: Daniel Watkins <oddbloke@ubuntu.com>
2020-05-27testing: use flake8 again (#392)Joshua Powers
Instead of running pycodestyle and pyflakes seperately, use flake8 to get the benefits of pyflakes and also stylistic checks as well as the ability to configure the settings for the project.
2020-05-27enable Puppet, Chef mcollective in default config (#385)Mina Galić (deprecated: Igor Galić)
These config management things work on BSD, they also claim to work on all distros, so enabling them! LP: #1880279
2020-05-26HACKING.rst: introduce .net -> Networking refactor section (#384)Daniel Watkins
2020-05-25Travis: do not install python3-contextlib2 (dropped dependency) (#388)Paride Legovini
2020-05-22HACKING: mention that .github-cla-signers is alpha-sorted (#380)Daniel Watkins
Hopefully this will save some ~pointless round trips on CLA PRs.
2020-05-22Add bipinbachhao as contributor (#379)Bipin Bachhao
2020-05-21cc_snap: validate that assertions property values are strings (#370)Daniel Watkins
And add an example of providing a list of assertions.
2020-05-21conftest: implement partial disable_subp_usage (#371)Daniel Watkins
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.
2020-05-19test_resolv_conf: refresh stale comment (#374)Daniel Watkins
2020-05-18cc_snap: apply validation to snap.commands properties (#364)Daniel Watkins
Specifically, ensure that given values are either strings, or arrays of strings.
2020-05-18make finding libc platform independent (#366)Mina Galić (deprecated: Igor Galić)
and slower. and since we're making it slower, let's cache it, in case boottime gets called more than once.
2020-05-15doc/rtd/topics/faq: Updates LXD docs links to current site (#368)TomP
We are longer using lxd.readthedocs.io Signed-off-by: Thomas Parrott thomas.parrott@canonical.com
2020-05-14templater: drop Jinja Python 2 compatibility shim (#353)Daniel Watkins
2020-05-14cloudinit: minor pylint fixes (#360)Daniel Watkins
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
2020-05-14cloudinit: remove unneeded __future__ imports (#362)Daniel Watkins
We live in the future now.
2020-05-14migrating momousta lp user to Moustafa-Moustafa GitHub user (#361)Moustafa Moustafa
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.