Skyedra / UnspamifyUbuntu

Remove spam from Ubuntu
MIT License
152 stars 9 forks source link

Replacing ubuntu-advantage-tools breaks update-manager #4

Closed chabala closed 1 year ago

chabala commented 1 year ago

I have been using fake-ubuntu-advantage-tools with great success on 22.10, and have updated to the new version for 23.04.

I see now that the GUI update-manager tool has been broken by the replacement, and I suspect it acquired a dependency on ua-tools in 23.04:

$ /usr/bin/update-manager 
Traceback (most recent call last):
  File "/usr/bin/update-manager", line 38, in <module>
    from UpdateManager.UpdateManager import UpdateManager
  File "/usr/lib/python3/dist-packages/UpdateManager/UpdateManager.py", line 44, in <module>
    from uaclient.api.u.pro.packages.updates.v1 import updates
ModuleNotFoundError: No module named 'uaclient'

I have hacked this out, and all is working now, but perhaps fake-ubuntu-advantage-tools should manage this as well. Here's my sloppy hack:

44c44
< from uaclient.api.u.pro.packages.updates.v1 import updates
---
> #from uaclient.api.u.pro.packages.updates.v1 import updates
278,288c278,288
<     def _get_ua_security_status(self):
<         self.ua_security_packages = []
<         try:
<             update_result = updates()
<         except (IOError, OSError):
<             return
<         for info in update_result.updates:
<             if info.status == "pending_attach":
<                 self.ua_security_packages.append(
<                     (info.package, info.version, info.download_size)
<                 )
---
>     #def _get_ua_security_status(self):
>     #    self.ua_security_packages = []
>     #    try:
>     #        update_result = updates()
>     #    except (IOError, OSError):
>     #        return
>     #    for info in update_result.updates:
>     #        if info.status == "pending_attach":
>     #            self.ua_security_packages.append(
>     #                (info.package, info.version, info.download_size)
>     #            )
459c459
<         self._get_ua_security_status()
---
>         #self._get_ua_security_status()
Skyedra commented 1 year ago

Thanks for the patch! I confirmed this was necessary in 23.04 and added it to the instructions