Repository: rucio/rucio
Issue: Use before assignment in downloadclient extractools

Motivation
----------
```
[losanti@lxplus723 ~]$  rucio -v get mc16_13TeV:DAOD_FTAG4.24348858._000944.pool.root.1
2021-03-25 12:44:45,630	INFO	Processing 1 item(s) for input
2021-03-25 12:44:45,630	DEBUG	downloadclient.py	num_unmerged_items=1; num_dids=1; num_merged_items=1
2021-03-25 12:44:45,630	INFO	Getting sources of DIDs
2021-03-25 12:44:45,672	DEBUG	downloadclient.py	schemes: None
2021-03-25 12:44:45,672	DEBUG	downloadclient.py	rse_expression: None
2021-03-25 12:44:45,672	DEBUG	downloadclient.py	num DIDs for list_replicas call: 1
2021-03-25 12:44:45,768	DEBUG	downloadclient.py	num resolved files: 1
2021-03-25 12:44:45,782	DEBUG	downloadclient.py	"unzip -v" returned with exitcode 0
2021-03-25 12:44:45,802	DEBUG	rucio	Traceback (most recent call last):
  File "/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/rucio-clients/1.25.0.patch1/bin/rucio", line 132, in new_funct
    return function(*args, **kwargs)
  File "/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/rucio-clients/1.25.0.patch1/bin/rucio", line 1044, in download
    result = download_client.download_dids(items, args.ndownloader, trace_pattern)
  File "/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/rucio-clients/1.25.0.patch1/lib/python2.7/site-packages/rucio/client/downloadclient.py", line 288, in download_dids
    input_items = self._prepare_items_for_download(did_to_options, merged_items_with_sources, resolve_archives=resolve_archives)
  File "/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/rucio-clients/1.25.0.patch1/lib/python2.7/site-packages/rucio/client/downloadclient.py", line 1147, in _prepare_items_for_download
    self.extraction_tools = [tool for tool in self.extraction_tools if tool.is_useable()]
  File "/cvmfs/atlas.cern.ch/repo/ATLASLocalRootBase/x86_64/rucio-clients/1.25.0.patch1/lib/python2.7/site-packages/rucio/client/downloadclient.py", line 89, in is_useable
    self.logger(logging.DEBUG, 'Failed to execute: "%s"' % exitcode)
UnboundLocalError: local variable 'exitcode' referenced before assignment
```


Modification
------------

The logger string should be constructed using the "cmd" variable


Changed files:
lib/rucio/client/downloadclient.py

diff --git a/lib/rucio/client/downloadclient.py b/lib/rucio/client/downloadclient.py
index 5d1065c7f..765bb9b2f 100644
--- a/lib/rucio/client/downloadclient.py
+++ b/lib/rucio/client/downloadclient.py
@@ -86,7 +86,7 @@ class BaseExtractionTool:
             self.logger(logging.DEBUG, '"%s" returned with exitcode %d' % (cmd, exitcode))
             self.is_usable_result = (exitcode == 0)
         except Exception as error:
-            self.logger(logging.DEBUG, 'Failed to execute: "%s"' % exitcode)
+            self.logger(logging.DEBUG, 'Failed to execute: "%s"' % cmd)
             self.logger(logging.DEBUG, error)
         return self.is_usable_result
 
@@ -113,7 +113,7 @@ class BaseExtractionTool:
             self.logger(logging.DEBUG, '"%s" returned with exitcode %d' % (cmd, exitcode))
             return (exitcode == 0)
         except Exception as error:
-            self.logger(logging.DEBUG, 'Failed to execute: "%s"' % exitcode)
+            self.logger(logging.DEBUG, 'Failed to execute: "%s"' % cmd)
             self.logger(logging.DEBUG, error)
         return False