Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restore-new-distro: lsb_release.get_lsb_information doesn't work #5

Open
martinvonwittich opened this issue Apr 4, 2018 · 1 comment

Comments

@martinvonwittich
Copy link

martinvonwittich commented Apr 4, 2018

I get the following error message when trying to use restore-new-distro:

host ~ # DEBIAN_FRONTEND=noninteractive apt-clone restore-new-distro --simulate /old/apt.apt-clone.tar.gz stretch
Traceback (most recent call last):
  File "/usr/bin/apt-clone", line 136, in <module>
    codename = lsb_release.get_lsb_information()["CODENAME"]
KeyError: 'CODENAME'

Apparently get_lsb_information() will only attempt to read $LSB_ETC_LSB_RELEASE or /etc/lsb-release; if that file doesn't exist, it won't return anything at all (see /usr/lib/python3/dist-packages/lsb_release.py). You probably want get_distro_information() instead:

host ~ # diff -u =apt-clone apt-clone2 
--- /usr/bin/apt-clone  2015-11-13 21:11:38.000000000 +0100
+++ apt-clone2  2018-04-04 15:32:47.412898874 +0200
@@ -133,7 +133,7 @@
         # we are not yet on the new release its fine to remove installed
         # pkgs as part of the upgrade
         import lsb_release
-        codename = lsb_release.get_lsb_information()["CODENAME"]
+        codename = lsb_release.get_distro_information()["CODENAME"]
         if (args.new_distro_codename and args.new_distro_codename == codename):
             protect_installed = True
         else:
@ymartin59
Copy link

I guess this can be closed according to #9

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

No branches or pull requests

2 participants