← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1977952] Re: In 22.2 cloud-init fails when phone-home module does not have "tries" parameter

 

This bug was fixed in the package cloud-init -
22.2-64-g1fcd55d6-0ubuntu1~22.10.1

---------------
cloud-init (22.2-64-g1fcd55d6-0ubuntu1~22.10.1) kinetic; urgency=medium

  * d/control: add python3-debconf as Depends and Build-Depends
  * d/gbp.conf d/gbp_format_changelog:
    + git-buildpackage customization for debian/changelog generation
  * New upstream snapshot.
    + tests: mock dns lookup that causes long timeouts (#1555)
    + tox: add unpinned env for do_format and check_format (#1554)
    + cc_ssh_import_id: Substitute deprecated warn (#1553)
      [Alberto Contreras]
    + Remove schema errors from log (#1551) (LP: #1978422) (CVE-2022-2084)
    + Update WebHookHandler to run as background thread (SC-456) (#1491)
      (LP: #1910552)
    + testing: Don't run custom cloud dir test on Bionic (#1542)
    + bash completion: update schema command (#1543) (LP: #1979547)
    + CI: add non-blocking run against the linters tip versions (#1531)
      [Paride Legovini]
    + Change groups within the users schema to support lists and strings
      (#1545) [RedKrieg]
    + make it clear which username should go in the contributing doc (#1546)
    + Pin setuptools for Travis (SC-1136) (#1540)
    + Fix LXD datasource crawl when BOOT enabled (#1537)
    + testing: Fix wrong path in dual stack test (#1538)
    + cloud-config: honor cloud_dir setting (#1523) (LP: #1976564)
      [Alberto Contreras]
    + Add python3-debconf to pkg-deps.json Build-Depends (#1535)
      [Alberto Contreras]
    + redhat spec: udev/rules.d lives under /usr/lib on rhel-based systems
      (#1536)
    + tests/azure: add test coverage for DisableSshPasswordAuthentication
      (#1534) [Chris Patterson]
    + summary: Add david-caro to the cla signers (#1527) [David Caro]
    + Add support for OpenMandriva (https://openmandriva.org/) (#1520)
      [Bernhard Rosenkraenzer]
    + tests/azure: refactor ovf creation (#1533) [Chris Patterson]
    + Improve DataSourceOVF error reporting when script disabled (#1525)
      [rong]
    + tox: integration-tests-jenkins: softfail if only some test failed
      (#1528) [Paride Legovini]
    + CI: drop linters from Travis CI (moved to GH Actions) (#1530)
      [Paride Legovini]
    + sources/azure: remove unused encoding support for customdata (#1526)
      [Chris Patterson]
    + sources/azure: remove unused metadata captured when parsing ovf
      (#1524) [Chris Patterson]
    + sources/azure: remove dscfg parsing from ovf-env.xml (#1522)
      [Chris Patterson]
    + Remove extra space from ec2 dual stack crawl message (#1521)
    + tests/azure: use namespaces in generated ovf-env.xml documents (#1519)
      [Chris Patterson]
    + setup.py: adjust udev/rules default path (#1513)
      [Emanuele Giuseppe Esposito]
    + Add python3-deconf dependency (#1506) [Alberto Contreras]
    + Change match macadress param for network v2 config (#1518)
      [Henrique Caricatti Capozzi]
    + sources/azure: remove unused userdata property from ovf (#1516)
      [Chris Patterson]
    + sources/azure: minor refactoring to network config generation (#1497)
      [Chris Patterson]
    + net: Implement link-local ephemeral ipv6
    + Rename function to avoid confusion (#1501)
    + Fix cc_phone_home requiring 'tries' (#1500) (LP: #1977952)
    + datasources: replace networking functions with stdlib and
    cloudinit.net code
    + Remove xenial references (#1472) [Alberto Contreras]
    + Oracle ds changes (#1474) (LP: #1967942) [Alberto Contreras]
    + improve runcmd docs (#1498)
    + add 3.11-dev to Travis CI (#1493)
    + Only run github actions on pull request (#1496)
    + Fix integration test client creation (#1494) [Alberto Contreras]
    + tox: add link checker environment, fix links (#1480)
    + cc_ubuntu_advantage: Fix doc (#1487) [Alberto Contreras]
    + cc_yum_add_repo: Fix repo id canonicalization (#1489) (LP: #1975818)
      [Alberto Contreras]
    + Add linitio as contributor in the project (#1488) [Kevin Allioli]
    + net-convert: use yaml.dump for debugging python NetworkState obj
      (#1484) (LP: #1975907)
    + test_schema: no relative $ref URLs, replace $ref with local path
      (#1486)
    + cc_set_hostname: do not write "localhost" when no hostname is given
      (#1453) [Emanuele Giuseppe Esposito]
    + Update .github-cla-signers (#1478) [rong]
    + schema: write_files defaults, versions $ref full URL and add vscode
      (#1479)
    + docs: fix external links, add one more to the list (#1477)
    + doc: Document how to change module frequency (#1481)
    + tests: bump pycloudlib (#1482)
    + tests: bump pycloudlib pinned commit for kinetic Azure (#1476)
    + testing: fix test_status.py (#1475)
    + integration tests: If KEEP_INSTANCE = True, log IP (#1473)
    + Drop mypy excluded files (#1454) [Alberto Contreras]
    + Docs additions (#1470)
    + Add "formatting tests" to Github Actions
    + Remove unused arguments in function signature (#1471)
    + Changelog: correct errant classification of LP issues as GH (#1464)
    + Use Network-Manager and Netplan as default renderers for RHEL and
      Fedora (#1465) [Emanuele Giuseppe Esposito]

 -- James Falcon <james.falcon@xxxxxxxxxxxxx>  Fri, 01 Jul 2022 10:07:15
-0500

** Changed in: cloud-init (Ubuntu)
       Status: Fix Committed => Fix Released

** CVE added: https://cve.mitre.org/cgi-bin/cvename.cgi?name=2022-2084

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1977952

Title:
  In 22.2 cloud-init fails when phone-home module does not have "tries"
  parameter

Status in cloud-init:
  Fix Committed
Status in cloud-init package in Ubuntu:
  Fix Released
Status in cloud-init source package in Bionic:
  Fix Released
Status in cloud-init source package in Focal:
  Fix Released
Status in cloud-init source package in Impish:
  Fix Released
Status in cloud-init source package in Jammy:
  Fix Released

Bug description:
  === Begin SRU Template ===
  [Impact]
  The cloud-init "phone home" module contains an optional "tries" parameter. In release 22.2, this was accidentally changed to become mandatory. Any previously working cloud-config that didn't contain the "tries" parameter will now cause the module exit with exception. This happened because an overly broad exception handler for converting the 'tries' string to an int was changed to only raise on ValueError. However, if None (or any other non-string) is passed, a TypeError is raised, and this needs to be caught as well.

  [Test Case]
  1. Launch an Ubuntu instance on any cloud-init supported platform with the following userdata:

  #cloud-config
  phone_home:
    url: http://192.168.1.1
    post: all

  2. By inspecting /var/log/cloud-init.log, ensure the phone home module attempts to make a web request, with the following log:
  url_helper.py[DEBUG]: [0/10] open 'http://192.168.1.1' with {'url': 'http://192.168.1.1', 'allow_redirects': True, 'method': 'POST', 'headers': {'User-Agent': 'Cloud-Init/22.2'}} configuration

  [Regression Potential]
  The parsing exceptions being caught should now be broad enough to handle any configuration we receive, but if not, we would still exit the module with exception.

  [Other Info]
  Github PR: https://github.com/canonical/cloud-init/pull/1500

  === End SRU Template ===

  Initial bug:

  Hi!

  We have some user-data files where we use the phone-home module of cloud-init.
  So far we did not use it's "tries" parameter and everything worked.
  However now in version 22.2 there was a change which causes cloud-init to fail.
  https://github.com/canonical/cloud-init/compare/22.1...22.2#diff-a4aa83fbb946ba1ea7cf6c8dd5965cd62631dc9cb48d4baa50adddbfef06b82cL108

  In our case this change in the exception handling throws a TypeError,
  instead of the ValueError that is excepted:

  File "/usr/lib/python3/dist-packages/cloudinit/config/cc_phone_home.py", line 132, in handle
     tries = int(tries)  # type: ignore
  TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

  While we can add the "tries" parameter (and after that everything works just like before),
  this exception should be handled properly.

  Also according to guidelines:
  1. Tell us your cloud provider
  None
  2. Any appropriate cloud-init configuration you can provide us
  phone-home module
  3. Perform the following on the system and attach it to this bug:
  no logs are necessary

  Best regards:
  Zsolt

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1977952/+subscriptions



References