<?xml version="1.0" encoding="UTF-8" ?>

<bugzilla version="5.2"
          urlbase="https://bugzilla.altlinux.org/"
          
          maintainer="jenya@basealt.ru"
>

    <bug>
          <bug_id>52029</bug_id>
          
          <creation_ts>2024-11-12 23:09:56 +0300</creation_ts>
          <short_desc>Bug in downstream altlinux</short_desc>
          <delta_ts>2024-12-16 19:55:01 +0300</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Branch p11</product>
          <component>cloud-init</component>
          <version>unspecified</version>
          <rep_platform>x86_64</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P5</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Brett Holman">bpholman5</reporter>
          <assigned_to name="qa-team@altlinux.org">qa-team</assigned_to>
          <cc>bpholman5</cc>
    
    <cc>obirvalger</cc>
    
    <cc>shaba</cc>
    
    <cc>stepchenko.alex</cc>
          
          <qa_contact name="qa-p11@altlinux.org">qa-p11</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>254370</commentid>
    <comment_count>0</comment_count>
    <who name="Brett Holman">bpholman5</who>
    <bug_when>2024-11-12 23:09:56 +0300</bug_when>
    <thetext>The lxd ci[1] noticed an issue in ALT linux&apos;s cloud-init package. The issue is caused by code that does not exist in upstream cloud-init:

```
Traceback (most recent call last):
  File &quot;/usr/lib/python3/site-packages/cloudinit/config/modules.py&quot;, line 286, in _run_modules
    ran, _r = cc.run(
              ^^^^^^^
  File &quot;/usr/lib/python3/site-packages/cloudinit/cloud.py&quot;, line 71, in run
    return self._runners.run(name, functor, args, freq, clear_on_fail)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File &quot;/usr/lib/python3/site-packages/cloudinit/helpers.py&quot;, line 156, in run
    results = functor(**args)
              ^^^^^^^^^^^^^^^
  File &quot;/usr/lib/python3/site-packages/cloudinit/config/cc_update_hostname.py&quot;, line 62, in handle 
    cloud.distro.update_hostname(hostname, fqdn, prev_fn)
  File &quot;/usr/lib/python3/site-packages/cloudinit/distros/__init__.py&quot;, line 546, in update_hostname
    prev_hostname = self._read_hostname(prev_hostname_fn)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File &quot;/usr/lib/python3/site-packages/cloudinit/distros/altlinux.py&quot;, line 154, in _read_hostname
    return util.load_file(filename).strip()
           ^^^^^^^^^^^^^^ 
AttributeError: module &apos;cloudinit.util&apos; has no attribute &apos;load_file&apos;
```

It looks like ALT&apos;s distro never made it into upstream, so a recent change in upstream util.py broke ALT&apos;s distro definition. It should be easy to update to use the new function name. If you&apos;re interested in getting the distro defintion into upstream, that would help prevent future breakage like this.

[1] https://github.com/canonical/lxd-ci/pull/344</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>254371</commentid>
    <comment_count>1</comment_count>
    <who name="Brett Holman">bpholman5</who>
    <bug_when>2024-11-12 23:19:52 +0300</bug_when>
    <thetext>I was able to reproduce the issue by undoing the change in the PR linked below. 

To reproduce, basically just undo the effects of the PR in a container, then `cloud-init reboot -h now` to simulate first boot, then reboot the container and see the error. Something like this:

```
$ lxc launch images:alt/p11/cloud alt-p11
[root@alt-p11 ~]# # re-introduce update_hostname to /etc/cloud/cloud.cfg
[root@alt-p11 ~]# # ...
[root@alt-p11 ~]# cloud-init clean --logs --reboot
$ lxc shell alt-p11
[root@alt-p11 ~]# reboot -h now
[root@alt-p11 ~]# # now view the errors
[root@alt-p11 ~]# cloud-init status --long
[root@alt-p11 ~]# # and for more detail:
[root@alt-p11 ~]# vi /var/log/cloud-init.log
```</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>256129</commentid>
    <comment_count>2</comment_count>
    <who name="Alexander Stepchenko">stepchenko.alex</who>
    <bug_when>2024-12-16 11:39:18 +0300</bug_when>
    <thetext>cloud-init-24.2-alt2 -&gt; p11

* Fri Nov 22 2024 Alexander Stepchenko &lt;geochip@altlinux.org&gt; 24.2-alt2
- NMU: Fix update_hostname module (Closes: 52029)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>256175</commentid>
    <comment_count>3</comment_count>
    <who name="Brett Holman">bpholman5</who>
    <bug_when>2024-12-16 19:55:01 +0300</bug_when>
    <thetext>Fix confirmed. The workaround was removed from upstream lxd[1].

[1] https://github.com/canonical/lxd-ci/pull/369</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>