Skip to content

Focal drop condition environment from hotplug#5448

Merged
blackboxsw merged 34 commits into
canonical:ubuntu/focalfrom
blackboxsw:focal-drop-condition-environment
Jul 3, 2024
Merged

Focal drop condition environment from hotplug#5448
blackboxsw merged 34 commits into
canonical:ubuntu/focalfrom
blackboxsw:focal-drop-condition-environment

Conversation

@blackboxsw
Copy link
Copy Markdown
Collaborator

  • I have signed the CLA: https://ubuntu.com/legal/contributors
  • I have added my Github username to tools/.github-cla-signers
  • I have included a comprehensive commit message using the guide below
  • I have added unit tests to cover the new behavior under tests/unittests/
    • Test files should map to source files i.e. a source file cloudinit/example.py should be tested by tests/unittests/test_example.py
    • Run unit tests with tox -e py3
  • I have kept the change small, avoiding unnecessary whitespace or non-functional changes.
  • I have added a reference to issues that this PR relates to in the PR message (Refs integration: do not LXD bind mount /etc/cloud/cloud.cfg.d #1234, Fixes: integration: do not LXD bind mount /etc/cloud/cloud.cfg.d #1234)
  • I have updated the documentation with the changed behavior.
    • If the change doesn't change the user interface and is trivial, this step may be skipped.
    • Cloud-config documentation is generated from the jsonschema.
    • Generate docs with tox -e docs.

Proposed Commit Message

fix(systemd): drop unsupported ConditionEnvironment from hotplug

Additionally drop ConditionEnvironment config from hotplug units
as it is not supported on Focal's version of systemd.

Fixes: GH-5402

Additional Context

Test Steps

quilt push -a
git diff debian/changes/*hotplug*
quilt pop -a

Merge type

  • Squash merge using "Proposed Commit Message"
  • Rebase and merge unique commits. Requires commit messages per-commit each referencing the pull request number (#<PR_NUM>)

Copy link
Copy Markdown
Contributor

@aciba90 aciba90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @blackboxsw, for addressing this.

quilt push -a
git diff systemd/*hotplug*
quilt pop -a

The patch changes and the above commands look good, but CI and I are having troubles building the package:

$ build-package 
Preparing worktree (detached HEAD fbdfb2e71)
HEAD is now at fbdfb2e71 fix(systemd): drop unsupported ConditionEnvironment from hotplug
Found UNRELEASED in debian/changelog. Do you really want to build-package ? (y/n)  y
pkg_name=cloud-init pkg_ver=24.1.3-0ubuntu1~20.04.4 upstream_ver=24.1.3 suite=UNRELEASED
Check for an upstream cloud-init_24.1.3.orig.tar.gz on which to base this debdiff ? (y/n)  n
========================================
./tools/make-tarball --output=../dl/cloud-init_24.1.3.orig.tar.gz
../dl/cloud-init_24.1.3.orig.tar.gz
========================================
Removing upstream's debian dir in favor of packaging.
building with: -d -S -nc
 dpkg-buildpackage -d -us -uc -ui -S -nc
dpkg-buildpackage: info: source package cloud-init
dpkg-buildpackage: info: source version 24.1.3-0ubuntu1~20.04.4
dpkg-buildpackage: info: source distribution UNRELEASED
dpkg-buildpackage: info: source changed by Chad Smith <chad.smith@canonical.com>
 dpkg-source --before-build .
dpkg-source: info: using patch list from debian/patches/series
dpkg-source: info: applying retain-apt-partner-pocket.patch
dpkg-source: info: applying expire-on-hashed-users.patch
dpkg-source: info: applying retain-netplan-world-readable.patch
dpkg-source: info: applying netplan99-cannot-use-default.patch
dpkg-source: info: applying retain-old-groups.patch
dpkg-source: info: applying keep-dhclient-as-priority-client.patch
dpkg-source: info: applying revert-551f560d-cloud-config-after-snap-seeding.patch
dpkg-source: info: applying status-do-not-remove-duplicated-data.patch
dpkg-source: info: applying retain-apt-pre-deb822.patch
dpkg-source: info: applying status-retain-recoverable-error-exit-code.patch
dpkg-source: info: applying retain-ec2-default-net-update-events.patch
dpkg-source: info: applying cli-retain-file-argument-as-main-cmd-arg.patch
dpkg-source: info: applying drop-unsupported-systemd-condition-environment.patch
patching file systemd/cloud-config.service.tmpl
Hunk #1 FAILED at 6.
1 out of 1 hunk FAILED
patching file systemd/cloud-final.service.tmpl
patching file systemd/cloud-init-local.service.tmpl
patching file systemd/cloud-init.service.tmpl
patching file systemd/cloud-init.target
patching file systemd/cloud-init-hotplugd.service
patching file systemd/cloud-init-hotplugd.socket
dpkg-source: info: the patch has fuzz which is not allowed, or is malformed
dpkg-source: info: if patch 'drop-unsupported-systemd-condition-environment.patch' is correctly applied by quilt, use 'quilt refresh' to update it
dpkg-source: info: if the file is present in the unpacked source, make sure it is also present in the orig tarball
dpkg-source: info: restoring quilt backup files for drop-unsupported-systemd-condition-environment.patch
dpkg-source: error: LC_ALL=C patch -t -F 0 -N -p1 -u -V never -E -b -B .pc/drop-unsupported-systemd-condition-environment.patch/ --reject-file=- < wtd/debian/patches/drop-unsupported-systemd-condition-environment.patch subprocess returned exit status 1
dpkg-buildpackage: error: dpkg-source --before-build . subprocess returned exit status 2
debuild: fatal error at line 1184:
dpkg-buildpackage -d -us -uc -ui -S -nc failed
FAILED: debuild -d -S -nc

The same happens running sbuild -d focal or debuild -uc -us.
Not sure what happens. Do we need to refresh the patches, or is this something related to how we deal with the upstream tarball?

holmanb and others added 24 commits June 28, 2024 13:52
8906e17 is causing some test failures on older releases.
Fix them
Commit 8470af0 changes the integration test keyserver PPA to
ppa:curtin-dev/daily. Update the assertion key fingerprint.
Adapt util.should_log_deprecation to expect two params:
- version: where the key/feature was deprecated
- boundary_version: at which deprecation level logs occur
Per [1], org's correct type is string. Added as new type and deprecated
integer.

References:
[1] https://github.com/candlepin/subscription-manager/blob/b6fad11e7783ae414fe88fdecee57d8db5c8e292/man/subscription-manager.8#L589

Fixes canonicalGH-5382

Co-authored-by: pneigel-ca <patrick.neigel@gmail.com>
…anonical#5475)

The ubuntu_advantage key is deprecated in 24.1 in favor of ubuntu_pro.

Any version less than 24.1 will have only an info level log resulting in
no DEPRECATED keys from cloud-init status --format=yaml.

Parse log level messages in /var/log/cloud-init.log instead.
- Update deprecation test to include focal.
- Update test using `cloud-id` appropriately
Remove code for detecting a virtualenv. This has been broken since ~3.7.
Invalid type annotations confuse mypy.

When it sees a type annotation that doesn't conflict with other
annotations, it is trusted. This means that future attempts to
conditionally check a variable's type will cause mypy to produce an
unreachable code path warning.
Later use of the same variable name leads mypy to report unreachable code
paths.
Mypy infers an unannotated variable's type from its initial value.
When a variable's type may change (such as from None to non-None),
the variable's type needs to be annotated, otherwise mypy may warn
of unreachable code paths.
Enable mypy's "warn_unreachable" checks.
Remove adjacent unused mocks.

Note: mypy can incorrectly report typing errors as "unused code paths"
Python's provides type annotation features which allow validating types
throughout the code base. Use, rather than ignore, these features.

Note that since a dict's .get() may return None, using this method
when the only possible return value is a literal will confuse mypy.
Enable positional arguments for various environments.
Add missing deps for tip-mypy.
The -tip envs were broken when a non-tip env existed. In these cases,
{[testenv:mypy]commands} resolved to the non-tip environment. Fix it.
Fix the current network v2 schema as well.
This doesn't add anything useful on its own, but it defines a custom
type which can easily be overridden.

See canonicalGH-5398 for more details.
This also satisfies mypy via type narrowing, which hasattr() does not
accomplish.
jsonschema is still a soft dependency, so don't fail it not present.
blackboxsw and others added 8 commits July 2, 2024 11:13
Update test to reduce expected deprecation count when
below deprecation boundary. changed_version messages are still logged.
Also use ca_certs instead of ca-certs deprecated key
Bump the version in cloudinit/version.py to 24.2 and
update ChangeLog.
Systemd on focal does not support ConditionEnvironment in units which
raises a warning in journalctl. Drop these unused conditions from
cloud-init-hotplug.service and socket units.

Fixes canonicalGH-5402
patches:
debian/patches/deprecation-version-boundary.patch
debian/patches/revert-551f560d-cloud-config-after-snap-seeding.patch
@blackboxsw blackboxsw force-pushed the focal-drop-condition-environment branch from fbdfb2e to 13e5033 Compare July 3, 2024 02:26
@blackboxsw
Copy link
Copy Markdown
Collaborator Author

@aciba90 I should have probably performed a new_upstream_snapshot.py on this branch after adapting the quilt patch to ensure the ubuntu/focal branch remained buildable without requiring one to merge into upstream/main first (which would have resolved things for daily recipe builds but not the local branch as you saw).

I have since refactored the original commit 7a2163c, sync'd any unreleased changes from ubuntu/focal-24.1.x:debian/changelog and performed new_upstream_snapshot.py -c 24.3 to actually plan on releasing this branch.

Please feel free to test this package build fully:

cd /tmp
mkdir ../dl
cd dl
wget https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/cloud-init/24.2-0ubuntu1/cloud-init_24.2.orig.tar.gz
cd ../
git clone git@github.com:canonical/cloud-init.git -o upstream
cd cloud-init
git remote add blackboxsw git@github.com:blackboxsw/cloud-init.git 
git checkout blackboxsw/ubuntu/focal -B ubuntu/focal
quilt push -a
tox .-e py3
quilt pop -a
build-package
sbuild --dist=focal --arch=amd64 --arch-all ../out/cloud-init_24.2*.dsc
```

@blackboxsw blackboxsw requested a review from aciba90 July 3, 2024 02:42
@blackboxsw blackboxsw force-pushed the focal-drop-condition-environment branch from 13e5033 to ed04e0b Compare July 3, 2024 02:45
Copy link
Copy Markdown
Contributor

@aciba90 aciba90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

  • Version looks good after new upstream snapshot
  • Patches apply cleanly
  • sbuild
  • quilt push -a && tox -e py3 && quitl pop -a

Comment thread debian/changelog Outdated
@blackboxsw blackboxsw force-pushed the focal-drop-condition-environment branch from ed04e0b to f8dccc3 Compare July 3, 2024 17:06
@blackboxsw blackboxsw merged commit f8dccc3 into canonical:ubuntu/focal Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants