| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To allow for building docs locally in the project-dir, get_schema
needs to source ./config/cloud-init-schema*json which is data files
outside of the typical python module paths.
get_schema will prefer CLOUD_INIT_SCHEMA_DIR environment
variable over Paths.schema_dir if provided.
Allow tox.ini to passenv CLOUD_INIT_SCHEMA_DIR into the tox env.
To generate docs from project directory:
CLOUD_INIT_SCHEMA_DIR=config tox -e doc
To validate schema docs from project directory:
CLOUD_INIT_SCHEMA_DIR=config PYTHONPATH=. python3 \
-m cloudinit.cmd.main devel schema --docs all
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Add tests for _schemapath_for_cloudconfig as it was
incorrectly constructing paths prefixes for list items.
Prevent concatonation of path_prefix to a key if the
key is the same indent_depth as prior line.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ultimately cloud-init wants a single JSON schema file defining
composite schema for all cc_* modules instead of each module
defining it's own sub-schema.
Legacy schema definitions took the form or a "schema" attribute
in each cc_* module. The "new" way would be adding schema
$defs to the single config/cloud-init-schema-<version> file.
End goal is to publish those static composite JSON schema files
to schema validation services to allow externals to consume and
validate user-data before spending resources on invalid
instance launches.
During migration from legacy schema definitions in each cc_*
module, cloudinit needs to support cc_* modules which define
schema localling within the cc_* module as a "schema" attribute.
- get_schema: source config/cloud-init-schema* and supplement with
legacy cc_*.schema definitions to bridge gap between legacy
cc_*.schema defitions and the "new" full config/cloud-init-schema.
- Add support for load_doc to handle legacy and combined schema defs
- get_meta_doc will validate against global composite schema when 'schema'
param absent
- get_meta_doc will also limit scope of documentation to the specific
meta["id"] attribute as defined in global schema $defs. To allow modules
to avoid passing in their own sub-schema
- get_meta_doc needs to find_modules containing "meta" instead of "schema" as
non-legacy schema definitions exist in config/cloud-init-schema* instead of
in python dicts as a cc_*.schema attribute
|
|
|
|
|
|
|
| |
- Define single JSON schema file to allow for validation of full
schema for provided user-data.
- Package schema file in /etc/cloud/cloud-init-1.0.json
- Add Paths.schema_dir and unpickle upgrade test handling
|
|
|
|
|
|
|
|
|
|
| |
Validate full schema one time early in boot just after user-data is
processed. This avoid 51+ repeated calls to validate_cloudcfg_schema
on subsections of the schema.
Moving validation to one place against the whole schema will allow
for a single concise error/warning about schema violations in one place
in logs.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fix has two elements:
- cloud-init status will not correctly report 'not-run' prior to systemd
generator running. Only report "disabled" when generator has run
and /run/cloud-init/disabled exists.
- Expose not-run and disabled state in cloud-id responses
- Add unique error codes from cloud-id for error, disabled and not-run.
The new cloud-id exit codes:
0: success
1: error
2: cloud-init is in disabled state
3: cloud-init generator has not run yet
|
|
|
|
|
|
|
|
|
|
| |
distutils is getting deprecated soon. Let's replace it with suggested
alternatives as suggested in:
https://www.python.org/dev/peps/pep-0632/
Remove `requests` version check and related code from url_helper.py
as the versions specified are old enough to no longer be relevant.
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Sometimes an import might fail for different reasons: the string
is wrongly typed, or the module has a dependency that is not
installed in python.
We should print that there is an import error, otherwise it might be
really difficult to understand what is the root cause of this
issue. Currently, cloud-init just ignores the error and continues.
This can have fatal consequences when used to pick
the datasource to use.
Signed-off-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adds a new module to allow setting keyboard layout,
for use-cases in which cloud-init is used to configure
OS images meant for physical computers instead
of the cloud.
This initial release only implements support
for Linux distributions that allow layout to be
set through systemd's localectl.
LP: #1951593
|
|
|
|
|
|
|
| |
Format tweak to match naming conventions for classes & enums.
No functional changes.
Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Includes:
- Update tox.ini and .travis.yml accordingly
- Cleanup tox.ini with new tox syntax and cloud-init dependencies
- Update documentation accordingly
- Replace/remove xenial references where additional testing isn't required
- Remove xenial checks in integration tests
- Replace yield_fixture with fixture in pytest tests
Sections of code commented with lines like "Remove when Xenial is no
longer supported" still exist as they're require additional testing.
|
|
|
|
|
|
|
|
|
|
| |
On LXD containers /dev/lxd/sock will always exist.
Mock dscheck_LXD to return 1 (NOT_FOUND) to avoid leaking into
test environment and returning LXD as detected.
We have integration tests covering proper LXD datasource detection
so we don't need a Unit test validating the [ -S /dev/lxd/sock] that
is in ds-identify.
|
| |
|
|
|
|
| |
Multiple supported distros (arch/fedora) have changed their default
python version to 3.10. We should include it in the test matrix.
|
|
|
|
|
| |
Currently the integration test job executes unittests as part of package build.
The unittests have their own jobs, so this coverage is redundant and
unnecessary. Save time and remove this test.
|
|
|
|
|
| |
Warn during boot when an empty config is provided. Likewise,
`cloud-init devel schema --annotate` should not throw exception, return
something meaningful instead.
|
|
|
|
| |
Ensure we don't add duplicated nameserver or searchdomains.
This can happen on OpenBSD because of dhcpleased.
|
|
|
|
|
|
|
|
|
|
|
| |
If get_imds_data_with_api_fallback() falls back to the minimum required
API version, it is effectively pinned to the old API version forever.
Remove the failed_desired_api_version property to prevent persistence of
the flag between calls and/or reboots.
The continued presence of this flag in obj.pkl should be harmless.
Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
|
|
|
|
|
|
|
|
|
|
|
| |
cloud-init currently makes calls to ubuntu_advantage without assume-yes.
some ua enable commands, such as ua enable fips, have prompts. In an
automated environment, calling ua enable without --assume-yes will
result in errors and not applying the change. This sets --assume-yes by
default for all enable commands. This capability was added two years ago
in ua commit 576e605ceb5f so should be safe for use in all systems at
this time.
LP: #1954842
|
|
|
|
| |
OpenBSD 7.0 comes with a new service called dhcpleased to manage the DHCP
requests.
|
|
|
| |
So git doesn't use formatting changes for git blame
|
|
|
|
|
| |
Applied Black and isort, fixed any linting issues, updated tox.ini
and CI.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
test_handle_args_error_on_invalid_vaname_paths() would fail when run
as root due to invocation of load_userdata() on the default user/vendor
data locations under the instance link.
- Mock load_userdata() for this test case to avoid loads.
- Update _setup_paths() to configure cloud_dir in temporary location.
- Add new test case to verify that the default locations are loaded
when unspecified.
LP: #1825027
Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
|
|
|
|
|
|
|
| |
* Use proper logging
* Add parsing for patternProperties
* Add label to annotate patternProperties
* Log warning if schema parsing fails during metaschema processing
* Some schema test fixes
|
|
|
|
| |
dh_systemd is now included in the default helper,
no need to specify it anymore for impish
|
|
|
|
| |
- netifaces
- jsonschema
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`sysctl -n hw.disknames` returns a trailing `\n`. We need to clean
this up. In addition, the criteria matching system is a source of
problem because:
- we don't have a way to look up the label of the partition
- we've got situation where an ISO image can be exposed through a virtio
block device.
So we just totally ignore the value of `criteria`. We end-up with a
slightly longer loop of mount-retry. But this way we're sure we don't
miss a configuration disk.
Tested on Kubvirt with the help of Brady Pratt @jbpratt.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Thanks to [1], the hostname is set prior to network bring-up.
The Azure data source has been bouncing the hostname during
setup(), occurring after the hostname has already been
properly configured.
Note that this doesn't prevent leaking the image's hostname
during Azure's _get_data() when it brings up ephemeral DHCP.
However, as are not guaranteed to have the hostname metadata
available from a truly "local" source, this behavior is to
be expected unless we disable `send host-name` from dhclient
config.
[1]: https://github.com/canonical/cloud-init/commit/133ad2cb327ad17b7b81319fac8f9f14577c04df
Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
When the metadata is an ISO image and is exposed through a disk,
the device is called `/dev/sd?a` internally. For instance `/dev/sd1a`.
It can then be mounted with `mount_cd9660 /dev/sd1a /mnt`.
Metadata in the FAT32 format are exposed as `/dev/sd?i`.
With this change, we try to mount `/dev/sd?a` in addition to `/dev/sd?i`.
Closes: https://github.com/ContainerCraft/kmi/issues/12
|
| |
|
| |
|
|
|
|
|
|
|
| |
If building the *.deb fails, exit
Currently integration tests will run and fail with a non-obvious
message. This makes it so the last thing in the logs is whatever
caused the build to fail.
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a test helper to get top level directory
Many tests need to get the location of files & dirs within the cloud-init
project directory.
Tests implement this in various different ways, and often those ways
depend on the current working directory of the pytest invocation.
Create helper functions (and tests) that gets the path of the top
directory or any sub directory under the top directory. This function
does not depend on the environment.
|
|
|
|
|
| |
Parametrized pytest tests get named by on their parameters. If a name
has random characters, it can break the test collection of when
using pytest-xdist. Replace random name with deterministic name.
|
| |
|
| |
|
|
|
| |
LP: #1876941
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Improve schema validation.
This adds strict validation of config module definitions at testing
time, with plumbing included for future runtime validation. This
eliminates a class of bugs resulting from schemas that have definitions
that are incorrect, but get interpreted by jsonschema as
"additionalProperties" that are therefore ignored.
- Add strict meta-schema for jsonschema unit test validation
- Separate schema from module metadata structure
- Improve type annotations for various functions and data types
Cleanup:
- Remove unused jsonschema "required" elements
- Eliminate manual memoization in schema.py:get_schema(),
reference module.__doc__ directly
|
|
|
| |
Fix dead link to "contributing" page in README
|