PFNs that can’t be matched to an RSE remain in the BadPFNs table forever
Motivation
----------

For example:
```
$ rucio-admin replicas declare-bad --reason test srm://example.com/foo/bar/baz
Chunk 1/1 : 1 replicas successfully declared
--------------------------------
Summary
1 replicas successfully declared
```
The return values from [`get_pfn_to_rse()`](https://github.com/rucio/rucio/blob/420d5ee55f525c620bdc5decfef2f4a269dbf2e5/lib/rucio/daemons/badreplicas/minos.py#L138) are:
* `_ = 'srm'`
* `tmp_dict_rse = {}`
* `tmp_unknown_replicas = {'unknown': ['srm://example.com/foo/bar/baz']}`

However, the `for` loop that follows goes over the items in `tmp_dict_rse`. Since it’s empty, the PFNs are not processed.

Modification
------------

As far as I can tell, [line 143](https://github.com/rucio/rucio/blob/420d5ee55f525c620bdc5decfef2f4a269dbf2e5/lib/rucio/daemons/badreplicas/minos.py#L143) need to be moved out of that inner `for` loop.

diff --git a/lib/rucio/daemons/badreplicas/minos.py b/lib/rucio/daemons/badreplicas/minos.py
index a4ff1555e..1a57a9a95 100644
--- a/lib/rucio/daemons/badreplicas/minos.py
+++ b/lib/rucio/daemons/badreplicas/minos.py
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-# Copyright 2018-2020 CERN
+# Copyright 2018-2021 CERN
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -22,6 +22,7 @@
 # - Patrick Austin <patrick.austin@stfc.ac.uk>, 2020
 # - Eli Chadwick <eli.chadwick@stfc.ac.uk>, 2020
 # - Benedikt Ziemons <benedikt.ziemons@cern.ch>, 2020
+# - Dimitrios Christidis <dimitrios.christidis@cern.ch>, 2021
 
 from __future__ import division
 
@@ -140,7 +141,7 @@ def minos(bulk=1000, once=False, sleep_time=60):
                             if rse_id not in dict_rse:
                                 dict_rse[rse_id] = []
                             dict_rse[rse_id].extend(tmp_dict_rse[rse_id])
-                            unknown_replicas.extend(tmp_unknown_replicas.get('unknown', []))
+                        unknown_replicas.extend(tmp_unknown_replicas.get('unknown', []))
                     # The replicas in unknown_replicas do not exist, so we flush them from bad_pfns
                     if unknown_replicas:
                         logging.info(prepend_str + 'The following replicas are unknown and will be removed : %s' % str(unknown_replicas))
['lib/rucio/daemons/badreplicas/minos.py']