1# This file is part of cloud-init. See LICENSE file for license information.
2"""
3Feature flags are used as a way to easily toggle configuration
4**at build time**. They are provided to accommodate feature deprecation and
5downstream configuration changes.
6
7Currently used upstream values for feature flags are set in
8``cloudinit/features.py``. Overrides to these values (typically via quilt
9patch) can be placed
10in a file called ``feature_overrides.py`` in the same directory. Any value
11set in ``feature_overrides.py`` will override the original value set
12in ``features.py``.
13
14Each flag should include a short comment regarding the reason for
15the flag and intended lifetime.
16
17Tests are required for new feature flags, and tests must verify
18all valid states of a flag, not just the default state.
19"""
20
21ERROR_ON_USER_DATA_FAILURE = True
22"""
23If there is a failure in obtaining user data (i.e., #include or
24decompress fails) and ``ERROR_ON_USER_DATA_FAILURE`` is ``False``,
25cloud-init will log a warning and proceed.  If it is ``True``,
26cloud-init will instead raise an exception.
27
28As of 20.3, ``ERROR_ON_USER_DATA_FAILURE`` is ``True``.
29
30(This flag can be removed after Focal is no longer supported.)
31"""
32
33
34ALLOW_EC2_MIRRORS_ON_NON_AWS_INSTANCE_TYPES = False
35"""
36When configuring apt mirrors, if
37``ALLOW_EC2_MIRRORS_ON_NON_AWS_INSTANCE_TYPES`` is ``True`` cloud-init
38will detect that a datasource's ``availability_zone`` property looks
39like an EC2 availability zone and set the ``ec2_region`` variable when
40generating mirror URLs; this can lead to incorrect mirrors being
41configured in clouds whose AZs follow EC2's naming pattern.
42
43As of 20.3, ``ALLOW_EC2_MIRRORS_ON_NON_AWS_INSTANCE_TYPES`` is ``False``
44so we no longer include ``ec2_region`` in mirror determination on
45non-AWS cloud platforms.
46
47If the old behavior is desired, users can provide the appropriate
48mirrors via :py:mod:`apt: <cloudinit.config.cc_apt_configure>`
49directives in cloud-config.
50"""
51
52try:
53    # pylint: disable=wildcard-import
54    from cloudinit.feature_overrides import *  # noqa
55except ImportError:
56    pass
57