On 08/29/11 17:39, Brock Pytlik wrote:
Webrev:
https://cr.opensolaris.org/action/browse/pkg/bpytlik/18872-v1

Bug:
18872 traceback in __get_crl running pkg verify as non-root

Thanks,
Brock
_______________________________________________
pkg-discuss mailing list
pkg-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss
Ok, here's round two.
Webrev:
https://cr.opensolaris.org/action/browse/pkg/bpytlik/18872-v2

Incremental diff:
diff -r ff9a77c6c79b -r b336df0e4055 src/modules/client/publisher.py
--- a/src/modules/client/publisher.py   Mon Aug 29 17:38:13 2011 -0700
+++ b/src/modules/client/publisher.py   Tue Aug 30 14:59:43 2011 -0700
@@ -2246,6 +2246,10 @@
                             path=orig.path,
                             params=orig.params, query=orig.params,
                             fragment=orig.fragment))
+                # If we've already read the CRL, use the previously created
+                # object.
+                if uri in self.__tmp_crls:
+                        return self.__tmp_crls[uri]
                 fn = urllib.quote(uri, "")
                 assert os.path.isdir(self.__crl_root)
                 fpath = os.path.join(self.__crl_root, fn)
@@ -2269,15 +2273,12 @@
                                 # and nu can be compared.
                                 cur_time = dt.datetime.now(nu.tzinfo)
                                 if cur_time < nu:
+                                        self.__tmp_crls[uri] = crl
                                         return crl
                 # If the CRL is already known to be unavailable, don't try
                 # connecting to it again.
                 if uri in Publisher.__bad_crls:
                         return crl
- # If we've already temporarily retrieved the CRL but couldn't
-                # move it into place, use the CRL previously retrieved.
-                if uri in self.__tmp_crls:
-                        return self.__tmp_crls[uri]
# If no CRL already exists or it's time to try to get a new one,
                 # try to retrieve it from the server.
                 try:
diff -r ff9a77c6c79b -r b336df0e4055 src/tests/cli/t_pkgsign.py
--- a/src/tests/cli/t_pkgsign.py        Mon Aug 29 17:38:13 2011 -0700
+++ b/src/tests/cli/t_pkgsign.py        Tue Aug 30 14:59:43 2011 -0700
@@ -1785,7 +1785,7 @@

         def test_crl_8(self):
                 """Test that if two packages share the same CRL, it's only
- downloaded one even if it can't be stored permanently in the + downloaded once even if it can't be stored permanently in the
                 image."""

                 def cnt_crl_contacts(log_path):
@@ -1831,10 +1831,10 @@
                 self.pkg("verify", su_wrap=True, exit=1)
self.assertEqual(cnt_crl_contacts(self.dcs[1].get_logpath()), 1)
                 self.pkg("verify", exit=1)
- # Pkg should contact the server once more then store it in it's + # Pkg should contact the server once more then store it in its
                 # permanent location.
self.assertEqual(cnt_crl_contacts(self.dcs[1].get_logpath()), 2) - # Check that once the crl file is in it's permanent location, + # Check that once the crl file is in its permanent location,
                 # it's not retrieved again.
                 self.pkg("verify", su_wrap=True, exit=1)
self.assertEqual(cnt_crl_contacts(self.dcs[1].get_logpath()), 2)

Thanks,
Brock
_______________________________________________
pkg-discuss mailing list
pkg-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to