[elbe-devel] [PATCH 2/2] debinstaller: move sig=urlopen() out of try: finally: block
Manuel Traut
manut at linutronix.de
Wed Nov 21 15:32:10 CET 2018
On Wed, Nov 21, 2018 at 01:08:05PM +0100, Torben Hohn wrote:
> when Release.gpg does not exist on the mirror, this backtrace is generated:
>
> File "/home/manut/Projects/elbe/elbe/elbe", line 55, in <module>
> cmdmod.run_command(sys.argv[2:])
> File "/home/manut/Projects/elbe/elbe/elbepack/commands/init.py", line 168, in run_command
> copy_kinitrd(xml.node("/initvm"), out_path)
> File "/home/manut/Projects/elbe/elbe/elbepack/debinstaller.py", line 231, in copy_kinitrd
> download_kinitrd(tmp, suite, mirror)
> File "/home/manut/Projects/elbe/elbe/elbepack/debinstaller.py", line 169, in download_kinitrd
> download_release(tmp, base_url)
> File "/home/manut/Projects/elbe/elbe/elbepack/debinstaller.py", line 157, in download_release
> sig.close()
> UnboundLocalError: local variable 'sig' referenced before assignment
>
> move urlopen() out of the try: block. it did not catch the exception.
> so the bahviour is not changed.
>
> Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
Signed-off-by: Manuel Traut <manut at linutronix.de>
Reviewed-by: Manuel Traut <manut at linutronix.de>
and merged into devel/elbe-3.0 - thank you.
> ---
> elbepack/debinstaller.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/elbepack/debinstaller.py b/elbepack/debinstaller.py
> index baf8d8d4..96d1d841 100644
> --- a/elbepack/debinstaller.py
> +++ b/elbepack/debinstaller.py
> @@ -136,8 +136,8 @@ def download_release(tmp, base_url):
> # open downloaded plaintext file, and
> # use the urlopen object of the Release.gpg
> # directtly.
> + sig = urlopen(base_url + 'Release.gpg', None, 10)
> try:
> - sig = urlopen(base_url + 'Release.gpg', None, 10)
> with tmp.open("Release", "r") as signed:
>
> overall_status = OverallStatus()
> --
> 2.11.0
>
>
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel
More information about the elbe-devel
mailing list